Bulk operations for the connection you already use

Dapper for reads. Bulk for writes.

Like Dapper, we extend your IDbConnection. Keep querying with Dapper. Write thousands of rows with one extra method — much faster than a loop.

Dapper is excellent at reading data. It is not a bulk writer. The usual workaround — a loop of INSERT / UPDATE / DELETE — costs one round-trip per row and gets slow as soon as the set grows. ETLBox.DbExtensions adds BulkInsert, BulkUpdate, BulkDelete, and BulkMerge to the same connection. One extra using. No new client. If the class you already use is SqlBulkCopy, see Beyond SqlBulkCopy.

Still writing this?

foreach (var customer in customers)
    connection.Execute(
        "INSERT INTO Customer (Id, Name, City) VALUES (@Id, @Name, @City)",
        customer);

One call instead — and much faster

connection.BulkInsert(customers);

The second snippet is not just shorter. On SQL Server, 5,000 inserts took 8 seconds with the loop and 70 ms with BulkInsert() — about 110× faster. Update, delete, and merge follow the same pattern.

Dapper loop vs SqlBulkCopy vs DbExtensions

DbExtensions does not replace Dapper, and it does not pretend SqlBulkCopy is slow. It covers the write operations Dapper never added — on more than SQL Server.

DbExtensions

One line, many databases

  • Same IDbConnection as Dapper
  • Insert, update, delete, merge
  • Your POCOs — no DataTable
  • SQL Server, Postgres, MySQL, Oracle, SQLite, …
  • Same bulk engine as ETLBox data flows
Dapper loop

One round-trip per row

  • Great for queries, not for bulk writes
  • foreach + Execute does not scale
  • Merge becomes select-then-insert-or-update
  • SqlBulkCopy is insert-only, SQL Server only
  • A second client is more than you asked for

SQL Server, 5,000 rows

Measured with the open benchmark in etlbox.demo. Read the table as order of magnitude, not a guarantee.

Dapper loopSqlBulkCopyDbExtensions
Insert
7.9 s — one round-trip per row
20 ms — SQL Server only
70 ms — POCOs, many databases
Update / delete
Same loop, ~7.5 s
Not included
BulkUpdate / BulkDelete
Upsert / sync
Select + insert or update, 11.6 s
Not included
BulkMerge — 0.28 s
API
SQL you already write, row by row
DataTable + column maps
Your POCOs on IDbConnection

Method, script, and caveats: how we measured this.

Insert, update, delete, merge

Same connection as Dapper. One method each — not a new client.

Try DbExtensions

Keep Dapper. Add bulk writes.

The product site has the docs, the trial, and pricing. NuGet without a key is limited to 5,000 rows. A trial key removes the limit for 45 days.

Get started Get a free trial key See pricing