Click or drag to resize

LinqExtensionsPreloadTSource Method (IEnumerableTSource)

Preloads the full object state for all objects in source.

Namespace:  Aloe.SystemFrameworks.Domain.LINQ
Assembly:  Aloe.SystemFrameworks.Domain (in Aloe.SystemFrameworks.Domain.dll) Version: 20.1.3.5
Syntax
public static IEnumerable<TSource> Preload<TSource>(
	this IEnumerable<TSource> source
)
where TSource : ILazyObject

Parameters

source
Type: System.Collections.GenericIEnumerableTSource
The source objects.

Type Parameters

TSource
The type of the source.

Return Value

Type: IEnumerableTSource
The same source objects enumeration.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
Preload will execute a single command, retrieving all objects in the source enumeration. For example:
//This will fully load all invoice objects in the invoices enumerable.
//It is meaningfull only if the invoice objects are Id-initialized 
//and has not yet loaded full object state.
invoices.Preload(); 

//this will preload all customers of all invoices
//however, it is suggested to use Preload(expression) instead. 
//For Preload(exprssion) see the See also section.
invoices.Select(i=>i.Customer).Preload();
See Also