DbQuery.Include(String) Method

Definition

Specifies the related objects to include in the query results.

public virtual System.Data.Entity.Infrastructure.DbQuery Include (string path);
abstract member Include : string -> System.Data.Entity.Infrastructure.DbQuery
override this.Include : string -> System.Data.Entity.Infrastructure.DbQuery
Public Overridable Function Include (path As String) As DbQuery

Parameters

path
String

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

Returns

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

Remarks

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.

Applies to