コード例 #1
0
 private void Seed5456(MyContext5456 context)
 {
     for (var i = 0; i < 100; i++)
     {
         context.Add(
             new Blog5456
         {
             Id    = i + 1,
             Posts = new List <Post5456>
             {
                 new Post5456
                 {
                     Comments = new List <Comment5456>
                     {
                         new Comment5456(),
                         new Comment5456()
                     }
                 },
                 new Post5456()
             },
             Author = new Author5456()
         });
     }
     context.SaveChanges();
 }
コード例 #2
0
        public virtual void Repro5456_multi_level_include_group_join_is_per_query_context_async()
        {
            using (CreateScratch <MyContext5456>(Seed5456))
            {
                Parallel.For(0, 10, async i =>
                {
                    using (var ctx = new MyContext5456())
                    {
                        var result = await ctx.Posts.Where(x => x.Blog.Id > 1).Include(x => x.Blog).ThenInclude(b => b.Author).ToListAsync();

                        Assert.Equal(198, result.Count);
                    }
                });
            }
        }
コード例 #3
0
        public virtual void Repro5456_multiple_include_group_join_is_per_query_context()
        {
            using (CreateScratch <MyContext5456>(Seed5456))
            {
                Parallel.For(0, 10, i =>
                {
                    using (var ctx = new MyContext5456())
                    {
                        var result = ctx.Posts.Where(x => x.Blog.Id > 1).Include(x => x.Blog).Include(x => x.Comments).ToList();

                        Assert.Equal(198, result.Count);
                    }
                });
            }
        }