2011/4/6 Kenneth Siewers Møller <[email protected]>

> The NHibernateFacility version 2.0 RC breaks the Query<> API of NHibernate.
> I can do QueryOver<> but Query<> throws a NullReferenceException.
>


It seems it's a bug in NHibernate LinqExtensionMethods implementation. If
you take a look at LinqExtensionMethods.Query<T>(this ISession)
implementation in NHibernate souce code, it's currently implemented like
this:

        public static IQueryable<T> Query<T>(this ISession session)
        {
            return new NhQueryable<T>(session as ISessionImplementor);
        }


when it should be implemented like this:

        public static IQueryable<T> Query<T>(this ISession session)
        {
            return new NhQueryable<T>(*session.GetSessionImplementation()*);
        }


The explanation is that in NHibernate SessionImpl, it inherits from
ISessionImplementor, while in NHibernateFacility SessionDelegate, it doesn't
inherit from ISessionImplementor. That's why when SessionDelegate cast back
to ISessionImplementor, it became null.

I think this bug should be reported in here: http://jira.nhforge.org.




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

Reply via email to