LINQ Where with AND OR condition

后端 未结 3 1326
轮回少年
轮回少年 2021-02-12 01:22

So I have managed to get this query working

List listStatus = new List() ; 
listStatus.add(\"Text1\");

List listMercha         


        
3条回答
  •  滥情空心
    2021-02-12 01:55

    Well, you're going to have to check for null somewhere. You could do something like this:

    from item in db.vw_Dropship_OrderItems
             where (listStatus == null || listStatus.Contains(item.StatusCode)) 
                && (listMerchants == null || listMerchants.Contains(item.MerchantId))
             select item;
    

提交回复
热议问题