Esempio n. 1
0
 public override int SaveChanges(bool acceptAllChangesOnSuccess)
 {
     Logger?.LogInformation($"Executing SaveChanges method of '{GetType().Name}'.");
     try
     {
         ProcessAudit();
         try
         {
             var res = base.SaveChanges(acceptAllChangesOnSuccess);
             ProcessPostActions();
             return(res);
         }
         finally
         {
             PostProcessor.Clear();
         }
     }
     finally
     {
         Logger?.LogInformation($"Executed SaveChanges method of '{GetType().Name}'.");
     }
 }
Esempio n. 2
0
        public override async Task <int> SaveChangesAsync(CancellationToken cancellationToken = default)
        {
            Logger?.LogInformation($"Executing SaveChangesAsync method of '{GetType().Name}'.");
            try
            {
                ProcessAudit();
                try
                {
                    var res = await base.SaveChangesAsync(cancellationToken).ConfigureAwait(false);

                    ProcessPostActions();
                    return(res);
                }
                finally
                {
                    PostProcessor.Clear();
                }
            }
            finally
            {
                Logger?.LogInformation($"Executed SaveChangesAsync method of '{GetType().Name}'.");
            }
        }