ProxiesExtensions.UseLazyLoadingProxies Method

Definition

Overloads

UseLazyLoadingProxies(DbContextOptionsBuilder, Action<LazyLoadingProxiesOptionsBuilder>)

Turns on the creation of lazy loading proxies.

UseLazyLoadingProxies(DbContextOptionsBuilder, Boolean)

Turns on the creation of lazy loading proxies.

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

Turns on the creation of lazy loading proxies.

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

Turns on the creation of lazy loading proxies.

UseLazyLoadingProxies(DbContextOptionsBuilder, Action<LazyLoadingProxiesOptionsBuilder>)

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)

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>)

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)

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