Пример #1
0
 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);
     }
 }
Пример #2
0
 private async Task AssertConnectionPropagationAsync(IDbConnection expectedConnectionObj, IDAC dac2)
 {
     using (var scope2 = dac2.BeginScope(true)) {
         Assert.AreSame(expectedConnectionObj, scope2.Connection);
     }
 }
Пример #3
0
 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));
     }
 }
Пример #4
0
 public static DataTable ExecuteQuery(this IDAC dac, string query)
 {
     using (var scope = dac.BeginScope())
         using (var reader = dac.ExecuteReader(query))
             return(reader.ToDataTable());
 }