我不明白为什么这个查询失败。
var qTags = from tagsU in _context.ADN_ProductTagsView
where !(from o in _context.ADN_ProductTagsView
where o.ProductID == productId
select o.ProductTagID).Contains(tagsU.ProductTagID)
select tagsU;
或者这个:
var tagAux = from o in _context.ADN_ProductTagsView
where o.ProductID == productId
select o.ProductTagID;
var qTags = from tagus in _context.ADN_ProductTagsView
where !tagAux.Contains(tagus.ProductTagID)
select tagus ;
两者都给我这个错误:
LINQ to Entities does not recognize the method 'Boolean Contains[Int32](System.Linq.IQueryable`1[System.Int32], Int32)' method, and this method cannot be translated into a store expression.
谁能帮我?
您正在使用的 QueryProvider 的实现似乎不完整。我不熟悉您正在使用的 QueryProvider,但也许您可以尝试这样的操作:
var qTags = from tagsU in _context.ADN_ProductTagsView
where !(from o in _context.ADN_ProductTagsView
where o.ProductID == productId
select o.ProductTagID).Any(tagId => tagId == tagsU.ProductTagID)
select tagsU;
希望有帮助
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)