ups...
var cfg = new Configuration().Configure();
or one of its override should be the first method call before do anything
else with the configuration.

2009/11/4 Rémi Després-Smyth <[email protected]>

>  Found the problem.  Adding a call to
>
>
>
> cfg.Configure();
>
>
>
> after cfg.AddAssembly and before building the session factory fixes it.
>
>
>
>
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Fabio Maulo
> *Sent:* October 30, 2009 8:32 PM
> *To:* [email protected]
> *Subject:* [nhusers] Re: proper event listener configuration
>
>
>
> can you recreate the issue with NH2.1.0 ?
>
> 2009/10/30 Rémi Després-Smyth <[email protected]>
>
> Hi.
>
> I'm trying to use an event listener for the first time. All samples I've
> found show how easy it is to configure, but for some reason I'm having
> trouble. I suspect I'm missing something obvious.
>
> I've tried this:
>
> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
>     <session-factory name="TerraCognita.LoanExpress">
>         <!-- other stuff... -->
>         <listener type="delete" class="Test.TestDeleteListener, MyDllName"
> />
>     </session-factory>
> </hibernate-configuration>
>
> as well as:
>
> <hibernate-configuration   xmlns="urn:nhibernate-configuration-2.2">
>     <session-factory name="TerraCognita.LoanExpress">
>         <!-- other stuff... -->
>         <event type="delete">
>             <listener class="Test.TestDeleteListener, MyDllName" />
>         </event>
>     </session-factory>
> </hibernate-configuration>
>
> When configuration is loaded and the session factory is built:
>
> var cfg = new NHibernate.Cfg.Configuration();
> cfg.AddAssembly("MyDllName");
> sessionFactory = cfg.BuildSessionFactory();
>
> After instantiation, cfg.EventListeners.DeleteEventListeners has a single
> entry, of type DefaultDeleteEventListener (as I'd expect). However, after
> cfg.AddAssembly is called, *this is still the case* - but given the
> configuration, I would expect that the DeleteEventListener should actually
> be of type TestDeleteListener.
>
> In my unit test, the only way I can get my event listener working is by
> manually adding it to the session info:
>
> var sess = GetSession();
> sess.GetSessionImplementation().Listeners.DeleteEventListeners =
>     new NHibernate.Event.IDeleteEventListener[] { new TestDeleteListener()
> };
>
> I know this shouldn't be required – can anyone tell me what I’m doing wrong
> here?
>
>
>
> Regards,
>
> Remi.
>
>
>
>
>
>
>
>
> --
> Fabio Maulo
>
>
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to