subject: Entity Framework In Asp Dot Net Development [print this page] While carrying out .NET development using ADO.NET, traditional ways are followed wherein database tables along with their relationships are created followed by classes in the code, for the business layer. The business logic is written in these classes, those perform various functions and operations on the database. Movement of data between the application and the database often requires complex coding. The developer in such cases spends a lot of time keeping up with the changes in the database. The Entity Framework deals with a database table as a single entity, allowing developers to code and maintain applications with ease. Creation of conceptual model of the data, using entity-relationship model, allows developers to write codes against this model, i.e. deal with database concepts in the code itself. The framework promises to make object-oriented development easy, efficient and effective. It is an ORM, i.e. Object-Relational Mapping Framework which provides for mapping from the RDBMS schema to the objects, offering an abstraction of the ADO.NET pattern. The framework allows design and development at a conceptual level, wherein developers can define entity classes those are independent of the database and those are mapped to the tables of the database. Since these entities have their own schema, developers are shielded from database modifications, while the object context keeps tab on the changed entities. The framework does a wonderful job of eliminating gap between the database and the associated application, wherein the developer can focus on the entity representing the business model, instead of worrying about the database or the frequent changes in it. The first version of the framework found release with .NET 3.5 SP1, while the latest version 4.0 comes in collaboration with Visual Studio 2010 and .NET 4.0, with all the necessary technology and tools.
The framework performs the task of mapping relational tables, columns and foreign key constraints of logical models to entities/relationships existing in conceptual models, where in the data model generates extendable data classes, derived from base classes those provide object services for establishing entities as objects, tracking and saving modifications. It is much easier for ASP .NET developers to manipulate and work with these objects related through navigation properties. Object Services component of the framework enables developers to query, insert, update, delete data, expressed as CLR objects those are essentially entity types" instances. This component supports the entity-SQL as well as the language-integrated queries. EF facilitates applications" access and modification of data, represented as entities and relationships in the conceptual model while object services use the data-model to translate and transform object queries against types of entities into data source-specific queries. The resultant objects are again managed by the object services. The abstraction layer between the data model and the application data is thus provided by the framework. Now, when the logical tables are generated to the entity data diagram, the framework actually combines multiple data tables to a single entity. The framework provides many functional benefits to the developers:
There"s more freedom for developers to work on an application-oriented "conceptual" model "" with support for entities, relationships, composition, complex members, inheritance, identity resolution, chance tracking, etc.
Development initiatives are free from tightly-bound storage schema or database engine dependency.
Changes in Database Schema-Conceptual Model mapping are independent of changes in the code.
A consistent Object Model allows developers to map the model to different data schemas, even in discreet RDBMS.
A single data-source schema could be mapped to more than one conceptual model.
LINQ support enables run-time syntax validation for queries against the conceptual model, during compilation.