Hi,

Object state stored in IEntityPersister, check LoadedState for loaded state.
Current state you can get from object with method GetPropertyValue.
Below code sample for detecting if property changed:


  public static bool IsChanged<T>(this ISession session, T entity, string
property) { var entry = session.GetEntry(entity); if (entry == null) return
true; var index = entry.Persister.PropertyNames.IndexOf(n =>
n.Equals(property, StringComparison.OrdinalIgnoreCase)); var currentState =
entry.Persister.GetPropertyValue(entity, index, session.ActiveEntityMode);
if (entry.LoadedState != null) return !Equals(currentState,
entry.LoadedState[index]); return true; }

private static EntityEntry GetEntry(this ISession s, object activeRecord) {
var context = s.GetSessionImplementation().PersistenceContext; EntityEntry
entry; var proxy = activeRecord as INHibernateProxy; if (proxy != null) {
if (!context.ContainsProxy(proxy)) throw new
TransientObjectException("proxy was not associated with the session"); var
li = proxy.HibernateLazyInitializer; entry =
context.GetEntry(li.GetImplementation()); } else { entry =
context.GetEntry(activeRecord); } return entry; }



2013/11/14 Sid Shetye <[email protected]>

> Can someone point out to the data structure which is referenced for
> determining the clean/dirty status of an entity inside NHibernate? If you
> could also guide me towards the specific class/method that does that check
> - that will be even better.
>
> Thanks
> Sid
>
> --
>
> ---
> 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.
>

-- 

--- 
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