Rabadash8820
Rabadash8820

Reputation: 2524

Does NHibernate's ISession.QueryOver fire any events?

I have only recently learned about the Events system in NHibernate. The documentation says that

Essentially all of the methods of the ISession interface correlate to an event

and yet I cannot find any event that fires when I load a List of objects with ISession.QueryOver().List(). I would've thought that this fairly common operation would have a nice event associated with it, but I've tested InitializeCollectionEvent, RefreshEvent, LoadEvent, and a couple others, and none of them fire when I call QueryOver(), so what am I missing?

If there's really no event raised by QueryOver(), then what operation raises the InitializeCollectionEvent? I just want to handle whenever a list of objects is loaded from the db, and I assume that this is the event I'll need.

Thanks in advance!

Upvotes: 0

Views: 68

Answers (1)

Rabadash8820
Rabadash8820

Reputation: 2524

Nevermind, it looks like ISession.QueryOver().List() fires the PostLoadEvent once for each object in the returned list, I just forgot to register the listeners with my NHibernate Configuration during testing :P There are probably additional events fired but I didn't check any others.

Hopefully this helps somebody in the future...

Upvotes: 0

Related Questions