如何使用"包含"或QUOT;像"在一个动态的LINQ查询? [英] How to use "contains" or "like" in a dynamic linq query?

查看:371
本文介绍了如何使用"包含"或QUOT;像"在一个动态的LINQ查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随动态的LINQ在CSharpSamples.zip帮助文件没有显示使用包含或喜欢的任何实例。

The help file that came with Dynamic Linq in the CSharpSamples.zip does not show any examples of using contains or like.

有没有简单的解决方法这样做呢?即其中(COL像@col)无法正常工作。

Are there any simple workarounds for doing this? i.e where (col like @col) doesn't work.

推荐答案

下面就是答案!动态LINQ的不支持。运营商,

Here is the answer! The Dynamic Linq does support the . operator,

根据文档:

实例字段或实例属性   访问。任何公共字段或属性   可以被访问。

"Instance field or instance property access. Any public field or property can be accessed."

因此​​,有可能使用该语法

Thus, it is possible to use this syntax

.Where("MyColumn.Contains(@0)", myArray)

感谢所有的建议!还要感谢我要寻找的解决方案。

Thanks for all the suggestions! And thanks to me for finding the solution.

这篇关于如何使用"包含"或QUOT;像"在一个动态的LINQ查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆