Share via


DataLoadOptions.LoadWith<T> Method (Expression<Func<T, Object>>)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Specifies which sub-objects to retrieve when a query is submitted for an object of type T.

Namespace:  System.Data.Linq
Assembly:  System.Data.Linq (in System.Data.Linq.dll)

Syntax

'Declaration
Public Sub LoadWith(Of T) ( _
    expression As Expression(Of Func(Of T, Object)) _
)
public void LoadWith<T>(
    Expression<Func<T, Object>> expression
)

Type Parameters

  • T
    Type that is queried against.

    If this type is unmapped, an exception is thrown.

Parameters

  • expression
    Type: System.Linq.Expressions.Expression<Func<T, Object>>
    Identifies the field or property to be retrieved.
    If the expression does not identify a field or property that represents a one-to-one or one-to-many relationship, an exception is thrown.

Remarks

You cannot specify the loading of two levels of relationships (for example, Orders.OrderDetails). In these scenarios you must specify two separate LoadWith methods.

To avoid cycling, see Remarks section in DataLoadOptions.

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.