There are so many conflicting articles online. What's your personal opinion on this (for an enterprise app).....
In my C#/MVC app I've setup my architecture as suggested here, minus dependency injection and automapper: https://chsakell.com/2015/02/15/asp-net-mvc-solution-architecture-best-practices/
In general, when speaking of the MVC controller, should it only deal with the service layer directly? Or is it still good practice to deal with the repository directly? What would help you to decide?
Also, should the UnitOfWork class be created at the controllers level then passed into Service/repo?
Thanks
Well, Unit of work, I think is useless as DBContext could be the unit of work, Also you could use the DbContext as repository. Do I need repository and service layers, I think just one of them is enough depends on the complexity of the project, service is layer is when you have more complex project. You should think of how you could re-use your code, and keep it simple, but not to create a lot of layers, with non reusable code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With