I'm using IEntityPersister.FindDirty in the context of the wiki
published technique of determining if an entity is modified: Finding Dirty
Properties in 
NHibernate<http://nhforge.org/wikis/howtonh/finding-dirty-properties-in-nhibernate.aspx>
.

In my case, one of the entities has a ManyToOne relationship.


   1. I start by getting the entity state via EntityEntry.LoadedState. In
   this state array, the entry for the ManyToOne relationship is *only* the
   *ID value for the related entity*.
   2. Then I get the current entity state
fromIEntityPersister.GetPropertyValueand it has the
   *loaded entity target of the ManyToOne relationship*.
   3. The problem is that when IEntityPersister.FindDirty is called with
   this this pair of states like so: var dirtyProps =
   persister.FindDirty(currentState, oldState, entity, sessionImpl); it
   throws an exception because apparently the ManyToOneType.IsDirty expects
   both of the values to be the actual entity, not just an ID value.

As I was debugging, it began to seem like a raw ID value should never be
used where it was going (ultimately to BasicPropertyGetter which tries to
get the ID value from the ID type instance itself instead of from an
entity). Therefore, is the raw ID value in the
EntityEntry.LoadedStateincorrect? Should it be a proxy instead? If so,
and it appears so, how'd it
get in the incorrect, raw ID state?

-rory

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to