Introduction
In this article, I will explain the process of creating and updating an .edmx file using Entity Framework Data Model in Visual Studio 2012. An .edmx file contains the conceptual model as well as the storage model along with the mappings between them. The procedure in this topic describes how to generate an .edmx file that is based on an existing database and how to generate an empty .edmx file.
Pre-Requisites
- SQL database and tables should be created and ready for use.
- You will need to have Visual Studio 2012 installed to complete this process.
Create the C# Application
- Open Visual Studio 2012.
- Click File -> New -> Project.
- Select Windows from the left menu and Console Application
- Enter EDMXApplication as the name.

- Select OK.
Create Entity Model
We’re going to use Entity Framework Designer that is included as a part in Visual Studio.
- Click on Project -> Add New Item.

- Select Data from the left menu and then ADO.NET Entity Data Model.

- Enter TestModel as the name and click OK.
- This launches the Entity Data Model Wizard.

- Select "Generate from database" and click Next.
- Select the connection to the database you created in the first section. Enter TestModelContext as the name of the connection string and click Next.

- Click the checkbox next to the ‘Tables’ to import all tables and click ‘Finish’.

- The new model is added to your project and opened for you to view in the Entity Framework Designer. An App.config file has also been added to your project with the connection details for the database.

- TestModel.tt file contains all your SQL table class files with all the entities.







Yogendra SahuPosted Oct 2, 2018, 5:14 AM
I am unable to update data model, Even I am not able to reach point no. 2
Muhammad Ashikuzzaman AshikPosted Sep 3, 2018, 11:44 PM
Nice info for entity framework. Thanks.
VEERENDRA kUMARPosted Aug 3, 2018, 7:37 AM
How many ways update edmx file.
Agustin JosePosted Oct 26, 2017, 11:07 AM
Good one!, really helpfull
Harish KhawathPosted Sep 24, 2016, 7:46 AM
Good one
Guru GunalPosted Sep 15, 2016, 10:22 AM
Good one
RajaPosted Aug 20, 2016, 1:00 AM
Nice share...