public static async Task BulkInsertAsync(this IDAC dac, DataTable table, BulkInsertOptions bulkInsertOptions, TimeSpan timeout, CancellationToken cancellationToken) { // Begin a scope to make sure it's disposed if cancellationToken is turned on using (var scope = dac.BeginScope()) { await Task.Run(() => dac.BulkInsert(table, bulkInsertOptions, timeout), cancellationToken); } }
private async Task AssertConnectionPropagationAsync(IDbConnection expectedConnectionObj, IDAC dac2) { using (var scope2 = dac2.BeginScope(true)) { Assert.AreSame(expectedConnectionObj, scope2.Connection); } }
public static long Save(this IDAC dac, DataRow dataRow, bool ommitAutoIncrementPK = true) { using (var scope = dac.BeginScope(openConnection: true)) { return(dataRow.RowState == DataRowState.Added ? dac.Insert(dataRow, ommitAutoIncrementPK) : dac.Update(dataRow)); } }
public static DataTable ExecuteQuery(this IDAC dac, string query) { using (var scope = dac.BeginScope()) using (var reader = dac.ExecuteReader(query)) return(reader.ToDataTable()); }