public void Remove(T record) { using (var context = new teCorpContext()) { context.Entry(record).State = EntityState.Deleted; context.SaveChanges(); } }
public void Add(T record) { using (var context = new teCorpContext()) { context.Entry(record).State = EntityState.Added; context.SaveChanges(); } }
public void Update(T record) { using (var context = new teCorpContext()) { context.Entry(record).State = EntityState.Modified; context.SaveChanges(); } }
public void RemoveRange(List <T> records) { using (var context = new teCorpContext()) { foreach (var record in records) { context.Entry(record).State = EntityState.Deleted; } context.SaveChanges(); } }
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); }
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); }