Cannot implicitly convert type System.Collections.Generic.IEnumerable<> to bool

前端 未结 2 1229
长情又很酷
长情又很酷 2020-12-18 05:05

I\'m developing an ASP.NET MVC 4 Application and I\'m trying to run this Lambda expression in Entity Framework 5.

var customer = db.GNL_Customer.Where(d =>         


        
2条回答
  •  离开以前
    2020-12-18 05:35

    You might want another .Any instead of a .Where in your .Any clause at the end:

    var customer = db.GNL_Customer.Where(d => d.GNL_City.FKProvinceID == advancedProvinceID || advancedProvinceID == null)
                .Where(d => d.FKCityID == advancedCityID || advancedCityID == null)
                .Where(d => d.FKDepartmentStoreID == advancedDepartmentStoreID || advancedDepartmentStoreID == null)
                .Any(d => d.GNL_CustomerLaptopProduct.Any(r => String.Compare(r.BrandName, brandID) == 0 || brandID == null));
    

提交回复
热议问题