What is a query, exactly?

Before we start looking at the various ways you can write queries against your model, let’s take a minute to explore exactly how this whole query stuff works. We’ll start by looking at a code construct that works in a similar way: .NET delegates:

Although the details vary depending on the language and UI platform you choose, the basic delegate pattern is always the same in .NET:

Image

When you’re working with queries, the details will vary depending on the language (LINQ or Entity SQL) and Entity Framework API you’re using (ObjectContext or DbContext), but the basic pattern is the same:

The query variable defines the data ...

Get Fluent Entity Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.