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:

Connection

To perform a Bulk Operation on your IDbConnection:

  1. Create your connection
  2. 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);

Try it

Transaction

To perform a Bulk Operations on your IDbTransaction

  1. Create your connection
  2. Create your transaction from the connection
  3. Call the bulk operation from the transaction
  4. 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();

Try it

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!


Last updated: 2023-02-26
Author:


Contents