I think lifecycles are discouraged/obsolete in NH 2.0. Event Listeners
are the preferred method to intercept. I don't have too much
experience with this, but you can catch the flush event. check the
type and send the email.
On Oct 7, 11:03 am, jonnii <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to move from a custom in-house ORM to NHibernate, but have
> hit one small snag. We currently have something like this (this is a
> very simplified example):
>
> public class User{
>
> public class Lifecycle : DefaultLifecycle<User> {
> public override void OnAfterSave(User u)
> { MailService.SendWelcomeMail(u); }
> }
>
> }
>
> The way the current system works is that it analyses the model graph
> and works out the change set, validates the objects, runs the before
> lifecycle events, saves the objects, then runs the after lifecycle
> events.
>
> I've been experimenting with shoe-horning this feature into nhibernate
> by using a custom IInterceptor, but that only gets me so far.
>
> So what I'm thinking is wrapping up access to the ISession and running
> the events myself, but to do that I need to be able to be able to work
> out what is about to be flushed, and because these lifecycle events
> can modify the object graph I also need to be able to work out if the
> objects to be flushed has changed, and if so what has changed.
>
> Is this possible?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---