BstBulk 10.1.1

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)
7
BstBulk.PostgreSql
Biblioteca para operações bulk no PostgreSQL (EF Core)
28
BstBulk.SqlServer
Biblioteca para operações bulk no SQL Server (EF Core)
7
BstBulk.SqlServer
Biblioteca para operações bulk no SQL Server (EF Core)
8

.NET 10.0

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