I preferred to use a more intuitive approach, getting the transaction directly from the connection:
// This called method will get a connection, and open it if it not yet open. using (var connection = GetOpenConnection()) using (var transaction = connection.BeginTransaction()) { connection.Execute( "INSERT INTO data(Foo, Bar) values (@Foo, @Bar);", listOf5000Items, transaction); transaction.Commit(); }
ANeves Nov 18 '13 at 12:36 2013-11-18 12:36
source share