title: .NET Core Dependency Injection - Force Immediate Activation
body: <p>It is my understanding that injected classes aren't activated until one of the constructors are invoked (like a Controller in my MVC-project). However, is it possible to force the activation of a Singleton immediately, so I don't have to wait for a controller to be invoked? I guess I could do:</p>
  
  <pre><code>services.AddSingleton(new MySingleton());
  </code></pre>
  
  <p>But what if MySingleton uses DI in its constructor? Is there a way to call the constructor? Should I instead change the constructor to have the IServiceProvider as parameter and manually extract the dependencies?:</p>
  
  <pre><code>_myDependency = serviceProvider.GetService&lt;MyDependency&gt;();
  </code></pre>