title: MassTransit and .NET Core DI - how to resolve dependencies with parameterless constructor?
body: <p>I am working on the app using .NET Core 2 and MassTransit 4(dev).</p>
  
  <p>Mass Transit requires parameterless constructor for consumers.
  I need to use e.g. logger, dbContext etc in my consumers and I would like to keep using native DI from .NET Core so I would prefer not to have to add Autofac etc (if possible?). It is causing the issue when .NET Core DI cannot inject my deps because my consumer is created with parameterless constructor...</p>
  
  <p>Is there any way to resolve dependencies using native net core DI while having parameterless constructor OR is there some way of declaring endpoints of MassTransit which would allow to do that other than standard:</p>
  
  <pre><code>sbc.ReceiveEndpoint(host, Configuration["QueueName"], 
                      e =&gt; { e.Consumer&lt;MyAwesomeConsumer&gt;();});
  </code></pre>
  
  <p><strong>I have tried:</strong></p>
  
  <pre><code>// =========== MASS TRANSIT ===============
              var serviceProvider = services.BuildServiceProvider();
              services.AddSingleton&lt;MyAwesomeConsumer, MyAwesomeConsumer&gt;();
              var bus = Bus.Factory.CreateUsingRabbitMq(sbc =&gt;
              {
                  var host = sbc.Host(new Uri("rabbitmq://localhost"), h =&gt;
                  {
                      h.Username("guest");
                      h.Password("guest");
                  });
  
                  sbc.ReceiveEndpoint(host, Configuration["QueueName"],
                      e =&gt;
                      {
                          e.Consumer(typeof(MyAwesomeConsumer), serviceProvider.GetService);
                      });
              });
  </code></pre>
  
  <p>Application lifts up but as soon as first message arrives I am getting an error: <code>MassTransit.ConsumerException: Unable to resolve consumer type 'AuthService.Integrations.MyAwesomeConsumer'.</code></p>
  
  <p>I will appreciate any help. 
  I hope it's clear what I am asking about.</p>