LINQ to Entities Preview, Page 2
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:
- Find the ADO.NET Entity Data Model template items and click it.
- Change the Name to AdventureWorks (see Figure 2). (This starts the Entity Data model Wizard.)
- 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.)
- 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.)
- Click Finish.
Figure 2: You can add an ADO.NET Entity Data model element to any kind of project.
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.
Figure 4: Select just a few tables. You can create additional data models (or facets of the database) for different kinds of problems.