Fabio,

But... I have posted a complete fully working example with the JIRA
issue, with nothing but two classes, mappings and the test!
It even creates the data model, and populates it...
:-)

RP

On May 24, 3:11 pm, Ricardo Peres <[email protected]> wrote:
> Fabio,
>
> Don't get me wrong: I have followed the stack trace, and I know why
> this is happening (in the code); I just don't understand it.
> First of all: from a conceptual point of view, should the
> ISession.IsDirty() fire SaveOrUpdate, on non-dirty entities, or on any
> entities at all?
> Second: why, if we are loading the entity by its it, the event does
> not fire, and if we load it from a property of another entity, it
> does?
> IMHO, if you answer yes to the first question, there is a bug: it
> isn't being fired if the entity is not directly loaded.
> I don't want to take your time, just to understand this. Am I the only
> one who doesn't understand this behavior?
>
> Thanks!
>
> RP
>
> On May 24, 3:05 pm, Fabio Maulo <[email protected]> wrote:
>
>
>
>
>
>
>
> > The only thing done by IsDirty is just fire an event
> > DirtyCheckEvent dcEvent = new DirtyCheckEvent(this);
> > IDirtyCheckEventListener[] dirtyCheckEventListener =
> > listeners.DirtyCheckEventListeners;
> > for (int i = 0; i < dirtyCheckEventListener.Length; i++)
> > {
> > dirtyCheckEventListener[i].OnDirtyCheck(dcEvent);}
>
> > return dcEvent.Dirty;
> > You can disable/replace/override that event.
>
> > On Tue, May 24, 2011 at 10:21 AM, Ricardo Peres <[email protected]> wrote:
> > > Fabio,
> > > You have closed JIRA issues NH-2727 saying that it is not an issue.
> > > Perhaps you can explain me, because this is bugging me, why does the
> > > following line raise the SaveOrUpdate event and the next doesn't:
>
> > > //raises SaveOrUpdate
> > > User u = session.Query<User>().FirstOrDefault();
> > > UserGroup ug = u.UserGroup.First();
>
> > > //does not raise
> > > UserGroup ug = session.Query<UserGroup>().FirstOrDefault();
> > > User u = ug.User;
>
> > > By the way, in general, why does ISession.IsDirty() fire any events?
> > > Shouldn't it just check the current state of entities in memory?
>
> > > Thank you for your time, once again!
>
> > > RP
>
> > --
> > Fabio Maulo

Reply via email to