Class DbContextExtensions

Extension methods that add bulk insert, update, delete, and merge operations to Entity Framework Core DbContext. Table name, column mapping, and identity columns are derived from the EF model.

Inheritance
DbContextExtensions
Namespace: ETLBox.EntityFramework
Assembly: ETLBox.EntityFramework.dll
Syntax
    public static class DbContextExtensions

Methods

BulkDelete<T>(DbContext, IEnumerable<T>)

Performs a bulk delete of the given entities using the current DbContext connection.

Declaration
    public static void BulkDelete<T>(this DbContext dbContext, IEnumerable<T> entities)
Parameters
TypeNameDescription
DbContextdbContext

The Entity Framework Core context.

IEnumerable<T>entities

The entities to be deleted.

Type Parameters
NameDescription
T

The entity type used for the bulk operation.

BulkDelete<T>(DbContext, IEnumerable<T>, Action<BulkOptions<T>>)

Performs a bulk delete of the given entities using the current DbContext connection.

Declaration
    public static void BulkDelete<T>(this DbContext dbContext, IEnumerable<T> entities, Action<BulkOptions<T>> options)
Parameters
TypeNameDescription
DbContextdbContext

The Entity Framework Core context.

IEnumerable<T>entities

The entities to be deleted.

Action<BulkOptions<T>>options

The configurable options for the bulk delete operation.

Type Parameters
NameDescription
T

The entity type used for the bulk operation.

BulkInsert<T>(DbContext, IEnumerable<T>)

Performs a bulk insert of the given entities using the current DbContext connection.

Declaration
    public static void BulkInsert<T>(this DbContext dbContext, IEnumerable<T> entities)
Parameters
TypeNameDescription
DbContextdbContext

The Entity Framework Core context.

IEnumerable<T>entities

The entities to be inserted.

Type Parameters
NameDescription
T

The entity type used for the bulk operation.

BulkInsert<T>(DbContext, IEnumerable<T>, Action<BulkOptions<T>>)

Performs a bulk insert of the given entities using the current DbContext connection.

Declaration
    public static void BulkInsert<T>(this DbContext dbContext, IEnumerable<T> entities, Action<BulkOptions<T>> options)
Parameters
TypeNameDescription
DbContextdbContext

The Entity Framework Core context.

IEnumerable<T>entities

The entities to be inserted.

Action<BulkOptions<T>>options

The configurable options for the bulk insert operation.

Type Parameters
NameDescription
T

The entity type used for the bulk operation.

BulkMerge<T>(DbContext, IEnumerable<T>)

Performs a bulk merge of the given entities using the current DbContext connection. The merge combines insert, update, and optionally delete operations.

Declaration
    public static void BulkMerge<T>(this DbContext dbContext, IEnumerable<T> entities)
Parameters
TypeNameDescription
DbContextdbContext

The Entity Framework Core context.

IEnumerable<T>entities

The entities to be merged.

Type Parameters
NameDescription
T

The entity type used for the bulk operation.

BulkMerge<T>(DbContext, IEnumerable<T>, Action<MergeBulkOptions<T>>)

Performs a bulk merge of the given entities using the current DbContext connection. The merge combines insert, update, and optionally delete operations.

Declaration
    public static void BulkMerge<T>(this DbContext dbContext, IEnumerable<T> entities, Action<MergeBulkOptions<T>> options)
Parameters
TypeNameDescription
DbContextdbContext

The Entity Framework Core context.

IEnumerable<T>entities

The entities to be merged.

Action<MergeBulkOptions<T>>options

The configurable options for the bulk merge operation.

Type Parameters
NameDescription
T

The entity type used for the bulk operation.

BulkUpdate<T>(DbContext, IEnumerable<T>)

Performs a bulk update of the given entities using the current DbContext connection.

Declaration
    public static void BulkUpdate<T>(this DbContext dbContext, IEnumerable<T> entities)
Parameters
TypeNameDescription
DbContextdbContext

The Entity Framework Core context.

IEnumerable<T>entities

The entities to be updated.

Type Parameters
NameDescription
T

The entity type used for the bulk operation.

BulkUpdate<T>(DbContext, IEnumerable<T>, Action<BulkOptions<T>>)

Performs a bulk update of the given entities using the current DbContext connection.

Declaration
    public static void BulkUpdate<T>(this DbContext dbContext, IEnumerable<T> entities, Action<BulkOptions<T>> options)
Parameters
TypeNameDescription
DbContextdbContext

The Entity Framework Core context.

IEnumerable<T>entities

The entities to be updated.

Action<BulkOptions<T>>options

The configurable options for the bulk update operation.

Type Parameters
NameDescription
T

The entity type used for the bulk operation.