private void SetInsertAudit <T>(T item, DbEntity dbEntity, Guid actedBy) where T : class, IDbEntity, IDbModel, new() { if (dbEntity.IsNewSequentialPrimaryKey && item.GetPrimaryKey() == Guid.Empty) { item.SetPrimaryKey(Guid.NewGuid()); } item.HashValue = HashValueHelper.Generate <T>(item); item.CreatedBy = actedBy; item.CreatedDate = DateTimeHelper.Now(); }
public void Update <T>(T item, Guid actedBy) where T : class, IDbEntity, IDbModel, new() { Initialize(); SetUpdateAudit <T>(item, actedBy); if (HashValueHelper.HasChanged(this.masterConn, this.masterTran, item)) { this.GetMapper().Update <T>(item); this.GetLogger().Add <T>(item, ActionType.Update); } }
private void SetUpdateAudit <T>(T item, Guid actedBy) where T : class, IDbEntity, IDbModel, new() { item.HashValue = HashValueHelper.Generate <T>(item); item.UpdatedBy = actedBy; item.UpdatedDate = DateTimeHelper.Now(); }