gpt4 book ai didi

c# - LINQ 加入多个 AND 条件

转载 作者:太空狗 更新时间:2023-10-29 20:43:34 25 4
gpt4 key购买 nike

我想通过 LINQ 联接在我的 MVC 应用程序中联接两个实体以进行数据处理。

为此,我正在尝试编写如下查询

from enumeration in db.Enumerations
join cust in db.Customers on ( enumeration.Value equals cust.lkpStatus &&
enumeration.EnumerationTypeID.Contains('Cust')

但是我遇到了这个查询的问题,所以请给我一些建议。

最佳答案

加入应该是这样的:

var joinQuery =
from t1 in Table1
join t2 in Table2
on new { t1.Column1, t1.Column2 } equals new { t2.Column1, t2.Column2 }
...

关于c# - LINQ 加入多个 AND 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19722555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com