Share via

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]

Specifies the related objects to include in the query results.

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


Public Overridable Function Include ( _
    path As String _
) As DbQuery(Of TResult)
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
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>


  • 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.


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&amp;lt;T&amp;gt;. Other instances of DbQuery&amp;lt;T&amp;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&amp;lt;T&amp;gt; to specify multiple paths for the query.

See Also


DbQuery<TResult> Class

System.Data.Entity.Infrastructure Namespace