Dapper Plus Basic Usage
Download
First, you need to download the library on NuGet.
Dapper Plus support:
- .NET Core 2.0 or greater
- .NET Framework 4.0 or greater
Extension Methods
When the library is added to your projects, the following extension methods are now automatically available from your IDbConnection
and IDbTransaction
interface:
- BulkInsert
- BulkUpdate
- BulkDelete
- BulkMerge
- BulkSynchronize
- And more
Connection
To perform a Bulk Operation on your IDbConnection:
- Create your connection
- Call the bulk operation from the connection
// 1. Create your connection var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()); // 2. Call the bulk operation from the connection connection.BulkInsert(invoices);
Transaction
To perform a Bulk Operations on your IDbTransaction
- Create your connection
- Create your transaction from the connection
- Call the bulk operation from the transaction
- Commit the transaction
// 1. Create your connection var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer()); // 2. Create your transaction from the connection connection.Open(); var transaction = connection.BeginTransaction(); // 3. Call the bulk operation from the transaction transaction.BulkInsert(invoices); // 4. Commit the transaction transaction.Commit();
Online Example
Whenever you want to check how an option works, make sure to search it in our Online Examples section.
Hundreds of examples are available to get you started!
ZZZ Projects