我有一个像Dictionary<int,int>
这样的基本字典,想要将它与我在dbset上的where子句进行比较。我尝试了下面的内容,但是我无法将其删除。我使用Tuple<int,int>
代替在字典中,它抛出异常&#34;在此上下文中仅支持原始类型或枚举类型。&#34;
public IEnumerable<Tuple<string,string,decimal>> CrossSellingCheck(Dictionary<int,int> idS)
if (idS.Count == 0) return null;
var temp = db.CrossSellings //these lines
.Where(m => idS.Any(a=> a.Key==m.MainProductId && a.Value==m.MainProductQuantity)); //these lines
if (temp.Any()) return null;
return db.Products.Include(i => i.productimagelist)
.Where(p => temp.Select(m => m.SubProductId).Contains(p.ProductId)).AsEnumerable()
.Select(item => new Tuple<string, string, decimal>(
item.productimagelist.First().ThumbUrl,
item.Name,
temp.Single(z => z.SubProductId == item.ProductId).DiscountRate)));