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

            LogDatabaseDetails changes = null;

            try
            {
                changes = LogUserActionService.GetChangesBeforeSave(this);
            }
            catch (Exception)
            {
            }

            var result = await base.SaveChangesAsync();

            LogUserActionService.AddChangesAfterSave(changes);

            return(result);
        }
Пример #2
0
        public override int SaveChanges()
        {
            if (LogUserActionService == null)
            {
                return(base.SaveChanges());
            }

            LogDatabaseDetails changes = null;

            try
            {
                changes = LogUserActionService.GetChangesBeforeSave(this);
            }
            catch (Exception)
            {
            }

            var result = base.SaveChanges();

            LogUserActionService.AddChangesAfterSave(changes);

            return(result);
        }