Islander’s Analog life….

June 15, 2008

ADO.NET Entity Framework 101

Note: To use the ADO.NET Entity Framework you are going to need Visual Studio 2008 + SP1

What is it?

Basically it allows you to create a model of your database and map objects to relational data (classes).  It marries classes to tables.  Using LINQ you can easily query the classes auto generated by the model.

Quick Sample

Step #1

Add New Item to your project “ADO.NET Entity Data Model ” (generates edmx file)

addnewitem.jpg

Step #2

Follow Entity Data Model Wizard
wizard1.jpg

wizard2.jpg

wizard3.jpg

Step #3

A new model is generated with the tables you selected in the wizard.  Also new classes are generated which you can query from LINQ

visualstudio.jpg

Look at the mapping Details tab, where you can see how the table fields aer mapped to a class.

Here is a simple sample of how to query the class auto generated:

visualstudio1.jpg

1 Comment »

  1. [...] ADO.NET Entity Framework 101 [...]

    Pingback by Microsoft Tech*Ed 2008, Orlando Florida (Update) | A blog about life, science, finances and technology — June 15, 2008 @ 9:13 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress