title: Set up Dependency Injection on Service Fabric using default ASP.NET Core DI container
body: <p>I would like to use ASP.NET Core's default DI container to setup DI for my Service Fabric project.</p>
  
  <pre><code>//This is what I've got so far, and it works great
  ServiceRuntime.RegisterServiceAsync(
    "MyServiceType",
    context =&gt; new MyService(context, new MyMonitor()
  ).GetAwaiter().GetResult();
  
  //This is how I use it
  public MyService(StatefulServiceContext context, IMonitor myMonitor)
    : base(context)
  {
    this._myMonitor = myMonitor;           
  }
  </code></pre>
  
  <p>How would I set up DI, if <code>MyMonitor</code> class has a dependency on a <code>ConfigProvider</code> class, like this:</p>
  
  <pre><code>public MyMonitor(IConfigProvider configProvider)
  {
    this._configProvider = configProvider;
  }
  </code></pre>