DbExtensions.Include(Of T) Method (IQueryable(Of T), String)
Specifies the related objects to include in the query results.
Assembly: EntityFramework (in EntityFramework.dll)
'Declaration <ExtensionAttribute> _ Public Shared Function Include(Of T As Class) ( _ source As IQueryable(Of T), _ path As String _ ) As IQueryable(Of T) 'Usage Dim source As IQueryable(Of T) Dim path As String Dim returnValue As IQueryable(Of T) returnValue = source.Include(path)
The type of the entity being queried.
- Type: System.Linq.IQueryable(Of )
The source IQueryable on which to call Include.
- Type: System.String
The dot-separated list of related objects to return in the query results.
Return ValueType: System.Linq.IQueryable(Of )
A new IQueryable of T with the defined query path.
Usage NoteIn Visual Basic and C#, you can call this method as an instance method on any object of type IQueryable(Of ). When you use instance method syntax to call this method, omit the first parameter. For more information, see http://msdn.microsoft.com/en-us/library/bb384936 or http://msdn.microsoft.com/en-us/library/bb383977.
Paths are all-inclusive. For example, if you pass “Orders.OrderLines” to the Include method (as in the following example: 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 IQueryable of T. Other instances of IQueryable of T and the context itself are not affected. You can call this method multiple times on an IQueryable of T to specify multiple paths for the query.