Beispiel #1
0
 public async Task AddRangeAsync(List <T> records, CancellationToken token)
 {
     await Task.Run(async() =>
     {
         using (var context = new teCorpContext())
         {
             context.Set <T>().AddRange(records);
             await context.SaveChangesAsync(token).ConfigureAwait(false);
         }
     }, token);
 }
Beispiel #2
0
 public async Task RemoveAsync(T record, CancellationToken token)
 {
     await Task.Run(async() =>
     {
         using (var context = new teCorpContext())
         {
             context.Entry(record).State = EntityState.Deleted;
             await context.SaveChangesAsync(token).ConfigureAwait(false);
         }
     }, token);
 }
Beispiel #3
0
 public async Task UpdateRangeAsync(List <T> records, CancellationToken token)
 {
     await Task.Run(async() =>
     {
         using (var context = new teCorpContext())
         {
             foreach (var record in records)
             {
                 context.Entry(record).State = EntityState.Modified;
             }
             await context.SaveChangesAsync(token).ConfigureAwait(false);
         }
     }, token);
 }