Can anybody explain me what are the benefits of Repository and Unit of work pattern? What are the benefits of Entity Framework code first approach?
Misunderstand just not aware your Q
Implementing the Repository Pattern
The Repository pattern assists in separating data storage concerns from the application logic. This pattern is especially beneficial when you use the ADO.NET Entity Framework because it allows you to hide ADO.NET Entity Framework-specific classes such as
DbContext and DbSet, to optimize the shape of the data returned to the application, to coordinate updates, and to unit test your application without requiring access to physical data storage.
A repository is a set of interfaces and implementations providing methods for data access. The interfaces do not expose any types specific to data storage. You can choose how many repositories to create based on how granularly you want to control data access
within your application.
IUnitOfWork
The only purpose is that share the same context. Why?e.g: To prevent to perform multiple task at the same time.A few context try to update, insert, delete database item. If so the app will be hang or might error.
Best Regards
Weera
Marked as answer by Irfan Hyderabad on Feb 21, 2012 09:19 AM
thaicarrot
Contributor
5120 Points
1459 Posts
Re: Repository and Unit of work pattern, EF code first
Feb 20, 2012 03:36 PM|LINK
Misunderstand just not aware your Q
Implementing the Repository Pattern
The Repository pattern assists in separating data storage concerns from the application logic. This pattern is especially beneficial when you use the ADO.NET Entity Framework because it allows you to hide ADO.NET Entity Framework-specific classes such as DbContext and DbSet, to optimize the shape of the data returned to the application, to coordinate updates, and to unit test your application without requiring access to physical data storage.
A repository is a set of interfaces and implementations providing methods for data access. The interfaces do not expose any types specific to data storage. You can choose how many repositories to create based on how granularly you want to control data access within your application.
IUnitOfWork
The only purpose is that share the same context. Why?e.g: To prevent to perform multiple task at the same time.A few context try to update, insert, delete database item. If so the app will be hang or might error.
Weera