DbQuery<TResult>.Include Method
[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]
Specifies the related objects to include in the query results.
Namespace: System.Data.Entity.Infrastructure
Assembly: EntityFramework (in EntityFramework.dll)
Syntax
'Declaration
Public Overridable Function Include ( _
path As String _
) As DbQuery(Of TResult)
'Usage
Dim instance As DbQuery
Dim path As String
Dim returnValue As DbQuery(Of TResult)
returnValue = instance.Include(path)
public virtual DbQuery<TResult> Include(
string path
)
public:
virtual DbQuery<TResult>^ Include(
String^ path
)
abstract Include :
path:string -> DbQuery<'TResult>
override Include :
path:string -> DbQuery<'TResult>
public function Include(
path : String
) : DbQuery<TResult>
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<TResult>
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&lt;T&gt;. Other instances of DbQuery&lt;T&gt; 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&lt;T&gt; to specify multiple paths for the query.