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)