You can also add [EventListener] to your event listener class. See
http://using.castleproject.org/display/AR/NHEventListenerSpecs for details.

-Markus

2009/7/22 Gerdus van Zyl <[email protected]>

>
> In case someone has the same question in the future:
>
> PostLoad event on Nhibernate that can be hooked up using the technique in
>
>
> http://using.castleproject.org/display/AR/Using+NHibernate.Search+with+ActiveRecord
>
> code:
>
> Dim holder As ISessionFactoryHolder =
> ActiveRecordMediator.GetSessionFactoryHolder()
> Dim configuration As NHibernate.Cfg.Configuration =
> holder.GetConfiguration(GetType(ActiveRecordBase))
> configuration.SetListener(NHibernate.Event.ListenerType.PostLoad, New
> NHARevent())
>
>
>    Private Class NHARevent
>        Implements NHibernate.Event.IPostLoadEventListener
>
>
>        Public Sub OnPostLoad(ByVal [event] As
> NHibernate.Event.PostLoadEvent) Implements
> NHibernate.Event.IPostLoadEventListener.OnPostLoad
>            Dim e As IBaseBizClass
>            e = [event].Entity
>            e.AfterLoadEvent()
>        End Sub
>    End Class
>
>
> ~G
>
> On Tue, May 19, 2009 at 3:23 PM, Gerdus van Zyl<[email protected]>
> wrote:
> > Hi,
> >
> > I am looking for an ActiveRecord/NHibernate afterload event to
> > complement the BeforeLoad event.
> > The use case is I have some processing I want to do if the object is
> > changed after load but not during loading from the database. for
> > example a tax calculation that should only be carried out when die
> > amount changes, but the calculated amount can be overriden by the
> > user. The calculation is done via the propertychanged event which
> > fires during load. So if I have a before and after load event, I can
> > set a flag to only calc before(eg.new object)/after load but not
> > during. If someone can give me a point in the right direction that
> > would be great.
> >
> > Thank You,
> > Gerdus
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to