O'Reilly logo

Entity Framework 4.0 Recipes: A Problem-Solution Approach by Larry Tenny, Zeeshan Hirani

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 3. Querying an Entity Data Model

In the previous chapter, we showed you lots of different ways to model some fairly common database scenarios. In this chapter, we dive right into querying your models.

In these recipes we'll show you how to use LINQ and Entity SQL to query your models. We'll cover a wide range of common and some not so common scenarios that will help you understand some of the basics of querying your models.

Executing an SQL Statement

Problem

You want to execute an SQL statement.

Solution

Let's say you have a Payment table like the one shown in Figure 3-1 and you have created a model that looks like the one in Figure 3-2.

A Payment table that contains information about a payment made by a vendor

Figure 3.1. A ...

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