Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 4
System.Data.Objects
 LazyLoadingEnabled Property
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2010/.NET Framework 4

Other versions are also available for the following:
.NET Framework Class Library
ObjectContextOptions..::.LazyLoadingEnabled Property

Gets or sets a Boolean value that determines whether related objects are loaded automatically when a navigation property is accessed.

Namespace:  System.Data.Objects
Assembly:  System.Data.Entity (in System.Data.Entity.dll)
Visual Basic
Public Property LazyLoadingEnabled As Boolean
    Get
    Set
C#
public bool LazyLoadingEnabled { get; set; }
Visual C++
public:
property bool LazyLoadingEnabled {
    bool get ();
    void set (bool value);
}
F#
member LazyLoadingEnabled : bool with get, set

Property Value

Type: System..::.Boolean
A Boolean value that is true when lazy loading is enabled; otherwise false.

The LazyLoadingEnabled()()() property is used to set the lazy loading behavior of related objects. The default value of LazyLoadingEnabled()()() is false. However, if you use the Entity Framework tools to create a new model and the corresponding generated classes, LazyLoadingEnabled is set to true in the object context's constructor by default. When using this kind of loading, realize that each navigation property that you access causes a separate query to be executed against the data source if the object is not already in the ObjectContext. For more information, see Load Related Objects (Entity Framework).

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
API vs. Model Designer      Mark Blomsma   |   Edit   |   Show History
Note that the default value when using DbContext is 'false', but if you're using the Entity Framework designer with code generation turned on, then the code generator emits a line of code to default the value to 'true'. You can change this value by opening the designer and looking at the model properties.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker