EF 6加载嵌套实体

时间:2016-11-17 09:47:33

标签: c# entity-framework

我嵌套了来自msdn的示例。

var blogs1 = context.Blogs 
                   .Include(b => b.Posts.Select(p => p.Comments)) 
                   .ToList(); 

但就我而言,Comment的结构如下:

public class Comment
{
    public List<User> ViewedUsers { get; set; };
}

如果方法.ThenInclude()不可用,我如何在这种情况下加载ViewedUsers?我的意思是新的嵌套entites层。

1 个答案:

答案 0 :(得分:0)

在这种情况下,我需要使用下一个声明:

OPEN curseur2;
            LOOP2: LOOP
                SET no_more_rows = FALSE;
                FETCH curseur2 INTO @a, @b, @c;
                IF no_more_rows THEN
                    CLOSE curseur2;
                    LEAVE LOOP2;
                END IF;

                EXECUTE stmtCountBrut USING @a,@b,@c;
相关问题