我试图让我的搜索整个数据库中列“价值”为包含搜索字符串的所有结果我的网页上的搜索功能的所有值的搜索功能。我为我的项目使用NHibernate,我仍然习惯于应该指定查询的方式。有返回包含搜索字符串
我目前的搜索功能:
[HttpGet]
public ActionResult Search(string searchString)
{
var searchResult = DbSession.QueryOver<Translation>()
.Where(x => x.Value.Contains(searchString))
.List();
return Json(searchResult, JsonRequestBehavior.AllowGet);
}
最终的查询将有更多的限制,但首先我需要对数据进行筛选,使得列表仅包含包含搜索字符串的值。 目前,我在.Where(x => x.Value.Contains(searchString))
部件上收到System.Exception。 任何人有任何想法?
在此先感谢!
什么是确切的例外呢? System.Exception真的是异常代码抛出吗? – qxg