Include Method

DbQuery.Include Method (String)

 

Specifies the related objects to include in the query results.

Namespace:   System.Data.Entity.Infrastructure
Assembly:  EntityFramework (in EntityFramework.dll)

public virtual DbQuery Include(
	string path
)

Parameters

path
Type: System.String

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

Return Value

Type: System.Data.Entity.Infrastructure.DbQuery

A new DbQuery<T> with the defined query path.

Paths are all-inclusive. For example, if an include call indicates 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 DbQuery<T>. Other instances of DbQuery<T> and the object context itself are not affected. Because the Include method returns the query object, you can call this method multiple times on an DbQuery<T> to specify multiple paths for the query.

Return to top
Show:
© 2016 Microsoft