你会怎么做这NHibernate的比较级联特性
Select *
from Personnel p
where p.LastName + ', ' + p.FirstName + ' ' + p.MiddleInitial LIKE @Employee + '%'
使用NHibernate(3.0)?到目前为止,我试过
personnel.QueryOver<Personnel>()
.WhereRestrictionOn(x => x.LastName + ', ' + x.FirstName + ' ' + x.MiddleInitial)
.IsLike(employeeName, MatchMode.Start)
无济于事。
你可以做到这一点?甜!明天试试吧 – Jonn 2011-05-26 15:37:23
@Jonn - 看看http://codebetter.com/kylebaley/2010/07/30/using-an-nhibernate-formula-to-aid-searching/ – rebelliard 2011-05-26 17:58:14
谢谢。奇迹般有效。尽管我有一个考虑。这不会影响性能吗?这意味着每次检索员工时都会有一个额外的计算字段。 – Jonn 2011-05-27 00:52:58