What are the benefits of Entity Framework code first approach?
Let's see, assuming that the database already exists... Code first is kind of pointless without a database, wouldn't you agree?
If you have a good good book, Pro ASP.NET MVC 3 is what I use, you'll be using a Interface first that complicates things a bit because you have to remember to extend the Interface before extending your Concrete class. It also complicates your ability to
update the database, because you have to cast back to your Concreate type to access the SaveChanges() method.
Given those disadvantages, why would anyone want to use Entity Framework in the first place? To avoid having to write ADO.Net repetitive code ever again. Users of the Entiry Framework are using LINQ for their queries which is much more succinct than the
ADO.Net framework could ever dream of being.
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
Irfan Hydera...
Member
31 Points
24 Posts
Repository and Unit of work pattern, EF code first
Feb 20, 2012 03:09 PM|LINK
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?
thaicarrot
Contributor
5132 Points
1465 Posts
Re: Repository and Unit of work pattern, EF code first
Feb 20, 2012 03:19 PM|LINK
Hi IRFAN
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application
Weera
eric2820
Contributor
2777 Points
1161 Posts
Re: Repository and Unit of work pattern, EF code first
Feb 20, 2012 03:23 PM|LINK
What are the benefits of Entity Framework code first approach?
Let's see, assuming that the database already exists... Code first is kind of pointless without a database, wouldn't you agree?
If you have a good good book, Pro ASP.NET MVC 3 is what I use, you'll be using a Interface first that complicates things a bit because you have to remember to extend the Interface before extending your Concrete class. It also complicates your ability to update the database, because you have to cast back to your Concreate type to access the SaveChanges() method.
Given those disadvantages, why would anyone want to use Entity Framework in the first place? To avoid having to write ADO.Net repetitive code ever again. Users of the Entiry Framework are using LINQ for their queries which is much more succinct than the ADO.Net framework could ever dream of being.
http://www.my-msi.net/Admin
blog
If a post helps you, please mark it as Ansered, thank-you.
thaicarrot
Contributor
5132 Points
1465 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