Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ProxiesExtensions.UseLazyLoadingProxies Method

Definition

Namespace:
Microsoft.EntityFrameworkCore
Assembly:
Microsoft.EntityFrameworkCore.Proxies.dll
Package:
Microsoft.EntityFrameworkCore.Proxies v10.0.0
Package:
Microsoft.EntityFrameworkCore.Proxies v8.0.0
Package:
Microsoft.EntityFrameworkCore.Proxies v9.0.0
Package:
Microsoft.EntityFrameworkCore.Proxies v2.1.11
Package:
Microsoft.EntityFrameworkCore.Proxies v2.2.6
Package:
Microsoft.EntityFrameworkCore.Proxies v3.0.0
Package:
Microsoft.EntityFrameworkCore.Proxies v3.1.0
Package:
Microsoft.EntityFrameworkCore.Proxies v5.0.0
Package:
Microsoft.EntityFrameworkCore.Proxies v6.0.0
Package:
Microsoft.EntityFrameworkCore.Proxies v7.0.0

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

UseLazyLoadingProxies(DbContextOptionsBuilder, Action<LazyLoadingProxiesOptionsBuilder>)

Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs

Turns on the creation of lazy loading proxies.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseLazyLoadingProxies(this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, Action<Microsoft.EntityFrameworkCore.LazyLoadingProxiesOptionsBuilder> lazyLoadingProxiesOptionsAction);
static member UseLazyLoadingProxies : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * Action<Microsoft.EntityFrameworkCore.LazyLoadingProxiesOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseLazyLoadingProxies (optionsBuilder As DbContextOptionsBuilder, lazyLoadingProxiesOptionsAction As Action(Of LazyLoadingProxiesOptionsBuilder)) As DbContextOptionsBuilder

Parameters

optionsBuilder
DbContextOptionsBuilder

The options builder, as passed to OnConfiguring(DbContextOptionsBuilder) or exposed AddDbContext.

lazyLoadingProxiesOptionsAction
Action<LazyLoadingProxiesOptionsBuilder>

An optional action to allow additional proxy-specific configuration.

Returns

The same builder to allow method calls to be chained.

Remarks

Note that this requires appropriate services to be available in the EF internal service provider. Normally this will happen automatically, but if the application is controlling the service provider, then a call to AddEntityFrameworkProxies(IServiceCollection) may be needed.

See Lazy loading for more information and examples.

Applies to

UseLazyLoadingProxies(DbContextOptionsBuilder, Boolean)

Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs

Turns on the creation of lazy loading proxies.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseLazyLoadingProxies(this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, bool useLazyLoadingProxies = true);
static member UseLazyLoadingProxies : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * bool -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseLazyLoadingProxies (optionsBuilder As DbContextOptionsBuilder, Optional useLazyLoadingProxies As Boolean = true) As DbContextOptionsBuilder

Parameters

optionsBuilder
DbContextOptionsBuilder

The options builder, as passed to OnConfiguring(DbContextOptionsBuilder) or exposed AddDbContext.

useLazyLoadingProxies
Boolean

true to use lazy loading proxies; false to prevent their use.

Returns

The same builder to allow method calls to be chained.

Remarks

Note that this requires appropriate services to be available in the EF internal service provider. Normally this will happen automatically, but if the application is controlling the service provider, then a call to AddEntityFrameworkProxies(IServiceCollection) may be needed.

See Lazy loading for more information and examples.

Applies to

UseLazyLoadingProxies<TContext>(DbContextOptionsBuilder<TContext>, Action<LazyLoadingProxiesOptionsBuilder>)

Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs

Turns on the creation of lazy loading proxies.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseLazyLoadingProxies<TContext>(this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, Action<Microsoft.EntityFrameworkCore.LazyLoadingProxiesOptionsBuilder> lazyLoadingProxiesOptionsAction) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseLazyLoadingProxies : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * Action<Microsoft.EntityFrameworkCore.LazyLoadingProxiesOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseLazyLoadingProxies(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), lazyLoadingProxiesOptionsAction As Action(Of LazyLoadingProxiesOptionsBuilder)) As DbContextOptionsBuilder(Of TContext)

Type Parameters

TContext

The DbContext type.

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The options builder, as passed to OnConfiguring(DbContextOptionsBuilder) or exposed AddDbContext.

lazyLoadingProxiesOptionsAction
Action<LazyLoadingProxiesOptionsBuilder>

An optional action to allow additional proxy-specific configuration.

Returns

The same builder to allow method calls to be chained.

Remarks

Note that this requires appropriate services to be available in the EF internal service provider. Normally this will happen automatically, but if the application is controlling the service provider, then a call to AddEntityFrameworkProxies(IServiceCollection) may be needed.

See Lazy loading for more information and examples.

Applies to

UseLazyLoadingProxies<TContext>(DbContextOptionsBuilder<TContext>, Boolean)

Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs
Source:
ProxiesExtensions.cs

Turns on the creation of lazy loading proxies.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseLazyLoadingProxies<TContext>(this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, bool useLazyLoadingProxies = true) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseLazyLoadingProxies : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * bool -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseLazyLoadingProxies(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), Optional useLazyLoadingProxies As Boolean = true) As DbContextOptionsBuilder(Of TContext)

Type Parameters

TContext

The DbContext type.

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The options builder, as passed to OnConfiguring(DbContextOptionsBuilder) or exposed AddDbContext.

useLazyLoadingProxies
Boolean

true to use lazy loading proxies; false to prevent their use.

Returns

The same builder to allow method calls to be chained.

Remarks

Note that this requires appropriate services to be available in the EF internal service provider. Normally this will happen automatically, but if the application is controlling the service provider, then a call to AddEntityFrameworkProxies(IServiceCollection) may be needed.

See Lazy loading for more information and examples.

Applies to


Feedback

Was this page helpful?