Bulk Operations With Dapper

Dapper does not provide a formal API for performing bulk inserts or other bulk operations. However, those operations are possible using a third-party library called Dapper Plus.

Dapper Plus library is a comprehensive .NET library that provides a unified API for working with different databases, such as SQL Server, MySQL, MariaDB, SQLite, Oracle, PostgreSQL, etc.

  • It offers features like bulk operations, object mapping, and much more.
  • The library allows you to write less code and get more performance out of your database operations.
  • It is easy to configure, which helps make development faster and simpler.
  • Dapper Plus library also supports asynchronous programming, allowing developers to use the await/async keywords for asynchronous data writing.
🚀 Update Thousands of Records Faster

Updating entities one by one is slow. BulkUpdate lets you update thousands of records efficiently with a single bulk operation.

Explore BulkUpdate →

Dapper Plus - Methods

Method Description
BulkInsert Execute a Bulk Operation for inserting thousands of entities.
BulkUpdate Execute a Bulk Operation for updating thousands of entities.
BulkDelete Execute a Bulk Operation for deleting thousands of entities.
BulkMerge UPSERT operations. Execute a Bulk Operation for merging thousands of entities (Update existing data and insert non-existing).

Dapper Plus - Getting Started

To use Dapper Plus in your application, you need to install the NuGet Package

This library is not free but is the fastest way to save your data. In addition, you save development time (so money) as you don't have to write any SQL statements and unit tests for those bulk operations.

Like Dapper, Dapper Plus extends your IDbConnection interface but with high-performance bulk operations:

language-csharp
|
// @nuget: Z.Dapper.Plus
using Z.Dapper.Plus;

connection.BulkInsert(customers);
connection.BulkUpdate(customers);
connection.BulkDelete(customers);
connection.BulkMerge(customers);

You can find more information on their Getting Started

Dapper Plus - Performance

Dapper Plus significantly outperforms traditional methods for inserting multiple rows in Dapper, providing a remarkable boost in efficiency:

In addition to its speed, Dapper Plus offers an extensive array of customization options for your bulk operations, allowing you to tailor data saving processes to your specific needs.


Date Modified: 2025-08-19
Author:

Edit this page in GitHub

Got any Dapper Question?