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:
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 (
DbContext), but the basic pattern is the same:
The query variable defines the data ...