Question

I used repository and UnitOfWork Design pattern in my project.I have some common CRUD function in generic repository that all repository inherit that.In act I have one repository per entity in project.So my question is can I access directly DbContext from Repository or not? I want to create Projection model from two entity but in different repository?

Was it helpful?

Solution

You definitely can do that - you can provide protected DbContext from base repository. But I don't think that accessing other repositories from repository is a very good idea. It's better to place such operation (which uses several repositories) into domain service.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top