Nhibernate generate plain sql query instead of execution statement

Posted by Wei Ma on Stack Overflow See other posts from Stack Overflow or by Wei Ma
Published on 2012-11-29T22:48:44Z Indexed on 2012/11/29 23:04 UTC
Read the original article Hit count: 157

Filed under:

Using SQL profiler, I was able to find the query generated from Nhibernate was executed in the

EXEC sp_executesql N'select ...' 

fashion.
I am wondering if there is any way to force Nhibernate to generate the plain

Select ...

statement instead.

The reason I want this is because apparently SQL Server generated different execution plans for them, and in my scenario, the plain "select ..." runs MUCH faster.

© Stack Overflow or respective owner

Related posts about nhibernate