2011/4/6 Kenneth Siewers Møller <[email protected]> > Okay, I see. The problem is just that the bug isn't reproducible with > NHibernate alone. How can I report a bug, that is not in NHibernate itself. > What I don't understand is, why the NHibernate Facility is breaking the > correct behavior of NHibernate? Shouldn't it be working transparently? >
It's similar the bug I've reported in here: http://216.121.112.228/browse/NH-2457. It used to be a bug in 3.0.0, but it's been fixed in 3.1.0. As I've explained in here: http://groups.google.com/group/castle-project-users/browse_thread/thread/5efc9f3b7b5d6a08, SessionDelegate doesn't implement ISessionImplementor because it's internal to NHibernate code base, thus it only implements ISession. When you open a new ISession using NHibernate Facility ISessionManager.OpenSession(), it actually returns *SessionDelegate* instead of *SessionImpl*. SessionDelegate is wrapper for SessionImpl in NHibernate Facility. Since SessionDelegate doesn't implement ISessionImplementor, it would return null in the following code: public static IQueryable<T> Query<T>(this ISession session) { return new NhQueryable<T>(session as ISessionImplementor); } That's why you got a NullReferenceException, but not with this code: public static IQueryable<T> Query<T>(this ISession session) { return new NhQueryable<T>(session.GetSessionImplementation()); } It would work otherwise if SessionDelegate implemented ISessionImplementor. But that would be another question :). -- Regards, Maximilian Haru Raditya -- You received this message because you are subscribed to the Google Groups "Castle Project Development List" 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/castle-project-devel?hl=en.
