我正在尝试为 NHibernate 创建 SQL 查询:
SQL 看起来像这样:
Select p.*
From PPoint p
Inner join PPFile f on p.ImportID = f.ImportID
where p.Name like '%a%'
Or p.Code like '%a%'
Or f.FileName like '%a%'
找不到一个像样的例子,即使听起来很容易做到。
目前我有:
var pointList = session
.CreateCriteria(typeof(PPoint))
.Add(Restrictions.Or(Restrictions.Or(Restrictions.Or(Restrictions.Or
Restrictions.Like("Name", "%" + search + "%"),
Restrictions.Like("Code", "%" + search + "%")),
Restrictions.Like("Test", "%" + search + "%")),
Restrictions.Like("Test2", "%" + search + "%")),
Restrictions.Like("FileName", "%" + search + "%")))
.List<PPoint>();
NHibernate 2.2 版