The state tracker keeps the original values as they were loaded from the 
database, or any new values, provided they have been sent to the database. 
So it may not be possible to find the exact ones that were loaded, if they 
were overwritten and committed.

RP

On Wednesday, August 21, 2013 1:01:59 PM UTC+1, nfplee wrote:
>
> Hi, I found an 
> article<http://nhforge.org/wikis/howtonh/finding-dirty-properties-in-nhibernate.aspx>saying
>  that the following will retrieve the old/original state of an entity:
>  
> var sessionImpl = session.GetSessionImplementation();
> var persistenceContext = sessionImpl.PersistenceContext;
> var oldEntry = persistenceContext.GetEntry(entity);
> var persister = 
> sessionImpl.Factory.GetEntityPersister(oldEntry.EntityName);
>  
> // Unproxy
> if (oldEntry == null && entity is INHibernateProxy)
>     oldEntry = 
> sessionImpl.PersistenceContext.GetEntry(sessionImpl.PersistenceContext.Unproxy((INHibernateProxy)entity));
>  
> var oldState = oldEntry.LoadedState;
>  
> I hoped this would return the entity in it's original state when it was 
> loaded from the database. However If I look at the old state it has the 
> values which have been updated. Has this changed in a later version and if 
> so is this still possible? Thanks
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to