An ORM (Object Relational Mapping) tool is one that is used to abstract the data access logic of your application. You can use ORM to bridge the apparent mismatch between the data and the object models.
What is an ORM? Why is it needed?
An application that is data centric can have two perspectives — the data model and the object mode. The data model defines how the data is stored in the data store. The data store can be a relational database like SQL Server, Oracle, etc. On the contrary, the object model represents the application’s object oriented programming model. In using ORM tools, you can focus on the business logic of the application and you can store data in the database with much less code.
You can take advantage of an ORM to convert data between incompatible type systems – you can store your domain objects into the underlying database without having to worry about the internal intricacies on how the data is actually stored.
The ADO.NET Entity Framework
Microsoft’s Entity Framework is an extended ORM that helps you to isolate the object model of your application from the data model, i.e., from the way the data is actually stored and represented in the underlying database. You can use the Entity Framework to program against the object model in lieu of the data model and perform CRUD operations on top of it. With Entity Framework which is an Microsoft’s flagship data access platform, you can work with relational data using domain-specific objects.
The ADO.Net Entity Framework basically comprises of the following three layers:
- The Conceptual Layer or the C-Space Layer – Represented using CSDL (Conceptual Data Language)
- The C-S Mapping Layer – Represented MSL (Mapping Schema Language)
- The Logical or the Storage Layer (also called the S-Space) – Represented using SSDL (Store-specific Data Language)