我想为以下sql查询创建Nhibernate C#查询,
SELECT ContactID
FROM Person.Contact WITH (INDEX(AK_Contact_rowguid))
GO
我该怎么做?
答案 0 :(得分:0)
您需要使用方法.CreateSqlQuery()这样的示例:
var SessionFactory = Configuration.BuildSessionFactory();
ISession session = SessionFactory.OpenSession()
session.CreateSQLQuery("SELECT ContactID FROM Person.Contact WITH (INDEX(AK_Contact_rowguid))");
有关更多信息,请检查此link