Filip,

This works:

public class SaveListener: DefaultSaveEventListener
{
        protected override Object PerformSaveOrUpdate(SaveOrUpdateEvent
@event)
        {
                if (@event.Entity is Post)
                {
                        Post post = (@event.Entity as Post);

                        if (post.ID == 0)
                        {
                                //new entity
                        }

                        post.Timestamp = DateTime.Now;
                }

                return base.PerformSaveOrUpdate(@event);
        }
}



On Feb 21, 7:32 am, Filip Kinský <[email protected]> wrote:
> Hello Fabio, thanks for your response. I just tried to remove the row you
> mentioned, but it didn't help - the test still fails..
>
>
>
>
>
>
>
> On Fri, Feb 18, 2011 at 3:02 PM, Fabio Maulo <[email protected]> wrote:
> > remove this
> > persister.SetPropertyValue(state, "LastModified", trackable.LastModified);
>
> > On Thu, Feb 17, 2011 at 5:11 AM, Filip Kinsky <[email protected]> wrote:
>
> >> I just figured out that if I
> >> hook SaveEventListeners+UpdateEventListeners+SaveOrUpdateEventListeners
> >> instead of PreInsertEventListeners+PreUpdateEventListeners than it starts 
> >> to
> >> work - the test passes. So I wonder why everyone suggests to use the
> >> pre-insert/update events (eg.
> >>http://ayende.com/Blog/archive/2009/04/29/nhibernate-ipreupdateeventl...
> >> Or is this just some bug in NH 3.0.0.1003 pre-insert/update events
> >> implementation and the test case in my first post should work?
>
> >> --
> >> 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.
>
> > --
> > Fabio Maulo
>
> >  --
> > 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.

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