Wednesday, 25 November 2015

Entity Framework

Entity Framework
ADO.NET is a very strong framework for data access. 
ADO.NET has been around since many years and there are a lot of systems running over ADO.NET. Developers who are totally oblivious to the concept of ORMs will probably be asking "What is Entity Framework? What are the benefits of using it and is it an alternative to ADO.NET?"
Well, to answer the first question about what is Entity Framework, Entity Framework is an Object Relational Mapper (ORM). It basically generates business objects and entities according to the database tables and provides the mechanism for:
1.       Performing basic CRUD (Create, Read, Update, Delete) operations.
2.       Easily managing "1 to 1", "1 to many", and "many to many" relationships.
3.       Ability to have inheritance relationships between entities.
and to answer the second question, the benefits are:
1.       We can have all data access logic written in higher level languages.
2.       The conceptual model can be represented in a better way by using relationships among entities.
3.       The underlying data store can be replaced without much overhead since all data access logic is present at a higher level.
and finally, the last question that whether it is an alternative to ADO.NET, the answer would be "yes and no". Yes because the developer will not be writing ADO.NET methods and classes for performing data operations and no because this model is actually written on top of ADO.NET, meaning under this framework, we are still using ADO.NET. So let us look at the architecture of Entity Framework (diagram taken from MSDN):

More Read: Click here