Linq Join With Include Statement

后端 未结 2 1981
鱼传尺愫
鱼传尺愫 2021-02-19 06:07
IQueryable emps = CreateObjectSet()
                                  .Include(u => u.Departments)
                                  .         


        
2条回答
  •  借酒劲吻你
    2021-02-19 06:25

    This is a known issue with include. You could have a look at the following article Include in EF

    > var results =
    >         ((from post in ctx.Posts
    >         from blog in post.Blogs
    >         where blog.Owner.EmailAddress == “alexj@microsoft.com”
    >         select post) as ObjectQuery).Include(“Comments”);
    

    If that solution won't work for you, you can also try to fix it with grouping your data and selecting the departments as one of the values in your type.

    The EF entity relation fixup mechanism will then 'fix' the include for you.

提交回复
热议问题