c# – 实体框架6 – 选择孩子平等的父母
发布时间:2020-12-16 00:11:06 所属栏目:百科 来源:网络整理
导读:我只需要Parent对象.在SQL中,这很简单: select distinct * from parent join child on child.ParentID = Parent.ID where child.playssoccer = true; 在实体框架6中,这似乎将原子分裂给我. 我需要新的p = parent.children.playssoccer = true的父级. 如何从
我只需要Parent对象.在SQL中,这很简单:
select distinct * from parent join child on child.ParentID = Parent.ID where child.playssoccer = true; 在实体框架6中,这似乎将原子分裂给我. 我需要新的p => parent.children.playssoccer = true的父级. 如何从类似的EF6 DBContext中获取足球父母? 解决方法from p in context.Parents where p.Children.Any(c => c.PlaySoccer == true) select p 这假设您希望父母至少有一个孩子踢足球. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |