public override bool OnFlushDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, NHibernate.Type.IType[] types) { if (!(entity is ICriadoEm) && !(entity is IAlteradoEm)) { return(false); } DateTime created = DateTime.Now; if ((entity is ICriadoEm)) { ICriadoEm value = (ICriadoEm)entity; if (object.Equals(value.CriadoEm, null) || object.Equals(value.CriadoEm, new DateTime())) { SetState(value, x => x.CriadoEm, propertyNames, currentState, created); } } if ((entity is IAlteradoEm)) { IAlteradoEm value = (IAlteradoEm)entity; SetState(value, x => x.AlteradoEm, propertyNames, currentState, created); } return(true); }
public override bool OnSave(object entity, object id, object[] state, string[] propertyNames, NHibernate.Type.IType[] types) { if (!(entity is ICriadoEm) && !(entity is IAlteradoEm)) { return(false); } DateTime created = DateTime.Now; if ((entity is ICriadoEm)) { ICriadoEm value = (ICriadoEm)entity; SetState(value, x => x.CriadoEm, propertyNames, state, created); } if ((entity is IAlteradoEm)) { IAlteradoEm value = (IAlteradoEm)entity; SetState(value, x => x.AlteradoEm, propertyNames, state, created); } return(true); }