1
我想添加一個Restrictions.Eq與TSQL替換圍繞列名稱。我會怎麼做?在NHibernate中,如何將Replace添加到Restrictions.Eq?
string location = "Columbus OH";
var requestQuery = Session.CreateCriteria<Request>();
requestQuery.Add(Restrictions.Eq("Replace(LocationName,',','')", location);
您需要註冊功能'Replace'或使用SQL表達式,在這裏看到更多的細節http://stackoverflow.com/questions/1706259/nhibernate-filtering-by-user-定義函數 - 輸出 – Rippo