Search code examples
c#asp.net-mvcrepositoryunit-of-workprodinner

Prodinner service layer repositories


I have been looking at the Prodinner sample on CodePlex to use as an example for my app and specifically like the idea of the ICrudService but how does this work with transactions and context sharing? Is the IoC just providing a single request scope for the DbContext or no?

I've also heard that the unit of work pattern is pointless with EF code first because the DbContext is a unit of work itself, is this correct?

http://prodinner.codeplex.com/


Solution

  • yes the EF DbContext and the NHibernate Session are Unit of Work

    the DbContext in proddinner is resolved with LifeStyle.PerWebRequest by the IoC and it is shared in that request by all the repositories