mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	补充 IncludeMany 变异向下两级单元测试
This commit is contained in:
		@@ -923,6 +923,15 @@ namespace FreeSql.Tests.MySql {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			public int model2111Idaaa { get; set; }
 | 
								public int model2111Idaaa { get; set; }
 | 
				
			||||||
			public string title { get; set; }
 | 
								public string title { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public List<TestInclude_OneToManyModel4> childs2 { get; set; }
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public class TestInclude_OneToManyModel4 {
 | 
				
			||||||
 | 
								[Column(IsIdentity = true)]
 | 
				
			||||||
 | 
								public int id { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public int model3333Id333 { get; set; }
 | 
				
			||||||
 | 
								public string title444 { get; set; }
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
@@ -932,17 +941,32 @@ namespace FreeSql.Tests.MySql {
 | 
				
			|||||||
			var model2 = new TestInclude_OneToManyModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
								var model2 = new TestInclude_OneToManyModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
				
			||||||
			g.mysql.Insert(model2).ExecuteAffrows();
 | 
								g.mysql.Insert(model2).ExecuteAffrows();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var model3s = new[] {
 | 
								var model3_1 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__111" };
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__111" },
 | 
								model3_1.id = (int)g.mysql.Insert(model3_1).ExecuteIdentity();
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__222" },
 | 
								var model3_2 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__222" };
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__333" }
 | 
								model3_2.id = (int)g.mysql.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
								var model3_3 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__333" };
 | 
				
			||||||
 | 
								model3_3.id = (int)g.mysql.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var model4s = new[] {
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__333" }
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
			Assert.Equal(3, g.mysql.Insert(model3s).ExecuteAffrows());
 | 
								Assert.Equal(5, g.mysql.Insert(model4s).ExecuteAffrows());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var t1 = g.mysql.Select<TestInclude_OneToManyModel1>()
 | 
								var t1 = g.mysql.Select<TestInclude_OneToManyModel1>()
 | 
				
			||||||
				.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
				
			||||||
				.Where(a => a.id <= model1.id)
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
				.ToList();
 | 
									.ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var t2 = g.mysql.Select<TestInclude_OneToManyModel1>()
 | 
				
			||||||
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id),
 | 
				
			||||||
 | 
										then => then.IncludeMany(m3 => m3.childs2.Where(m4 => m4.model3333Id333 == m3.id)))
 | 
				
			||||||
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
 | 
									.ToList();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
		public void Include_OneToChilds() {
 | 
							public void Include_OneToChilds() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -816,6 +816,15 @@ namespace FreeSql.Tests.Oracle {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			public int model2111Idaaa { get; set; }
 | 
								public int model2111Idaaa { get; set; }
 | 
				
			||||||
			public string title { get; set; }
 | 
								public string title { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public List<TiOtmModel4> childs2 { get; set; }
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public class TiOtmModel4 {
 | 
				
			||||||
 | 
								[Column(IsIdentity = true)]
 | 
				
			||||||
 | 
								public int id { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public int model3333Id333 { get; set; }
 | 
				
			||||||
 | 
								public string title444 { get; set; }
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
@@ -825,17 +834,32 @@ namespace FreeSql.Tests.Oracle {
 | 
				
			|||||||
			var model2 = new TiOtmModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
								var model2 = new TiOtmModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
				
			||||||
			g.oracle.Insert(model2).ExecuteAffrows();
 | 
								g.oracle.Insert(model2).ExecuteAffrows();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var model3s = new[] {
 | 
								var model3_1 = new TiOtmModel3 { model2111Idaaa = model1.id, title = "testmodel3__111" };
 | 
				
			||||||
				new TiOtmModel3{ model2111Idaaa = model1.id, title = "testmodel3__111" },
 | 
								model3_1.id = (int)g.oracle.Insert(model3_1).ExecuteIdentity();
 | 
				
			||||||
				new TiOtmModel3{ model2111Idaaa = model1.id, title = "testmodel3__222" },
 | 
								var model3_2 = new TiOtmModel3 { model2111Idaaa = model1.id, title = "testmodel3__222" };
 | 
				
			||||||
				new TiOtmModel3{ model2111Idaaa = model1.id, title = "testmodel3__333" }
 | 
								model3_2.id = (int)g.oracle.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
								var model3_3 = new TiOtmModel3 { model2111Idaaa = model1.id, title = "testmodel3__333" };
 | 
				
			||||||
 | 
								model3_3.id = (int)g.oracle.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var model4s = new[] {
 | 
				
			||||||
 | 
									new TiOtmModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TiOtmModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TiOtmModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TiOtmModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TiOtmModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__333" }
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
			Assert.Equal(3, g.oracle.Insert(model3s).ExecuteAffrows());
 | 
								Assert.Equal(5, g.oracle.Insert(model4s).ExecuteAffrows());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var t1 = g.oracle.Select<TiOtmModel1>()
 | 
								var t1 = g.oracle.Select<TiOtmModel1>()
 | 
				
			||||||
				.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
				
			||||||
				.Where(a => a.id <= model1.id)
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
				.ToList();
 | 
									.ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var t2 = g.oracle.Select<TiOtmModel1>()
 | 
				
			||||||
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id),
 | 
				
			||||||
 | 
										then => then.IncludeMany(m3 => m3.childs2.Where(m4 => m4.model3333Id333 == m3.id)))
 | 
				
			||||||
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
 | 
									.ToList();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
		public void Include_OneToChilds() {
 | 
							public void Include_OneToChilds() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -882,6 +882,15 @@ namespace FreeSql.Tests.PostgreSQL {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			public int model2111Idaaa { get; set; }
 | 
								public int model2111Idaaa { get; set; }
 | 
				
			||||||
			public string title { get; set; }
 | 
								public string title { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public List<TestInclude_OneToManyModel4> childs2 { get; set; }
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public class TestInclude_OneToManyModel4 {
 | 
				
			||||||
 | 
								[Column(IsIdentity = true)]
 | 
				
			||||||
 | 
								public int id { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public int model3333Id333 { get; set; }
 | 
				
			||||||
 | 
								public string title444 { get; set; }
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
@@ -891,17 +900,32 @@ namespace FreeSql.Tests.PostgreSQL {
 | 
				
			|||||||
			var model2 = new TestInclude_OneToManyModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
								var model2 = new TestInclude_OneToManyModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
				
			||||||
			g.pgsql.Insert(model2).ExecuteAffrows();
 | 
								g.pgsql.Insert(model2).ExecuteAffrows();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var model3s = new[] {
 | 
								var model3_1 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__111" };
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__111" },
 | 
								model3_1.id = (int)g.pgsql.Insert(model3_1).ExecuteIdentity();
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__222" },
 | 
								var model3_2 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__222" };
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__333" }
 | 
								model3_2.id = (int)g.pgsql.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
								var model3_3 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__333" };
 | 
				
			||||||
 | 
								model3_3.id = (int)g.pgsql.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var model4s = new[] {
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__333" }
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
			Assert.Equal(3, g.pgsql.Insert(model3s).ExecuteAffrows());
 | 
								Assert.Equal(5, g.pgsql.Insert(model4s).ExecuteAffrows());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var t1 = g.pgsql.Select<TestInclude_OneToManyModel1>()
 | 
								var t1 = g.pgsql.Select<TestInclude_OneToManyModel1>()
 | 
				
			||||||
				.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
				
			||||||
				.Where(a => a.id <= model1.id)
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
				.ToList();
 | 
									.ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var t2 = g.pgsql.Select<TestInclude_OneToManyModel1>()
 | 
				
			||||||
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id),
 | 
				
			||||||
 | 
										then => then.IncludeMany(m3 => m3.childs2.Where(m4 => m4.model3333Id333 == m3.id)))
 | 
				
			||||||
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
 | 
									.ToList();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
		public void Include_OneToChilds() {
 | 
							public void Include_OneToChilds() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -813,6 +813,15 @@ namespace FreeSql.Tests.SqlServer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			public int model2111Idaaa { get; set; }
 | 
								public int model2111Idaaa { get; set; }
 | 
				
			||||||
			public string title { get; set; }
 | 
								public string title { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public List<TestInclude_OneToManyModel4> childs2 { get; set; }
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public class TestInclude_OneToManyModel4 {
 | 
				
			||||||
 | 
								[Column(IsIdentity = true)]
 | 
				
			||||||
 | 
								public int id { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public int model3333Id333 { get; set; }
 | 
				
			||||||
 | 
								public string title444 { get; set; }
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
@@ -822,17 +831,32 @@ namespace FreeSql.Tests.SqlServer {
 | 
				
			|||||||
			var model2 = new TestInclude_OneToManyModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
								var model2 = new TestInclude_OneToManyModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
				
			||||||
			_sqlserverFixture.SqlServer.Insert(model2).ExecuteAffrows();
 | 
								_sqlserverFixture.SqlServer.Insert(model2).ExecuteAffrows();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var model3s = new[] {
 | 
								var model3_1 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__111" };
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__111" },
 | 
								model3_1.id = (int)_sqlserverFixture.SqlServer.Insert(model3_1).ExecuteIdentity();
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__222" },
 | 
								var model3_2 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__222" };
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__333" }
 | 
								model3_2.id = (int)_sqlserverFixture.SqlServer.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
								var model3_3 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__333" };
 | 
				
			||||||
 | 
								model3_3.id = (int)_sqlserverFixture.SqlServer.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var model4s = new[] {
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__333" }
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
			Assert.Equal(3, _sqlserverFixture.SqlServer.Insert(model3s).ExecuteAffrows());
 | 
								Assert.Equal(5, _sqlserverFixture.SqlServer.Insert(model4s).ExecuteAffrows());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var t1 = _sqlserverFixture.SqlServer.Select<TestInclude_OneToManyModel1>()
 | 
								var t1 = _sqlserverFixture.SqlServer.Select<TestInclude_OneToManyModel1>()
 | 
				
			||||||
				.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
				
			||||||
				.Where(a => a.id <= model1.id)
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
				.ToList();
 | 
									.ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var t2 = _sqlserverFixture.SqlServer.Select<TestInclude_OneToManyModel1>()
 | 
				
			||||||
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id),
 | 
				
			||||||
 | 
										then => then.IncludeMany(m3 => m3.childs2.Where(m4 => m4.model3333Id333 == m3.id)))
 | 
				
			||||||
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
 | 
									.ToList();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
		public void Include_OneToChilds() {
 | 
							public void Include_OneToChilds() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -779,6 +779,15 @@ namespace FreeSql.Tests.Sqlite {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			public int model2111Idaaa { get; set; }
 | 
								public int model2111Idaaa { get; set; }
 | 
				
			||||||
			public string title { get; set; }
 | 
								public string title { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public List<TestInclude_OneToManyModel4> childs2 { get; set; }
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public class TestInclude_OneToManyModel4 {
 | 
				
			||||||
 | 
								[Column(IsIdentity = true)]
 | 
				
			||||||
 | 
								public int id { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								public int model3333Id333 { get; set; }
 | 
				
			||||||
 | 
								public string title444 { get; set; }
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[Fact]
 | 
							[Fact]
 | 
				
			||||||
@@ -788,15 +797,30 @@ namespace FreeSql.Tests.Sqlite {
 | 
				
			|||||||
			var model2 = new TestInclude_OneToManyModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
								var model2 = new TestInclude_OneToManyModel2 { model2id = model1.id, m2setting = DateTime.Now.Second.ToString() };
 | 
				
			||||||
			g.sqlite.Insert(model2).ExecuteAffrows();
 | 
								g.sqlite.Insert(model2).ExecuteAffrows();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var model3s = new [] {
 | 
								var model3_1 = new TestInclude_OneToManyModel3 { model2111Idaaa = model1.id, title = "testmodel3__111" };
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__111" },
 | 
								model3_1.id = (int)g.sqlite.Insert(model3_1).ExecuteIdentity();
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__222" },
 | 
								var model3_2 =new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__222" };
 | 
				
			||||||
				new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__333" }
 | 
								model3_2.id = (int)g.sqlite.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
								var model3_3 = new TestInclude_OneToManyModel3{ model2111Idaaa = model1.id, title = "testmodel3__333" };
 | 
				
			||||||
 | 
								model3_3.id = (int)g.sqlite.Insert(model3_2).ExecuteIdentity();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var model4s = new[] {
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_1.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__111" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__222" },
 | 
				
			||||||
 | 
									new TestInclude_OneToManyModel4{ model3333Id333 = model3_2.id, title444 = "testmodel3_4__333" }
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
			Assert.Equal(3, g.sqlite.Insert(model3s).ExecuteAffrows());
 | 
								Assert.Equal(5, g.sqlite.Insert(model4s).ExecuteAffrows());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var t1 = g.sqlite.Select<TestInclude_OneToManyModel1>()
 | 
								var t1 = g.sqlite.Select<TestInclude_OneToManyModel1>()
 | 
				
			||||||
				.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id && m3.title == a.model2.m2setting))
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id))
 | 
				
			||||||
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
 | 
									.ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var t2 = g.sqlite.Select<TestInclude_OneToManyModel1>()
 | 
				
			||||||
 | 
									.IncludeMany(a => a.model2.childs.Where(m3 => m3.model2111Idaaa == a.model2.model2id),
 | 
				
			||||||
 | 
										then => then.IncludeMany(m3 => m3.childs2.Where(m4 => m4.model3333Id333 == m3.id)))
 | 
				
			||||||
				.Where(a => a.id <= model1.id)
 | 
									.Where(a => a.id <= model1.id)
 | 
				
			||||||
				.ToList();
 | 
									.ToList();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user