title: How do you avoid lots of [FromService] parameters with ASP.NET Core dependency injection?
body: <p>I have an ASP.NET Core project that uses lots of dependency injection.</p>
  
  <p>The problem is that these start to stack up on my controller actions:</p>
  
  <pre><code>public async Task LoginAsync(
      [FromBody] LoginModel login,
      [FromServices] IConnectionMultiplexer redis,
      [FromServices] ISerialiserFactory serialiser,
      [FromServices] IDataService dataService,
      [FromServices] ILookupNormalizer normaliser,
      [FromServices] IPasswordHasher hasher,
      ...
  </code></pre>
  
  <p>I can put these in the constructor, but most methods don't use them and those that do don't always use all of them.</p>
  
  <p>I can directly instantiate them, but then I lose the ability to inject them in the startup.</p>
  
  <p>Is there an easier way to get at these injected services? Ideally I want to call something like:</p>
  
  <pre><code>// It turns out I need the injected serialiser
  var serialiser = services.Get&lt;ISerialiserFactory&gt;();
  </code></pre>
  
  <p>Is there a way to do this already in ASP.NET Core?</p>