private void CreateDatabase3101() { CreateTestStore( "Repro3101", _fixture.ServiceProvider, (sp, co) => new MyContext3101(sp), context => { var c11 = new Child3101 { Name = "c11" }; var c12 = new Child3101 { Name = "c12" }; var c13 = new Child3101 { Name = "c13" }; var c21 = new Child3101 { Name = "c21" }; var c22 = new Child3101 { Name = "c22" }; var c31 = new Child3101 { Name = "c31" }; var c32 = new Child3101 { Name = "c32" }; context.Children.AddRange(c11, c12, c13, c21, c22, c31, c32); var e1 = new Entity3101 { Id = 1, Children = new[] { c11, c12, c13 } }; var e2 = new Entity3101 { Id = 2, Children = new[] { c21, c22 } }; var e3 = new Entity3101 { Id = 3, Children = new[] { c31, c32 } }; e2.RootEntity = e1; context.Entities.AddRange(e1, e2, e3); context.SaveChanges(); }); }
private static void Seed3101(MyContext3101 context) { var c11 = new Child3101 { Name = "c11" }; var c12 = new Child3101 { Name = "c12" }; var c13 = new Child3101 { Name = "c13" }; var c21 = new Child3101 { Name = "c21" }; var c22 = new Child3101 { Name = "c22" }; var c31 = new Child3101 { Name = "c31" }; var c32 = new Child3101 { Name = "c32" }; context.Children.AddRange(c11, c12, c13, c21, c22, c31, c32); var e1 = new Entity3101 { Id = 1, Children = new[] { c11, c12, c13 } }; var e2 = new Entity3101 { Id = 2, Children = new[] { c21, c22 } }; var e3 = new Entity3101 { Id = 3, Children = new[] { c31, c32 } }; e2.RootEntity = e1; context.Entities.AddRange(e1, e2, e3); context.SaveChanges(); }