G1lles
ASP.NET Core - DbContext UOW with strict n-tier architecture
I am using Entity Framework Core with an n-tier architecture (persistence, business & application layer).
I am attempting to create a Unit of Work class for my MVC application. Ideally, I would use the Unit of Work instance in my controller. However, when trying to create my unit of work, I would need to use my repositories directly, but that would violate my architecture because then I would interact with the repositories directly instead of through my managers.
Hence, we came up with a possible "solution" to use my managers in my unit of work, but as you might've guessed already.. how would I then make sure all of my managers use the same DbContext?
I wonder if there is any way to make it work correctly, without violating the architecture.
4 replies