开发者

NHibernate - Where ISession.Query<T>() is located

开发者 https://www.devze.com 2023-02-04 19:21 出处:网络
When I try to compile the following code using System; using System.Collections开发者_运维问答.Generic;

When I try to compile the following code

using System;
using System.Collections开发者_运维问答.Generic;
using System.Reflection;
using System.Linq;
using NHibernate;

namespace NewNHTest
{
    class A
    { }

    class Program
    {
        static void Main(string[] args)
        {
            ISession session;
            var q = session.Query<A>();
        }
    }
}

I get the following error:

'NHibernate.ISession' does not contain a definition for 'Query' and no extension method 'Query' accepting a first argument of type 'NHibernate.ISession' could be found (are you missing a using directive or an assembly reference?)

NHibernate.dll version is 3.0.0.4000.

The .Net version of project is 3.5.

What am I doing wrong?

Thank you for your help!


ISession.Query

is new to NHibernate 3 and is an extension method. Try

using NHibernate.Linq

and it should be resolved fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号