Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

DbExtensions.Include(T) Method (IQueryable(T), String)

Entity Framework 5.0

Specifies the related objects to include in the query results.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)
JScript does not support generic types and methods.

Type Parameters

T

The type of the entity being queried.

Parameters

source
Type: System.Linq.IQueryable(T)

The source IQueryable on which to call Include.

path
Type: System.String

The dot-separated list of related objects to return in the query results.

Return Value

Type: System.Linq.IQueryable(T)
A new IQueryable of T with the defined query path.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IQueryable(T). When you use instance method syntax to call this method, omit the first parameter. For more information, see http://msdn.microsoft.com/en-us/library/bb384936 or http://msdn.microsoft.com/en-us/library/bb383977.

Paths are all-inclusive. For example, if you pass “Orders.OrderLines” to the Include method (as in the following example: Include("Orders.OrderLines")), not only will OrderLines be included, but also Orders. When you call the Include method, the query path is only valid on the returned instance of the IQueryable of T. Other instances of IQueryable of T and the context itself are not affected. You can call this method multiple times on an IQueryable of T to specify multiple paths for the query.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.