如何在NHibernate iCriteria中实现以下语句
Select * From LECNNy where Left(Address,4)='test'
必须是
Projections.SqlFunction("left"("Address"),
但是我如何传递字符数和var?
答案 0 :(得分:2)
进一步的研究给出了以下答案:
store.Add(
Restrictions.Eq(
Projections.SqlFunction(
"left",
NHibernate.NHibernateUtil.String,
Projections.Property("Address"),
Projections.Constant(4)
),
'test'
)
);