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.
Inherited Members
Namespace: ETLBox.EntityFramework
Assembly: ETLBox.EntityFramework.dll
Syntax
public static class DbContextExtensionsMethods
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
| Type | Name | Description |
|---|---|---|
| DbContext | dbContext | The Entity Framework Core context. |
| IEnumerable<T> | entities | The entities to be deleted. |
Type Parameters
| Name | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| DbContext | dbContext | 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
| Name | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| DbContext | dbContext | The Entity Framework Core context. |
| IEnumerable<T> | entities | The entities to be inserted. |
Type Parameters
| Name | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| DbContext | dbContext | 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
| Name | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| DbContext | dbContext | The Entity Framework Core context. |
| IEnumerable<T> | entities | The entities to be merged. |
Type Parameters
| Name | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| DbContext | dbContext | 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
| Name | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| DbContext | dbContext | The Entity Framework Core context. |
| IEnumerable<T> | entities | The entities to be updated. |
Type Parameters
| Name | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| DbContext | dbContext | 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
| Name | Description |
|---|---|
| T | The entity type used for the bulk operation. |