Saturday, December 5, 2009

Entity Framework Quick Start Tutorial

Entity Framework is an OR/M that began shipping with .NET Framework 3.5 SP1 as part of ADO.NET.


In order to begin working with Entity Framework in VS.NET 2008, right click on a Project and select Add New Item.


Under the New Item dialog window, select data, and choose ADO.NET Entity Data Model.



This will create the EDMX file and corresponding codebehind classes.

Next, we need to choose the model contents, which will either start from a database source, or be a blank, new model.



I chose "Generate from Database Source", the quickest and easiest way to get up and running.

From here, you need to provide information about a database connection and database:



Based on the information provided, you will be given the option to choose database objects to include in the model.



Finally, this will create the EDMX file and corresponding codebehind partial classes for the model.

No comments:

Post a Comment