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 ...

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.