Creating the Data Model

The Entity Framework is an object-relational mapping (ORM) system that allows us to work with relational data using C# objects. What makes this possible is a data model, which uses C# classes to represent the tables and columns in the database.

Visual Studio contains a wizard that simplifies creating the data model and adding it to a project. We are going to build a model using the sample database included in the download that accompanies this book. This database is called TrainingData, and it is intended to track triathlon training data.

Follow these steps to create the data model:

  1. Create a new Visual Studio project using the ASP.NET Empty Web Application template, as shown in Figure 8-1. Name this project DataApp. ...

Get Applied ASP.NET 4 in Context now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.