Search This Blog

Oct 17, 2012

What is Entity Framework?

asfasfThe Microsoft ADO.NET Entity Framework is an Object/Relational Mapping (ORM) framework that enables developers to work with relational data as domain-specific objects, eliminating the need for most of the data access plumbing code that developers usually need to write. Using the Entity Framework, developers issue queries using LINQ, then retrieve and manipulate data as strongly typed objects. The Entity Framework’s ORM implementation provides services like change tracking, identity resolution, lazy loading, and query translation so that developers can focus on their application-specific business logic rather than the data access fundamentals.
To simply say it: Entity framework is an Object/Relational Mapping (O/RM) framework. It is an enhancement to ADO.NET that gives developers an automated mechanism for accessing & storing the data in database and working with the results in addition to DataReader and DataSet.

Now the question is what is O/RM framework and why do we need it?

ORM is a tool for storing data from domain objects to relational database like MS SQL Server in automated way without much programming. O/RM includes three main parts: Domain class objects, Relational database objects and Mapping information on how domain objects maps to relational database objects (tables, views & storedprocedures). ORM helps us to keep our database design separate from our domain class design. This makes application maintainable and extendable. It also automates standard CRUD operation (Create, Read, Update & Delete) so developer doesn’t need to write it manually.

There are many ORM frameworks for .net in the market like DataObjects.Net, NHibernate, OpenAccess, SubSonic etc . ADO.NET Entity Framework is from Microsoft.

What is Entity Framework 4.0? Why do we need a new Data Access Technology?

All these years, Microsoft has been providing different ways to communicate with the Database. Developers have been switching from one data access technology to the other, starting with DAO (Data Access Objects), then RDO (Remote Data Objects), then ADO (ActiveX Data Objects) and then finally ADO.NET. ADO.NET has been around from quite some time and Microsoft has invested a great deal of resources in it, with new features added to it every now and then. Although working with the DataSet and DataReader has served our data access needs for many years, a developer spends a lot of time being concerned with the details of the schema, trying to keep up with database schema changes and doing redundant tasks while interacting with the database, over and over again.

The ADO.NET Entity Framework (EF) is an Object/Relational mapping (ORM) framework and is a set of technologies in ADO.NET, for developing applications that interacts with data. We just discussed that an ADO.NET developer spends a lot of time keeping up with the database changes. Well EF provides a mapping from the relational database schema to the objects and offers an abstraction of ADO.NET. So with EF, you can define Entity classes that are independent of a database structure and then map them to the tables and associations of the database. Since we are now working with Entities which have their own schema, we are shielded from the changes in the database. The object context keeps tabs on the entities that are changed.

In simple words, with the Entity Framework, you are architecting, designing and developing at a conceptual level. You are no more worried about the ‘specific details’ of communicating with the database and switching from one relational database to the other is also possible with EF, without much efforts. 

What happens to ADO.NET now?

ADO.NET is here to stay! EF was not released with the intension to replace ADO.NET. It is in fact an enhancement to ADO.NET and helps eliminate the gap between the application and the database. Behind the scene, EF uses ADO.NET classes, but the details are abstracted from you. EF provides a shift from Database-oriented (DataReader, DataSet) to Model-oriented development. So instead of focusing on a Database, a developer focuses on the Entity that represents the Business Model of the application.

If the purpose of EF is not yet clear, it will be, in the forthcoming articles when we will explore its features and look at it in detail. Continue reading as I am about to explain why EF was chosen over LINQ To SQL!

When was Entity Framework Released? 

Although announced in TechEd 2006, the first version of Entity Framework 3.5 was released two years later in August 2008, along with Visual Studio 2008 SP1 and .NET 3.5 SP1.

The second version (also the current version) of Entity Framework i.e. 4.0 was released in April 2010 along with VS 2010 and .NET 4.0


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...