mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 兼容 Vb.Net 无法使用 IncludeMany 的问题;#140
This commit is contained in:
		@@ -7,13 +7,33 @@ Namespace FreeSql.Tests.VB
 | 
				
			|||||||
        Sub TestSub()
 | 
					        Sub TestSub()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            REM VB.net <20><><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD>
 | 
					            REM VB.net <20><><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD>
 | 
				
			||||||
 | 
					            Dim id As Integer = 100
 | 
				
			||||||
            Dim List1 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Id = 100).ToList()
 | 
					            Dim List1 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Id = 100).ToList()
 | 
				
			||||||
            Dim List2 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Title = "xxx").ToList()
 | 
					            Dim List2 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Id = id).ToList()
 | 
				
			||||||
            Dim List3 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Title <> "xxx").ToList()
 | 
					            Dim List3 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Title = "xxx").ToList()
 | 
				
			||||||
 | 
					            Dim title As String = "xxx"
 | 
				
			||||||
 | 
					            Dim List4 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Title = title).ToList()
 | 
				
			||||||
 | 
					            Dim List5 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Title <> "xxx").ToList()
 | 
				
			||||||
 | 
					            Dim List6 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Title <> title).ToList()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Dim List4 = g.sqlserver.Select(Of Testvb).ToList(Function(a) New With {a, a.Id, a.Title})
 | 
					            Dim List7 = g.sqlserver.Select(Of Testvb).ToList(Function(a) New With {a, a.Id, a.Title})
 | 
				
			||||||
 | 
					            Dim List8 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.IsDeleted).ToList()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            g.sqlserver.Delete(Of Testvb2).Where("1=1").ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Delete(Of Testvb).Where("1=1").ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb With {.Id = 1, .Title = "title1"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb With {.Id = 2, .Title = "title2"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb With {.Id = 3, .Title = "title3"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb2 With {.Id = 1, .TestvbId = 1, .Context = "Context11"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb2 With {.Id = 2, .TestvbId = 1, .Context = "Context12"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb2 With {.Id = 3, .TestvbId = 1, .Context = "Context13"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb2 With {.Id = 4, .TestvbId = 2, .Context = "Context21"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb2 With {.Id = 5, .TestvbId = 2, .Context = "Context22"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					            g.sqlserver.Insert(New Testvb2 With {.Id = 6, .TestvbId = 3, .Context = "Context31"}).ExecuteAffrows()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Dim List9 = g.sqlserver.Select(Of Testvb).IncludeMany(Function(a) a.Testvb2s).ToList()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Dim List5 = g.sqlserver.Select(Of Testvb).Where(Function(a) a.IsDeleted).ToList()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        End Sub
 | 
					        End Sub
 | 
				
			||||||
    End Class
 | 
					    End Class
 | 
				
			||||||
@@ -23,4 +43,13 @@ Class Testvb
 | 
				
			|||||||
    Property Id As Integer
 | 
					    Property Id As Integer
 | 
				
			||||||
    Property Title As String
 | 
					    Property Title As String
 | 
				
			||||||
    Property IsDeleted As Boolean
 | 
					    Property IsDeleted As Boolean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Property Testvb2s As List(Of Testvb2)
 | 
				
			||||||
End Class
 | 
					End Class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Class Testvb2
 | 
				
			||||||
 | 
					    Property Id As Integer
 | 
				
			||||||
 | 
					    Property TestvbId As Integer
 | 
				
			||||||
 | 
					    Property Testvb As Testvb
 | 
				
			||||||
 | 
					    Property Context As String
 | 
				
			||||||
 | 
					End Class
 | 
				
			||||||
@@ -5,7 +5,7 @@ Public Class g
 | 
				
			|||||||
    Shared sqlserverLazy As Lazy(Of IFreeSql) = New Lazy(Of IFreeSql)(New Func(Of IFreeSql)(Function() New FreeSqlBuilder() _
 | 
					    Shared sqlserverLazy As Lazy(Of IFreeSql) = New Lazy(Of IFreeSql)(New Func(Of IFreeSql)(Function() New FreeSqlBuilder() _
 | 
				
			||||||
        .UseConnectionString(DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3") _
 | 
					        .UseConnectionString(DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3") _
 | 
				
			||||||
        .UseAutoSyncStructure(True) _
 | 
					        .UseAutoSyncStructure(True) _
 | 
				
			||||||
        .UseMonitorCommand(Sub(cmd) Trace.WriteLine("\r\n线程" & Thread.CurrentThread.ManagedThreadId & ": " & cmd.CommandText)) _
 | 
					        .UseMonitorCommand(Sub(cmd) Trace.WriteLine(vbCrLf & "线程" & Thread.CurrentThread.ManagedThreadId & ": " & cmd.CommandText)) _
 | 
				
			||||||
        .UseLazyLoading(True) _
 | 
					        .UseLazyLoading(True) _
 | 
				
			||||||
        .Build()))
 | 
					        .Build()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -386,6 +386,7 @@ namespace FreeSql.Internal.CommonProvider
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            var expBody = navigateSelector?.Body;
 | 
					            var expBody = navigateSelector?.Body;
 | 
				
			||||||
            if (expBody == null) return this;
 | 
					            if (expBody == null) return this;
 | 
				
			||||||
 | 
					            if (expBody.NodeType == ExpressionType.Convert) expBody = (expBody as UnaryExpression)?.Operand;
 | 
				
			||||||
            MethodCallExpression whereExp = null;
 | 
					            MethodCallExpression whereExp = null;
 | 
				
			||||||
            int takeNumber = 0;
 | 
					            int takeNumber = 0;
 | 
				
			||||||
            Expression<Func<TNavigate, TNavigate>> selectExp = null;
 | 
					            Expression<Func<TNavigate, TNavigate>> selectExp = null;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user