Query results

Okay, we know how to write a basic LINQ query, and we know when that query gets executed. But what exactly does “executed” mean in this context? What is the query returning? So far we’ve been using var or Dim to type our variables implicitly, but you need to know what you’re working with, right? Well, it depends on the query...

If your query includes a method that returns an aggregate value,  the return type will be the type returned by that value:

Image

If your query includes a method that returns a single entity, the return type will be that entity:

If your query returns a set of data, it will be in the form of an IQueryable<TEntity> ...

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.