Getting Started with the ADO.NET Entity Framework
The ADO.NET Entity Framework, the next generation of Microsoft’s data access technology, is an extended Object Relational Mapping (ORM) technology that makes it easy to tie together the data in your database with the objects in your applications. This is done by abstracting the object model of an application from its relational or logical model. It is an extended ORM in the sense that it provides many additional features over an ORM. Some of these features are:
- Entity Inheritance and Composition
- Identity Resolution and Change Tracking
- LINQ Support
- The Object Service Layer
In this article, we will cover the following points:
- Creating an Entity Data Model
- Introducing the Entity Data Source Control
- Implementing our first application using the ADO.NET Entity Framework
We will start this article with a discussion on how we can create an Entity Data Model from a Payroll database.
Creating an Entity Data Model
You can create the ADO.NET Entity Data Model in one of two ways:
- Use the ADO.NET Entity Data Model Designer
- Use the command line Entity Data Model Designer called EdmGen.exe
We will first take a look at how we can design an Entity Data Model using the ADO.NET Entity Data Model Designer which is a Visual Studio wizard that is enabled after you install ADO.NET Entity Framework and its tools. It provides a graphical interface that you can use to generate an Entity Data Model.
Creating the Payroll Entity Data Model Using the ADO.NET Entity Data Model Designer
Here again are the tables of our Payroll database that we will use to generate the data model:
- Provident Fund
To create an entity data model using the ADO.NET Entity Data Model Designer, follow these simple steps:
1. Open Visual Studio.NET and create a solution for a new web application project as seen below and save with a name.
2. Switch to the Solution Explorer, right click and click on Add New Item as seen in the following screenshot:
3. Next, select ADO.NET Entity Data Model from the list of the templates displayed as shown in the following screenshot: