结合几个表达式< func< t,bool>
我有5个表达式< func< t,bool>在Azure存储表中过滤数据。我需要将所有这些结合起来。
Expression<Func<T,bool>> x = (e => e.a < value))
Expression<Func<T,bool>> y = ...
Expression<Func<T,bool>> z = ...
Expression<Func<T,bool>> a = ...
Expression<Func<T,bool>> b =..
现实中的表达很复杂,因此用大量或很难阅读和理解一个表达。所以我写了5个表情。现在我需要做类似的事情:(
b and((x and y)或(z and a)))
x和y,z以及以下方式进行
var XYcombined = Expression.And(Expression.Invoke(x,parameter), Expression.Invoke(y,parameter)
var ZAcombined = Expression.And(Expression.Invoke(z,parameter), Expression.Invoke(a,parameter)
var ORcombined = Expression.Or(XYcombined, ZAcombined)
我已经按照 表达式,我尝试使用表达式和表达式和表达,但是Azure返回HTTP 500。
I have 5 Expression<Func<T,bool> to filter data in Azure storage table. I need to combine all of them.
Expression<Func<T,bool>> x = (e => e.a < value))
Expression<Func<T,bool>> y = ...
Expression<Func<T,bool>> z = ...
Expression<Func<T,bool>> a = ...
Expression<Func<T,bool>> b =..
Expression in reality are complex, so writing one expression with lot of or,and will be difficult to read and understand. So I wrote 5 expression. Now I need to do something like this :
(b and ((x and y) or (z and a)))
I already did x and y, z and a in following way :
var XYcombined = Expression.And(Expression.Invoke(x,parameter), Expression.Invoke(y,parameter)
var ZAcombined = Expression.And(Expression.Invoke(z,parameter), Expression.Invoke(a,parameter)
var ORcombined = Expression.Or(XYcombined, ZAcombined)
now I need to somehow combine ORcombined with one more expression, I tried to use Expression.And and Expression.AndAlso, but azure returns http 500.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论