I am trying to override the delete event listener with a custom soft delete listene开发者_高级运维r I wrote; however, I am having issues with the registration process. I have the following in my web.config:
<event type="delete">
<listener class="NHibernateTest1.Model.MyDeleteEventListener"/>
</event>
I have tried to register the listener programmatically as well:
NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();
config.SetListener(ListenerType.Delete, new MyDeleteEventListener());
I tested this and my deletes are still hard deletes, in fact I do not think my listener was even registered. Any ideas what might be going on? Thanks.
You are probably missing the assembly name in the config file. Should be something like:
<event type="delete">
<listener class="NHibernateTest1.Model.MyDeleteEventListener, YourAssembly"/>
</event>
I have my events setup this way and it works flawlessly.
精彩评论