title: Mediatr with generic handler and query
body: <p>I am working on a ASP.NET Core 2.2 Web API application with Mediatr.</p>
  
  <p>I have a handler that looks like - </p>
  
  <pre><code>public class MyQueryHandler&lt;T&gt; : IRequestHanlder&lt;MyQuery&lt;T&gt;, IQueryable&lt;T&gt;&gt;
  {
     public Task&lt;IQueryable&lt;T&gt;&gt; Handle(MyQuery&lt;T&gt; myquery, CancellationToken cancellationToken)
     {
         //perform query
  
         IQueryable&lt;T&gt; models = someDatabaseQuery.ProjectTo&lt;T&gt;();
     }       
  }
  </code></pre>
  
  <p>This is the query -</p>
  
  <pre><code>public class MyQuery&lt;T&gt; : IRequest&lt;IQueryable&lt;T&gt;&gt;
  {
     //some properties
  }
  </code></pre>
  
  <p>When I try to make a request like this - </p>
  
  <pre><code>var result = await _mediator.Send(new MyQuery&lt;SomeModel&gt; {/* set the properties on the query */})
  </code></pre>
  
  <p>I get an exception - </p>
  
  <pre><code>An unhandled exception occurred while processing the request.
  
  InvalidOperationException: Handler was not found for request of type MediatR.IRequestHandler`2[MyQuery`1[SomeModel],System.Linq.IQueryable`1[SomeModel]]. Register your handlers with the container. See the samples in GitHub for examples.
  </code></pre>
  
  <p>I have spent quite a few hours tried a many things but none have worked. I even tired using Autofac along side the service collection, following the example provided in the Mediator github repo. </p>