Пример #1
0
        public override async Task <int> SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            var changeSet = EntityHistoryHelper?.CreateEntityChangeSet(this);

            var result = await base.SaveChangesAsync(cancellationToken);

            if (EntityHistoryHelper != null)
            {
                await EntityHistoryHelper.SaveAsync(this, changeSet);
            }

            return(result);
        }
Пример #2
0
        public override async Task <int> SaveChangesAsync(CancellationToken cancellationToken = default)
        {
            if (EntityHistoryHelper == null)
            {
                return(await base.SaveChangesAsync());
            }

            var changeSet = EntityHistoryHelper.CreateEntityChangeSet(ChangeTracker.Entries().ToList());

            var result = await base.SaveChangesAsync(cancellationToken);

            await EntityHistoryHelper.SaveAsync(changeSet);

            return(result);
        }