Tuesday, 16 April 2013

Why to use Entity Framework in .NET? Advantages of Entity Framework

Why to use Entity Framework in .NET? Advantages of Entity Framework
 
Entity Framework is an Object Relational Mapping (ORM) Framework for the .NET Framework. Entity Framework  returns the data in your database as an object.
 
Entity Framework is actually written on top of ADO.NET, meaning under this framework, we are still using ADO.NET. So we cannot say that Entity Framework is a replacement of ADO.NET.
 
Entity Framework basically generates business objects and entities according to the database tables.
 
Advantages of Entity Framework: There are lot of reason why should you use entity framework over LinqToSql and ADO.NET.
 
1. Database performance is improved. Updating your EDM based on your DB changes would take less time rather than the conventional methods. Database operations like select, insert, update, delete will work faster as you don't have to hit database again and again as you would be working with objects not with database tables.
 
2. Entity Framework performing basic CRUD (Create, Read, Update, Delete) operations. So most of the time you don't have to write any SQL yourself. When you make any changes to the object, the ORM will usually detect this, and mark the object as 'modified'. When you save all the changes in your ORM to the database, the ORM will automatically generate insert/update/delete statements, based on what you did with the objects.
 
3. Entity Framework works on databases other than Microsoft SQL Server, like Oracle, MySQL etc. While Linq is limited to MS SQL Server. It is easy to add support for another database (like Oracle) as we are programming against a model.
 
4. Easily managing "1 to 1", "1 to many", and "many to many" relationships.
 
5. Ability to have inheritance relationships between entities.

4 comments:

  1. ASP.NET has many advantages over other platforms when it comes to c reating Web applications. Probably the most significant advantage is its integration with the Windows server and programming tools.

    ReplyDelete
  2. Hello Naresh,

    Your article is very well written, thank you for posting.

    ReplyDelete
  3. hi you can get a nice article on
    http://www.sourcecodehub.com/Details/8/asp-net/interview-questions-with-answers/benefits-of-using-of-ado-net-in-net-4-0

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete