Is it possible to manually change an entity when it's loaded from the database by NHibernate. Is there a开发者_如何学Pythonn OnLoad
event listener which we can override or inherit from which will allow us to manually set an entity.
For clarity, we wish to assign a custom entity when the property is null
. We are successfully doing the opposite when we persist to the database however would rather implement the logic in an NHibernate listener rather than in the property "Getter".
Please note we do not want to use IInterceptors
as we are using the latest version of NHibernate.
You can implement IPostLoadEventListener
. It's just one method:
void OnPostLoad(PostLoadEvent @event)
Which I think is exactly what you want.
精彩评论