Ejemplo n.º 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);
     }
 }
Ejemplo n.º 2
0
 private async Task AssertConnectionPropagationAsync(IDbConnection expectedConnectionObj, IDAC dac2)
 {
     using (var scope2 = dac2.BeginScope(true)) {
         Assert.AreSame(expectedConnectionObj, scope2.Connection);
     }
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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());
 }