public ChangeLogDetailsAuditor(EntityEntry dbEntry, AuditLog log, DbEntryValuesWrapper dbEntryValuesWrapper) { DbEntry = dbEntry; _log = log; _dbEntryValuesWrapper = dbEntryValuesWrapper; }
public void Can_Create_AuditLogDetail_ForDeletedEntity_WithoutQueryingDatabase() { var options = new DbContextOptionsBuilder <TestTrackerContext>() .UseSqlServer(TestConnectionString) .Options; NormalModel model = new NormalModel(); using (TestTrackerContext ttc = new TestTrackerContext(options)) { ttc.NormalModels.Add(model); ttc.SaveChanges(); ttc.NormalModels.Remove(model); ttc.ChangeTracker.DetectChanges(); var entry = ttc.ChangeTracker.Entries().First(); var valuesWrapper = new DbEntryValuesWrapper(entry); var auditor = new ChangeLogDetailsAuditor(entry, null, valuesWrapper); var auditLogDetails = auditor.CreateLogDetails().ToList(); } }
private object GetPrimaryKeyValuesOf( EntityEntry dbEntry, List <PropertyConfiguerationKey> properties) { if (properties.Count == 0) { throw new KeyNotFoundException("key not found for " + dbEntry.Entity.GetType().FullName); } var valuesWrapper = new DbEntryValuesWrapper(_dbEntry); if (properties.Count == 1) { return(valuesWrapper.OriginalValue(properties.First().PropertyName)); } string output = "["; output += string.Join(",", properties.Select(colName => valuesWrapper.OriginalValue(colName.PropertyName))); output += "]"; return(output); }
public SoftDeletedLogDetailsAuditor(EntityEntry dbEntry, AuditLog log, DbEntryValuesWrapper dbEntryValuesWrapper) : base(dbEntry, log, dbEntryValuesWrapper) { }
internal LogAuditor(EntityEntry dbEntry) { _dbEntry = dbEntry; _dbEntryValuesWrapper = new DbEntryValuesWrapper(_dbEntry); }
public ChangeLogDetailsAuditor(DbEntityEntry dbEntry, AuditLog log) { DbEntry = dbEntry; _log = log; _dbEntryValuesWrapper = new DbEntryValuesWrapper(dbEntry); }