I'm trying to architect an application using CQRS pattern instead of Repositories and Onion architecture instead of n-layers using MVC5 stack.
I have the following layers right now:
Web.Data - Contains DbContext
Web.Model - POCO classes
Web.Service - Implementation of Commands and Queries using MediatR
--Commands
-----Request
-----Handlers
--Queries
-----Request
-----Handlers
Web.UI
I was thinking to put the Business Logic (e.g validations) on the Handler classes but I recon that those classes have direct access to EF. Is it still a good place to put those logic?
How about if I have an Emailing logic or shipping logic? On traditional layers, they naturally go to Application service having the repositories being injected on that service, how do they'll fit in on the current architecture? We don't wanna go repository route since we want to leverage EF as a whole instead abstracting it even more.
Should I have a traditional Service Layer that accepts the MediatR interface and have the Controllers have the Service interface instead?