Share via


ProxiesExtensions.CreateProxy Method

Definition

Overloads

CreateProxy(DbContext, Type, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

CreateProxy<TEntity>(DbContext, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

CreateProxy<TEntity>(DbSet<TEntity>, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

CreateProxy<TEntity>(DbContext, Action<TEntity>, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

CreateProxy<TEntity>(DbSet<TEntity>, Action<TEntity>, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

CreateProxy(DbContext, Type, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

public static object CreateProxy (this Microsoft.EntityFrameworkCore.DbContext context, Type entityType, params object[] constructorArguments);
static member CreateProxy : Microsoft.EntityFrameworkCore.DbContext * Type * obj[] -> obj
<Extension()>
Public Function CreateProxy (context As DbContext, entityType As Type, ParamArray constructorArguments As Object()) As Object

Parameters

context
DbContext

The DbContext.

entityType
Type

The entity type for which a proxy is needed.

constructorArguments
Object[]

Arguments to pass to the entity type constructor.

Returns

The proxy instance.

Applies to

CreateProxy<TEntity>(DbContext, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbContext context, params object[] constructorArguments);
static member CreateProxy : Microsoft.EntityFrameworkCore.DbContext * obj[] -> 'Entity
<Extension()>
Public Function CreateProxy(Of TEntity) (context As DbContext, ParamArray constructorArguments As Object()) As TEntity

Type Parameters

TEntity

The entity type for which a proxy is needed.

Parameters

context
DbContext

The DbContext.

constructorArguments
Object[]

Arguments to pass to the entity type constructor.

Returns

TEntity

The proxy instance.

Applies to

CreateProxy<TEntity>(DbSet<TEntity>, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbSet<TEntity> set, params object[] constructorArguments) where TEntity : class;
static member CreateProxy : Microsoft.EntityFrameworkCore.DbSet<'Entity (requires 'Entity : null)> * obj[] -> 'Entity (requires 'Entity : null)
<Extension()>
Public Function CreateProxy(Of TEntity As Class) (set As DbSet(Of TEntity), ParamArray constructorArguments As Object()) As TEntity

Type Parameters

TEntity

The entity type for which a proxy is needed.

Parameters

constructorArguments
Object[]

Arguments to pass to the entity type constructor.

Returns

TEntity

The proxy instance.

Applies to

CreateProxy<TEntity>(DbContext, Action<TEntity>, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbContext context, Action<TEntity> configureEntity, params object[] constructorArguments);
public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbContext context, Action<TEntity>? configureEntity, params object[] constructorArguments);
static member CreateProxy : Microsoft.EntityFrameworkCore.DbContext * Action<'Entity> * obj[] -> 'Entity
<Extension()>
Public Function CreateProxy(Of TEntity) (context As DbContext, configureEntity As Action(Of TEntity), ParamArray constructorArguments As Object()) As TEntity

Type Parameters

TEntity

The entity type for which a proxy is needed.

Parameters

context
DbContext

The DbContext.

configureEntity
Action<TEntity>

Called after the entity is created to set property values, etc.

constructorArguments
Object[]

Arguments to pass to the entity type constructor.

Returns

TEntity

The proxy instance.

Applies to

CreateProxy<TEntity>(DbSet<TEntity>, Action<TEntity>, Object[])

Creates a proxy instance for an entity type if proxy creation has been turned on.

public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbSet<TEntity> set, Action<TEntity> configureEntity, params object[] constructorArguments) where TEntity : class;
public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbSet<TEntity> set, Action<TEntity>? configureEntity, params object[] constructorArguments) where TEntity : class;
static member CreateProxy : Microsoft.EntityFrameworkCore.DbSet<'Entity (requires 'Entity : null)> * Action<'Entity (requires 'Entity : null)> * obj[] -> 'Entity (requires 'Entity : null)
<Extension()>
Public Function CreateProxy(Of TEntity As Class) (set As DbSet(Of TEntity), configureEntity As Action(Of TEntity), ParamArray constructorArguments As Object()) As TEntity

Type Parameters

TEntity

The entity type for which a proxy is needed.

Parameters

configureEntity
Action<TEntity>

Called after the entity is created to set property values, etc.

constructorArguments
Object[]

Arguments to pass to the entity type constructor.

Returns

TEntity

The proxy instance.

Applies to