Castle ActiveRecord
has BeforeLoad
event but I need AfterLoad
event too. I know it's possible to use NHibernate's PostLoad event. But how can I do this?
views:
46answers:
1
A:
ActiveRecord's "events" are based on NHibernate interceptors (IInterceptor
), not NHibernate events. IInterceptor
doesn't have any PostLoad
, so there's no overridable AfterLoad
method in ActiveRecord.
Here are the docs on how to hook up event listeners in ActiveRecord.
Mauricio Scheffer
2010-08-14 16:18:22
So how can I do some code just after loading an entity in AR?
afsharm
2010-08-15 06:09:46
@afsharm: hook up a IPostLoadEventListener
Mauricio Scheffer
2010-08-15 06:39:31
@Mauricio: IPostLoadEventListener is in event model. Am I right? if yes, how can I hook it up while you say AR is based on NHibernate interceptors not event model?
afsharm
2010-08-15 07:57:55
@afsharm: see the link I posted to the docs on how to hook up event listeners in ActiveRecord.
Mauricio Scheffer
2010-08-15 15:20:59