Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
DataContext Class
 DeferredLoadingEnabled Property
.NET Framework Class Library
DataContext..::.DeferredLoadingEnabled Property

Updated: November 2007

Specifies whether to delay-load one-to-many or one-to-one relationships.

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

Visual Basic (Declaration)
Public Property DeferredLoadingEnabled As Boolean
Visual Basic (Usage)
Dim instance As DataContext
Dim value As Boolean

value = instance.DeferredLoadingEnabled

instance.DeferredLoadingEnabled = value
C#
public bool DeferredLoadingEnabled { get; set; }
Visual C++
public:
property bool DeferredLoadingEnabled {
    bool get ();
    void set (bool value);
}
J#
/** @property */
public boolean get_DeferredLoadingEnabled()
/** @property */
public  void set_DeferredLoadingEnabled(boolean value)
JScript
public function get DeferredLoadingEnabled () : boolean
public function set DeferredLoadingEnabled (value : boolean)

Property Value

Type: System..::.Boolean

true if deferred loading is enabled; otherwise false.

When the code accesses one of these relationships, null is returned if the relationship is one-to-one, and an empty collection is returned if it is one-to-many. The relationships can still be filled by setting the LoadOptions property.

The main scenario for this property is to enable you to extract a piece of the object model and send it out (for example, to a Web service).

Note:

If this property is set to false after a query has been executed, an exception is thrown. See the Valid Modes section below for more information.

Valid modes

Deferred loading requires object tracking. Only the following three modes are valid:

  • ObjectTrackingEnabled = false. DeferredLoadingEnabled is ignored and inferred to be false. This behavior corresponds to a read-only DataContext.

  • ObjectTrackingEnabled = true. DeferredLoadingEnabled = false. This situation corresponds to a DataContext that allows users to load an object graph by using LoadWith directives, but it does not enable deferred loading.

  • Both are set to true. This is the default.

The flags may not be changed after a query has been executed. Any change after the execution of the first query that uses that DataContext throws an exception.

Windows Vista, Windows XP SP2, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker