public int Complete(bool ensureAutoHistory = false) { var changeSet = _entityHistoryHelper?.CreateEntityChangeSet(Context.ChangeTracker.Entries().ToList()); var result = _context.SaveChanges(); if (changeSet.EntityChanges.IsNullOrEmpty()) { return(result); } _entityHistoryHelper?.UpdateChangeSet(changeSet); AsyncHelper.RunSync(() => EntityHistoryStore.SaveAsync(this, changeSet)); return(result); }
public async Task <int> CompleteAsync(bool ensureAutoHistory = false) { var changeSet = _entityHistoryHelper?.CreateEntityChangeSet(Context.ChangeTracker.Entries().ToList()); var result = await _context.SaveChangesAsync(); if (changeSet.EntityChanges.IsNullOrEmpty()) { return(result); } _entityHistoryHelper?.UpdateChangeSet(changeSet); await EntityHistoryStore.SaveAsync(this, changeSet); return(result); }