January 27, 2021
Hot Topics:

LINQ to Entities Preview

  • By Paul Kimmel
  • Send Email »
  • More Articles »

Adding ADO.NET Entity DataModel Elements

Entity Data Model elements can be added to any kind of project. In the Project Explorer, select Add new Item and follow these steps:

  1. Find the ADO.NET Entity Data Model template items and click it.
  2. Change the Name to AdventureWorks (see Figure 2). (This starts the Entity Data model Wizard.)
  3. In the Entity Data Model Wizard, on the Choose Your Data Connection page, select the AdventureWorks database. (You can create the connection here too; see Figure 3.)
  4. In the Choose Your Database Objects step of the wizard (see Figure 4), de-select Tables, Views, and Stored Procedures. Expand Tables and individually select Employee, EmployeeDepartmentHistory, Shift, and Contact. (The sample later will use this code to select employee shift histories.)
  5. Click Finish.

Click here for a larger image.

Figure 2: You can add an ADO.NET Entity Data model element to any kind of project.

Click here for a larger image.

Figure 3: The Entity Data Model Wizard is going to generate strongly typed entity classes for you after you select the database and complete the wizard.

Click here for a larger image.

Figure 4: Select just a few tables. You can create additional data models (or facets of the database) for different kinds of problems.

Page 2 of 4

This article was originally published on June 25, 2008

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date