O'Reilly logo

ASP.NET 4 24-Hour Trainer by Toi B. Wright

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Using the ADO.NET Entity Framework

Most web applications are used to collect, manipulate and share information. To do that, they need a way to manage data easily. The ADO.NET Entity Framework is Microsoft's recommended data access technology. With the ADO.NET Entity Framework your application uses a conceptual data model, called the Entity Data Model, to manage the data. In this lesson I show you how to create an Entity Data Model (EDM) and how to manage data using the EDM.

In this lesson I use a simple SQL Server database with the following four tables:

  • Category Table — Contains the categories for the recipes.

  • Recipe Table — Contains the recipes.

  • Ingredients Table — Contains the ingredients for each recipe.

  • Tools Table — Contains the tools for each recipe.

Figure 18-1 shows the database diagram for the database.

FIGURE 18-1

Figure 18.1. FIGURE 18-1

CREATING A SQL SERVER DATABASE

In this lesson I show you how to use the Entity Data Model Wizard to create an Entity Data Model from an existing database. However, if the database does not exist, you can create it from within the Microsoft Visual Web Developer 2010 Express IDE by following these steps:

  1. Create an App_Data folder, if your application does not already have one. To create an App_Data folder, right-click the name of your project on the Solution Explorer window and select Add

  2. Create the SQL Server database. To create a SQL Server database, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required