Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 在VB中使用OR运算符动态生成LINQ查询_Vb.net_Linq_Predicate - Fatal编程技术网

Vb.net 在VB中使用OR运算符动态生成LINQ查询

Vb.net 在VB中使用OR运算符动态生成LINQ查询,vb.net,linq,predicate,Vb.net,Linq,Predicate,我需要使用or运算符构建一个动态linq查询。我看过PredicateBuilder,但那是用C语言编写的,我的项目是用VB编写的。基本上,我需要构建一个类似以下内容的WHERE子句: Where((this = 1 AND that = 2) OR (this = 1 AND that = 4) OR (this = 2 AND that = 4)) 但问题是,数字必须在运行时动态确定,并使用循环添加,如 for each item in myItems query = query.

我需要使用or运算符构建一个动态linq查询。我看过PredicateBuilder,但那是用C语言编写的,我的项目是用VB编写的。基本上,我需要构建一个类似以下内容的WHERE子句:

Where((this = 1 AND that = 2) OR (this = 1 AND that = 4) OR (this = 2 AND that = 4))
但问题是,数字必须在运行时动态确定,并使用循环添加,如

for each item in myItems
    query = query.OR (this = item.a AND this = item.b)
next

我怎么能这样做呢?

你看过了吗?

你看过了吗?

让LinqKit.dll正常工作,现在甚至在我的VB项目中也使用PredicateBuilder,它工作得非常好


对于需要此功能的其他人,请参阅关于如何实现此功能的非常好的文章。

使LinqKit.dll正常工作,现在即使在我的VB项目中也使用PredicateBuilder,它工作得非常好


对于其他需要此功能的人,请参阅关于如何实现此功能的非常好的文章。

是的,我知道这一点,但我认为它不能真正满足我的需要,我必须使用连接动态构建sql,这是我的客户非常不需要的。实际上我刚刚让linqkit和predicatebuilder工作!是的,我意识到了这一点,但我并不认为它真的满足了我的需要,我必须使用连接动态地构建sql,这是我的客户端非常不需要的。实际上我刚刚让linqkit和predicatebuilder工作!