DbQuery<TResult>.Include(String) Method

Definition

Specifies the related objects to include in the query results.

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

Parameters

path
String

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

Returns

A new DbQuery<TResult> 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