C# Bulk Operations BulkInsert, BulkDelete, BulkUpdate, BulkMerge, and more!


Downloaded more than
0
times !
// Easy to use
var bulk = new BulkOperation(connection);
bulk.BulkInsert(dt);
bulk.BulkUpdate(dt);
bulk.BulkDelete(dt);
bulk.BulkMerge(dt);

// Easy to customize
var bulk = new BulkOperation<Customer>(connection);
bulk.BatchSize = 1000;
bulk.ColumnInputExpression = c => new { c.Name,  c.FirstName };
bulk.ColumnOutputExpression = c => c.CustomerID;
bulk.ColumnPrimaryKeyExpression = c => c.Code;
bulk.BulkMerge(customers);

What&#39;s Bulk Operations?

What's Bulk Operations?

Overcome SqlBulkCopy limitations by adding high-performance bulk operations: BulkInsert, BulkUpdate, BulkDelete, BulkMerge, and more.

Do you offer a free trial?

Do you offer a free trial?

We offer monthly trial, you can download a new trial every month.

Where can I find online examples?

Where can I find online examples?

Online examples are now available!

Online Examples

Our achievements


customers 5,000+ Customers
countries 75+ Countries
requests 10,000+ Requests closed
downloads 250,000,000+downloads

What ZZZ Projects achieved over the last decade has grown beyond our hopes. We help developers worldwide with free and paid solutions (because nobody works for free, nor our developers!). Every day, we are committed to listening to our clients to help ease the daily dev workload as much as possible.


Output Identity Value

Overcome SqlBulkCopy limitations and use flexible features to output inserted identity and concurrency column values.

Bulk Operations - Output Identity Example
var bulk = new BulkOperation(connection)

// Output newly inserted identity value after an insert
bulk.ColumnMappings.Add("CustomerID", ColumnMappingDirectionType.Output);

bulk.BulkInsert(dt);

Try it

Insert, Update, Delete, Merge and more...

Bulk Operations is not only about inserting, get more capability over SqlBulkCopy.

  • BulkInsert
  • BulkUpdate
  • BulkDelete
  • BulkMerge (Upsert)
  • BulkSaveChanges
  • BulkSynchronize
Bulk Operations - Methods Example
// Support all type of operations
var bulk = new BulkOperation(connection);
bulk.BulkInsert(dt);
bulk.BulkUpdate(dt);
bulk.BulkDelete(dt);
bulk.BulkMerge(dt);
bulk.BulkSaveChanges(ds);
bulk.BulkSynchronize(dt);

Generic List<> as DataSource

Improve code maintainability by using strongly-typed lambda expression over hard coded string.

  • Use Bulk Operations with Generic List<>
  • Use Bulk Operations with Expando Object
  • Use Lambda Expression for mapping
Bulk Operations - Entity Example
var bulk= new BulkOperation<Customer>(connection);
bulk.DestinationTableName = "Customer";

// Column Columns to Input
bulk.ColumnInputExpression = c => new { c.Code, c.Name };

// Choose Columns to Output
bulk.ColumnOutputExpression = c => c.CustomerID;

// Choose Key to Use
bulk.ColumnPrimaryKeyExpression = c => c.Code;

bulk.BulkMerge(customers);

Bulk Operations from LINQ Query

Perform bulk operations from LINQ Query without loading entities in memory.

  • DeleteFromQuery
  • UpdateFromQuery
Bulk Operations - Batch Delete & Update Example
var bulk = new BulkOperation<Customer>(connection);

// DELETE all customers inactive for more than 2 years
bulk.DeleteFromQuery(
    c => c.Where(x => x.LastLogin < DateTime.Now.AddYears(-2)));

// UPDATE all customers inactive for more than 2 years
bulk.UpdateFromQuery(
    c => c.Where(x => x.Active && x.LastLogin < DateTime.Now.AddYears(-2)),
    c => new Customer {Active = false});

AutoMap with Case Insensitive

Sick of not being able to map column because of case sensitivity issue? Use flexible features to customize configuration

  • Auditing
  • Batch Size
  • Case Sensitivity
  • Logging
Bulk Operations - Case Insensitive Example
var bulk = new BulkOperation(connection);
bulk.CaseSensitive = CaseSensitiveType.Insensitive;
bulk.ColumnMappings.Add("cOdE", "Code");
bulk.BulkMerge(dt);