DEV Community

Ricardo G. Pignone
Ricardo G. Pignone

Posted on

๐Ÿš€ Simplifying Bulk Operations with Dapper in .NET

If youโ€™ve worked with Dapper, you already know how fast and lightweight it is for everyday database operations.

But when it comes to bulk operations โ€” like inserting, updating, or deleting large volumes of data โ€” things can quickly get messy.

Thatโ€™s exactly the problem that led me to create:

๐Ÿ‘‰ Pignone.Dapper.BulkExtensions
Available on NuGet: https://www.nuget.org/packages/Pignone.Dapper.BulkExtensions


๐Ÿ’ก The Problem

Dapper is great, but it doesnโ€™t provide native support for bulk operations.

This usually leads to:

  • Loops executing multiple queries (poor performance)
  • Repetitive boilerplate code
  • Harder maintenance over time

โœ… The Solution

Pignone.Dapper.BulkExtensions provides a simple and efficient way to handle bulk operations while keeping Dapperโ€™s philosophy:

โœ” Lightweight
โœ” High performance
โœ” Easy to use
โœ” No unnecessary complexity


โš™๏ธ Installation

dotnet add package Pignone.Dapper.BulkExtensions
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”ฅ Example Usage

using (var connection = new SqlConnection(connectionString))
{
    var items = new List<Product>
    {
        new Product { Name = "Product 1", Price = 10 },
        new Product { Name = "Product 2", Price = 20 }
    };

    await connection.BulkInsertAsync(items);
}
Enter fullscreen mode Exit fullscreen mode

Yes, itโ€™s that simple ๐Ÿš€


๐ŸŽฏ When should you use it?

This package is a great fit when you need to:

  • Insert large volumes of data
  • Improve batch processing performance
  • Reduce database round trips
  • Keep your Dapper code clean and maintainable

๐Ÿ“ˆ Project Goals

The goal is to continuously evolve this package to support more bulk operation scenarios in the .NET ecosystem, always focusing on:

  • Simplicity
  • Performance
  • Low coupling

๐Ÿค Contributions

Feedback, suggestions, and contributions are very welcome!

If youโ€™ve faced challenges with bulk operations using Dapper, Iโ€™d love to hear your experience ๐Ÿ‘‡


โญ Support the project

If this package helps you:

  • Give it a โญ on the repository
  • Share it with other developers
  • Suggest improvements

๐Ÿ“Œ Final Thoughts

If youโ€™re using Dapper and need high-performance bulk operations, give Pignone.Dapper.BulkExtensions a try.

Less code. More performance. ๐Ÿ’ฅ

Top comments (0)