The next step is to create an entity modal using the new
Entity Framework 4. Once you have a modal you can then add EntityDataSource
controls to you application that can dynamically query your database.
Right click on the web site in the Solution Explorer and select Add New
Item… from the pop-up menu.
Select ADO.NET Entity Data Model from the list of templates. Change the
file name to AdventureWorksModel.edmx and click the Add button. You'll get a
message asking if you want to create an App_Code folder.
Click Yes. This will display the Entity Data Model Wizard.
Choose Generate From Database and click the Next button.
The next screen asks you to choose a data connection. The drop down
list will display any connections you have already setup in the Server
Explorer. If you haven't already created a connection to the AdventureWorks
database then click the New Connection button.
This displays the Connection Properties form. Enter your server name,
authentication information, and select the AdventureWorks database from the list
of available databases.
Click the Test Connection button to make sure you have entered the right
information. If you get an error fix the settings and try again.
Once testing the connection is successful click the OK button.
The AdventureWorks connection should appear in the list of connections
and be selected.
sure the "Save entity connection settings in Web.Config as" checkbox
the Next button.
next form in the wizard allows you to select which tables, views, or stored
procedures you want to add to the model. We're only going to be editing the
Contact table so expand the Tables node and check the box next to the Contact
the Finish button. Visual Studio will add the AdventureWorks entity data model
to your web site.