我正在使用Linq从上下文中检索数据。我正在尝试仅获取没有孙CategoryAttributeItemDescriptions
的父AttributeItems
项,其内部名称包含单词“Range - ”
下面的代码是我目前所在的位置。
var query = from caid in context.CategoryAttributeItemDescriptions
join cai in context.CategoryAttributeItems on caid.Id equals cai.CategoryAttributeItemDescriptionsId
join ai in context.AttributeItems on cai.AttributeId equals ai.Id
where caid.CategoryAttributeItems.Any(c => !c.AttributeItem.InternalName.Contains("Range -")) && caid.CategoryId ==element.Id
select caid;
问题在于,它仍然会返回与孙子女有内在联系的父母。有任何想法吗? 感谢
答案 0 :(得分:0)
听起来错误的逻辑。
此
caid.CategoryAttributeItems.Any(c => !c.AttributeItem.InternalName.Contains("Range -"))
根据您的要求应该
!caid.CategoryAttributeItems.Any(c => c.AttributeItem.InternalName.Contains("Range -"))
^ ^ ^
do not have with an internal name containing the word "Range -"