condition in include in linq to entities

后端 未结 1 697
长发绾君心
长发绾君心 2021-01-13 15:31

I\'ve got this really basic table structure:

Posts

PostXTags

PostTags

There is a 1-n relation between Posts, PostXTags and between PostTags,

相关标签:
1条回答
  • 2021-01-13 16:31

    I think what you are trying to achieve is

    var posts = _db.Posts.Include("PostXTags.PostTag").
        Where(p => p.PostXTags.Any( pxt => pxt.PostTags.Any( pt => pt.Type == 2 ) ));
    
    0 讨论(0)
提交回复
热议问题