BstBulk 10.1.3

BstBulk

Helpers for opting properties into bulk insert/update operations (works with EFCore.BulkExtensions).

This is the provider-agnostic core package — it does not reference a database provider. To run the actual bulk call, install the provider package for your database instead of (or alongside) this one:

  • BstBulk.SqlServer — SQL Server
  • BstBulk.PostgreSql — PostgreSQL

Migration note: Up to version 10.0.x, BstBulk transitively pulled in the SQL Server bulk provider, so BulkInsertOrUpdateAsync worked out of the box. From 10.1.0 it no longer does — SQL Server consumers should switch their package reference from BstBulk to BstBulk.SqlServer.

Usage

1. Mark properties with [Bulk(insert, update)]

using BstBulk.DataAnnotations;

public class Product {
    public int Id { get; set; }

    [Bulk(insert: true, update: true)]
    public string Name { get; set; }

    [Bulk(insert: true, update: false)]
    public DateTimeOffset CreatedAt { get; set; }

    // Owned types in the same table also work — annotate the navigation
    [Bulk(insert: true, update: true)]
    public Address ShippingAddress { get; set; }
}

Properties without [Bulk] are ignored.

2. Build the property lists from the DbContext

using BstBulk.Enums;
using BstBulk.Extensions;

var propertiesToInsert = dbContext.GetBulkProperties<Product>(BulkType.Insert);
var propertiesToUpdate = dbContext.GetBulkProperties<Product>(BulkType.Update);

GetBulkProperties walks the EF model, picks scalar properties whose [Bulk] flag for the requested operation is true, and adds owned-entity columns when the navigation is itself flagged. Owned types nested inside a flagged owned navigation are included automatically — the nested navigations do not need their own [Bulk] annotation.

3. Pass them to the bulk call

With a provider package installed (BstBulk.SqlServer / BstBulk.PostgreSql), let the helpers build the BulkConfig and run the operation for you:

using BstBulk.SqlServer.Extensions; // or BstBulk.PostgreSql.Extensions

await dbContext.BstBulkInsertOrUpdate(products);

The core also exposes GetBulkConfig<T>() if you prefer to build the config and call EFCore.BulkExtensions yourself:

using BstBulk.Extensions;

var config = dbContext.GetBulkConfig<Product>();
config.UpdateByProperties = [nameof(Product.Id)];
await dbContext.BulkInsertOrUpdateAsync(products, config);

GetBulkConfig<T> is equivalent to building a BulkConfig with PropertiesToInclude = GetBulkProperties<T>(BulkType.Insert) and PropertiesToIncludeOnUpdate = GetBulkProperties<T>(BulkType.Update).

BulkType values: BulkType.Insert, BulkType.Update.

Showing the top 20 packages that depend on BstBulk.

Packages Downloads
BstBulk.PostgreSql
Biblioteca para operações bulk no PostgreSQL (EF Core)
0
BstBulk.PostgreSql
Biblioteca para operações bulk no PostgreSQL (EF Core)
1
BstBulk.PostgreSql
Biblioteca para operações bulk no PostgreSQL (EF Core)
8
BstBulk.PostgreSql
Biblioteca para operações bulk no PostgreSQL (EF Core)
11
BstBulk.PostgreSql
Biblioteca para operações bulk no PostgreSQL (EF Core)
45
BstBulk.SqlServer
Biblioteca para operações bulk no SQL Server (EF Core)
0
BstBulk.SqlServer
Biblioteca para operações bulk no SQL Server (EF Core)
1
BstBulk.SqlServer
Biblioteca para operações bulk no SQL Server (EF Core)
8
BstBulk.SqlServer
Biblioteca para operações bulk no SQL Server (EF Core)
12

.NET 10.0

Version Downloads Last updated
10.1.4 2 20/10/2026
10.1.3 1 20/10/2026
10.1.2 8 22/09/2026
10.1.1 16 18/07/2026
10.1.0 48 14/07/2026
10.0.20 22 14/06/2026
10.0.19 29 08/06/2026
10.0.18 18 05/06/2026
10.0.17 19 05/06/2026
10.0.16 19 05/06/2026
10.0.15 17 17/05/2026
10.0.14 21 03/05/2026
10.0.13 30 23/04/2026
10.0.12 24 16/04/2026
10.0.11 25 20/03/2026
10.0.10 28 20/03/2026
10.0.9 28 20/03/2026
10.0.8 26 20/03/2026
10.0.7 28 11/03/2026
10.0.6 23 07/03/2026
10.0.5 29 10/02/2026
10.0.4 26 28/01/2026
10.0.3 28 28/01/2026
10.0.2 26 12/12/2025
10.0.1 30 11/11/2025
9.1.5 34 10/11/2025
9.1.4 26 06/11/2025
9.1.3 28 31/10/2025
9.1.2 26 20/10/2025
9.1.1 25 20/10/2025
9.1.0 28 15/10/2025
9.0.9 27 24/09/2025
9.0.8 32 06/09/2025
9.0.7 32 26/07/2025
9.0.6 38 15/07/2025
9.0.5 33 12/06/2025
9.0.4 38 19/05/2025
9.0.3 33 14/05/2025
9.0.2 36 09/04/2025
9.0.1 37 24/03/2025