title: the program is not able to find handler for MediatR query ASP.Net Core
body: <p>I'm using ASP.Net Core 2.2 and MediatR framework/library for query objects. When I run the program i face to this exception:</p>
  
  <blockquote>
    <p>InvalidOperationException: Handler was not found for request of type
    MediatR.IRequestHandler<code>2[Store.Core.Queries.GetProductTypesQuery,System.Collections.Generic.IEnumerable</code>1[Store.Core.DomainModels.ProductType]].
    Register your handlers with the container.</p>
  </blockquote>
  
  <p>I added these packaged to my Store project (main project)</p>
  
  <p>1- MediatR 7.0.0</p>
  
  <p>2- MediatR.Extensions.Microsoft.DependencyInjection</p>
  
  <p>This is my <strong>Startup.cs</strong></p>
  
  <pre><code>services.AddMediatR(typeof(Startup));
  </code></pre>
  
  <p>So this is my <strong>Query</strong> (located in a project called "Store.Core")</p>
  
  <pre><code>namespace Store.Core.Queries.Products
  {
     public class GetProductTypesQuery : IRequest&lt;IEnumerable&lt;ProductType&gt;&gt; { }
  }
  </code></pre>
  
  <p>This is my <strong>QueryHandler</strong> (located in another project called "Store.Data")</p>
  
  <pre><code>namespace Data.Queries.Products
  {
      public class GetProductTypesQueryHandler : IRequestHandler&lt;GetProductTypesQuery, IEnumerable&lt;ProductType&gt;&gt;
      {
          private ApplicationDbContext _context;
          public GetProductTypesQueryHandler(ApplicationDbContext context)
          {
              _context = context;
          }
  
          public async Task&lt;IEnumerable&lt;ProductType&gt;&gt; Handle(GetProductTypesQuery request, CancellationToken cancellationToken)
          {
              return await _context.ProductType.OrderBy(p =&gt; p.ProductTypeID).ToListAsync();
          }
  
      }
  }
  </code></pre>
  
  <p>This is the Controller I used the MediatR</p>
  
  <pre><code>namespace Store.Controllers
  {
      public class HomeController : Controller
      {
          private readonly IMapper _mapper;
          private readonly IMediator _mediator;
          public HomeController(IMapper mapper, IMediator mediator)
          {
              _mapper = mapper;
              _mediator = mediator;   
          }
  
  
          public IActionResult Home() =&gt; View();
  
          [HttpGet]
          public async Task&lt;IActionResult&gt; Dishes(GetProductTypesQuery query) {
              var productTypes = await _mediator.Send(query);
              var productTypesViewModel = _mapper.Map&lt;IEnumerable&lt;ProductTypeVM&gt;&gt;(productTypes);
              return View(productTypesViewModel);
          }
  }
  }
  </code></pre>
  
  <p>my <strong>ProductType</strong> model (I Think it's not necessary but i added it in order to provide full info)</p>
  
  <pre><code>namespace Store.Core.DomainModels
  {
      public class ProductType
      {
         public int ProductID { get; set; }
         public string ProductName { get; set; }
      }
  }
  </code></pre>
  
  <p>The only part which is fishy for me is StartUp.cs (because I have queries and queries handlers in diffrent projects) but I don't know what i'm missing.</p>