title: Dotnet core method injection with controller methods
body: <p>Lets say i have the following controller in dotnet core:</p>
  
  <pre><code>[Route("api/v1/[controller]")]
  public class ValuesController : Controller
  {
      private readonly IHandler&lt;ValuesRequest, ValuesResponse&gt; _valueHandler;
      private readonly IHandler&lt;ValuesIdRequest, ValuesIdResponse&gt; _valueIdHandler;
  
      public ValuesController(IHandler&lt;ValuesRequest, ValuesResponse&gt; valueHandler, 
                              IHandler&lt;ValuesIdRequest, ValuesIdResponse&gt; valueIdHandler)
      {
          _valueHandler = valueHandler;
          _valueIdHandler = valueIdHandler;
      }
  
      [HttpGet]
      public ValuesResponse Get(ValuesRequest request)
      {
          return _valueHandler.Handle(request);
      }
  
      [HttpGet("{id}")]
      public ValuesIdResponse Get(ValuesIdRequest request)
      {
          return _valueIdHandler.Handle(request);
      }
  }
  </code></pre>
  
  <p>As you can see in the code above, I'm using dependency injection though the constructor. However, I was thinking on how I could reduce the amount of code. So, I was thinking about using method injection, which should reduce the code to something like this:</p>
  
  <pre><code>[Route("api/v1/[controller]")]
  public class ValuesController : Controller
  {
      [HttpGet]
      public ValuesResponse Get(ValuesRequest request, IHandler&lt;ValuesRequest, ValuesResponse&gt; handler)
      {
          return handler.Handle(request);
      }
  
      [HttpGet("{id}")]
      public ValuesIdResponse Get(ValuesIdRequest request, IHandler&lt;ValuesIdRequest, ValuesIdResponse&gt; handler)
      {
          return handler.Handle(request);
      }
  }
  </code></pre>
  
  <p>I was wondering if it is possible to do something like this in combination with controller params. I tried finding an answer on the web, however I could not find  similar problem/solution.</p>