newuser2018
newuser2018

Reputation: 21

NHibernate Specify index on query

I want to create Nhibernate C# query for below sql query,

SELECT ContactID
FROM Person.Contact WITH (INDEX(AK_Contact_rowguid))
GO

How can I do this ?

Upvotes: 2

Views: 386

Answers (1)

Kais
Kais

Reputation: 117

you need to use the methode .CreateSqlQuery() like this exemple :

var SessionFactory = Configuration.BuildSessionFactory(); ISession session = SessionFactory.OpenSession() session.CreateSQLQuery("SELECT ContactID FROM Person.Contact WITH (INDEX(AK_Contact_rowguid))");

for more information check this link

Upvotes: 0

Related Questions