Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }