Reputation: 2009
Slowly putting an MVC app together with class libraries: MVC > Services > IRepository > EFRepository. Now at the moment, my EFRepository implementations each create a new dbContext in their constructor but this prevents testing so I need to inject the dbContext instead.
I am successfully using unity.mvc3 for DI throughout the rest of my app but am confused as to how to correctly implement the dbContext injection.
Think I'm just a bit lost on where to go from here. I was thinking that I should have a Unit of Work but it seems to me this would happen at the service layer.
All help appreciated,
James
Upvotes: 1
Views: 400
Reputation: 990
Upvotes: 3