C# – How to use transactions with dapper.net


I would like to run multiple insert statements on multiple tables. I am using dapper.net. I don't see any way to handle transactions with dapper.net.

Please share your ideas on how to use transactions with dapper.net.

Best Solution

Here the code snippet:

using System.Transactions;    
using (var transactionScope = new TransactionScope())

Note that you need to add reference to System.Transactions assembly because it is not referenced by default.