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

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

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

C#
public static object CreateProxy (this Microsoft.EntityFrameworkCore.DbContext context, Type entityType, params object[] constructorArguments);

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

CreateProxy<TEntity>(DbContext, Object[])

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

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

C#
public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbContext context, params object[] constructorArguments);

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

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

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

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

C#
public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbSet<TEntity> set, params object[] constructorArguments) where TEntity : class;

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

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

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

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

C#
public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbContext context, Action<TEntity> configureEntity, params object[] constructorArguments);
C#
public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbContext context, Action<TEntity>? configureEntity, params object[] constructorArguments);

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 5.0, 6.0, 7.0, 8.0, 9.0

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

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

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

C#
public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbSet<TEntity> set, Action<TEntity> configureEntity, params object[] constructorArguments) where TEntity : class;
C#
public static TEntity CreateProxy<TEntity> (this Microsoft.EntityFrameworkCore.DbSet<TEntity> set, Action<TEntity>? configureEntity, params object[] constructorArguments) where TEntity : class;

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 5.0, 6.0, 7.0, 8.0, 9.0