Pages

Wednesday, 10 July 2013

Create My First Entity Data Model(EDM)

 

This topic describes how to create a new .edmx file by using the Entity Data Model Wizard. An .edmx file contains the the conceptual model, as well as a storage model and the mappings between them. The procedures in this topic describe how to generate an .edmx file that is based on an existing database and how to generate an empty .edmx file.

Create new project in visual studio

clip_image002

Select ASP.NET Empty Web Application

(We can create Class library or console application)

clip_image004

Here Add new item in this project

clip_image006

Here we need to Add ADO.NET Entity Data Model

clip_image008

Now its open the Entity Data Model Wizard , we need to select option like Generate from database.

To create an empty .edmx file select the option Empty model.clip_image010

Here we need to create New Connection

clip_image011

Select the option Microsoft SQL Server

clip_image012

Enter the Server name here

clip_image014

Select he Database name from the dropdown list.

clip_image016

Click on the Test Connection button ,it will show the Test Connection success message

clip_image018

Now the new connection created and we can see the entity connection string.

clip_image019

Here we have the options to select Tables,Views,Stored Procedures and Functions from that database.

clip_image020

Now our first .edmx file is generated

clip_image022

In our solution of the project we can see .edmx file which generated automatically

clip_image023

Reference

http://msdn.microsoft.com/en-us/library/cc716703(v=vs.103).aspx

Summary

In this article we learned the basic steps to create the EDM

No comments:

Post a Comment