private void RastrearDelete(DbEntityEntry change, string prop, string nomeEntidade, IRastreavel rastreavel, BaseModelo baseModelo) { if (change.OriginalValues[prop] != null) { string originalValue = change.OriginalValues[prop].ToString(); Rastro rastro = new Rastro(nomeEntidade, baseModelo.Id, prop, originalValue, null, TipoRastro.Delete); Rastros.Add(rastro); } }
private void RastrearUpdate(DbEntityEntry change, string prop, string nomeEntidade, IRastreavel rastreavel, BaseModelo baseModelo) { if (change.OriginalValues[prop] == null || change.CurrentValues[prop] == null) { return; } string originalValue = change.OriginalValues[prop].ToString(); string currentValue = change.CurrentValues[prop].ToString(); if (originalValue == currentValue) { return; } Rastro rastro = new Rastro(nomeEntidade, baseModelo.Id, prop, originalValue, currentValue, TipoRastro.Update); Rastros.Add(rastro); }