BstBulk 10.1.0

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

.NET 10.0

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