8.13. Model-First Generation

EF4 allows you to create your entity model in Visual Studio and use it to generate and update database structure. At the time of writing, this works only with SQL Server. This facility is great for users unfamiliar with SQL or in situations where you do not have access to the database.

  1. Create a new C# console project called Chapter8.ModelFirst.

  2. Add a new ADO.NET Entity Data Model called CustomerModel.

  3. Click Next.

  4. Select "Empty model" (Figure 8-14) on the next step and click Finish.

    Figure 8.14. Select the "Empty model" option
  5. Open the newly created empty CustomerModel.edmx.

  6. Right-click the design surface and select Add ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.