O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

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

Using the Data Model

The basic approach to using the entity data model is to create an instance of the entity context class and then use its properties to access the contents of the tables. In the tables, each row is represented by entity objects, which are instantiations of the entity classes that you saw modeled in Figure 8-9. We can use these objects and properties to query and manipulate the data in the database, as the following sections demonstrate.

Querying the Data Model

Listing 8-1 shows the contents of a web page to add to our project using the name ListEvents.aspx.

Listing 8-1. A simple web page

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ListEvents.aspx.cs"  Inherits="DataApp.ListEvents" %> <!DOCTYPE html PUBLIC "-//W3C//DTD ...

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