I am using the UnitOfWork pattern with EF 4, and was just wondering where the implementation of the EFUnitOfWork should live? Should it live in the Repository Layer? I have all of my Interfaces in the Domain Layer. Does this sound correct?
I am using Ninject to inject the Repositories with a IUnitOfWork.
I guess it really doesn't matter as you are not going to really test your EF specific repositories right?
The other option is to have it live in the Data Layer where the EF models and context are.
By having it in the Repository Layer, that layer now needs a reference to System.Data.Entity. Bad or OK?
Following DDD, you generally want a ProjectName.Core project in your solution. In that project would be structured as follows:
ProjectName.Core -> Repository (all your repository interfaces)
ProjectName.Core -> DomainModel
ProjectName.Core -> Infrastructure -> IUnitOfWork (uow interface)
ProjectName.Core -> Infrastructure -> DtatAccess (repository implementations and all the database related files Including uow implementation)
Some times if the project is large enough, I will add one more project to my solution called ProjectName.Infrastructure.DataAccess and place all the DataAccess implementations in that project.
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