How we can use Unit of Work pattern with (Entity Framework 4.1) code first approach?
As I know, EF 4.1 has internally implemented the Unit of Work and repository patterns. If we use self tracking and Data Transfer Objects pattern do we also need to implement a Unit Of Work pattern?
How we can use Unit of Work pattern with (Entity Framework 4.1) code first
Share
If you use web services and stateless things, you need to track user entity state manually because DBContext should be disposable (the recommended usage). In other words, DBContext should be wrapped within a Using Block. The Unit of work pattern helps to reduce the dependency between Entity Framework and your infrastructure layer. This is ideal for stateless implementations like WCF services over DTO.