queryover和(x代表'a'或y代表'a')

编程入门 行业动态 更新时间:2024-10-13 00:37:23
本文介绍了queryover和(x代表'a'或y代表'a')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨 当我使用queryover API时,是否有任何优雅的方式将"like"和"or"组合在一起? 对于喜欢",有类似的东西:

Hi Is there any elegant way of combining 'like' and 'or' when i'm using queryover API? for 'like' there is something like:

query.WhereRestrictionOn(x=>x.Code).IsLike(codePart)

对于或",我可以做类似的事情:

for 'or' i can do something like:

query.Where( x=>x.Code == codePart || x.Description== codePart)

但是如何创建这样的查询:

but how can I create a query like this:

从n中选择*,其中代码类似于 '%abc%'或类似'%abc%'的描述

select * from n where code like '%abc%' or description like '%abc%'

推荐答案

query.Where(Restrictions.On<Type>(x => x.Code).IsLike(codePart) || Restrictions.On<Type>(x => x.Description).IsLike(codePart))

更多推荐

queryover和(x代表'a'或y代表'a')

本文发布于:2023-11-22 01:47:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1615499.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代表   queryover

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!