public async Task UpdateAsync(TAggregateRoot aggregateRoot) { using (var ctx = new WbcContext()) { ctx.Set <TAggregateRoot>().Attach(aggregateRoot); ctx.Entry(aggregateRoot).State = EntityState.Modified; await ctx.SaveChangesAsync(); } }
public async Task UpdateRangeAsync(IEnumerable <TAggregateRoot> aggregateRoots) { using (var ctx = new WbcContext()) { foreach (var item in aggregateRoots) { ctx.Set <TAggregateRoot>().Attach(item); ctx.Entry(item).State = EntityState.Modified; } await ctx.SaveChangesAsync(); } }