Dapper does not provide a formal API for performing bulk inserts or any other bulk operations. However, this kind of operation is possible by using a third-party library called Dapper Plus.
Dapper Plus - Methods
|BulkInsert||Insert in bulk data.|
|BulkUpdate||Update in bulk data.|
|BulkDelete||Delete in bulk data.|
Dapper Plus - Getting Started
NuGet Package: https://www.nuget.org/packages/Z.Dapper.Plus/
This library is not free, but it’s the fastest way to save your data
You can find more information on their official website
Like Dapper, Dapper Plus extend your
IDbConnection interface but with high-performance bulk operations:
connection.BulkInsert(customers); connection.BulkUpdate(customers); connection.BulkDelete(customers); connection.BulkMerge(customers);
You don’t need to write any SQL, but you might need to specify a mapping for some specific scenario.