我使用QueryOver
和islike
从oracle db获取记录,但我想要不区分大小写
orgs = session.QueryOver<V_CM_ORG_GET>()
.SelectList(list => list
.SelectGroup(c => c.ORG_ID).WithAlias(()=>or.ORG_ID)
.SelectGroup(c => c.ORG_NAME).WithAlias(() => or.ORG_NAME)
.SelectGroup(c => c.PHONE).WithAlias(() => or.PHONE))
.Where(Restrictions.On<V_CM_ORG_GET>(y=>y.ORG_NAME)
.IsLike(query,MatchMode.Anywhere))
.TransformUsing(Transformers.AliasToBean<OrgsObj>())
.List<OrgsObj>();
答案 0 :(得分:9)
不确定您是否真的尝试过搜索:
如前所述,解决方案将是这样的:
// instead of this
.Where(Restrictions.On<V_CM_ORG_GET>(y=>y.ORG_NAME)
.IsLike(query,MatchMode.Anywhere))
// use this
.WhereRestrictionOn(y => y.ORG_NAME)
.IsInsensitiveLike(query, MatchMode.Anywhere)