当我使用NHibernate(我是一个初学者),我能够在输出中获得对Db的SQL调用。但是我复制并粘贴到Management Studio后无法使其工作。因为缺少参数声明。如何获取参数声明以及NHibernate的SQL调用?
我得到的是这样的:
SELECT this_.PK_Product as PK1_1_0_, this_.ProductCode as ProductC2_1_0_
, this_.ProductName as ProductN3_1_0_, this_.ProductCodeISO2 as ProductC4_1_0_
, this_.NotUsed as NotUsed1_0_, this_.Confirmed as Confirmed1_0_, this_.LabelRequired as LabelReq7_1_0_ FROM tProduct this_
WHERE (this_.NotUsed = @p0 and this_.Confirmed = @p1 and this_.LabelRequired = @p2);@p0 = False [Type: Boolean (0)], @p1 = True [Type: Boolean (0)], @p2 = False [Type: Boolean (0)]`enter code here`
当我在SQL Management Studio中执行此,我得到一个错误:
消息137,级别15,状态2,行1 必由之路声明标量变量“@ p0”。
我可以告诉NHibernate在创建的查询字符串中添加参数声明吗?
感谢