Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async Task<int> SaveChangesAsync(string userName, string impersonatorId)
- {
- try
- {
- AddMetadataToEntity(userName, impersonatorId);
- var audit = new Audit();
- audit.CreatedBy = impersonatorId != null ? impersonatorId : userName;
- audit.PreSaveChanges(this);
- int rowAffected = await base.SaveChangesAsync().ConfigureAwait(false);
- audit.PostSaveChanges();
- if (audit.Configuration.AutoSavePreAction != null)
- {
- audit.Configuration.AutoSavePreAction(this, audit);
- await base.SaveChangesAsync().ConfigureAwait(false);
- }
- return rowAffected;
- }
- catch (DbUpdateConcurrencyException ex)
- {
- foreach (EntityEntry entry in ex.Entries)
- {
- System.Diagnostics.Debug.WriteLine(entry.GetType().Name);
- foreach (Microsoft.EntityFrameworkCore.Metadata.IProperty prop in entry.CurrentValues.Properties)
- {
- System.Diagnostics.Debug.WriteLine("t" + prop.Name);
- System.Diagnostics.Debug.WriteLine("t" + entry.CurrentValues[prop]);
- }
- }
- throw ex;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement