- 增加 ISelect.ToTreeList 扩展方法查询数据,加工为树型 List;(注意:实体需要配置父子导航属性)

This commit is contained in:
28810
2020-03-15 18:33:15 +08:00
parent 529be7d9d2
commit 0effad75e4
7 changed files with 232 additions and 86 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>FreeSql.Tests.VB</RootNamespace>
@ -15,6 +15,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Extensions\FreeSql.Extensions.BaseEntity\FreeSql.Extensions.BaseEntity.csproj" />
<ProjectReference Include="..\Extensions\FreeSql.Extensions.LazyLoading\FreeSql.Extensions.LazyLoading.csproj" />
<ProjectReference Include="..\FreeSql.DbContext\FreeSql.DbContext.csproj" />
<ProjectReference Include="..\Providers\FreeSql.Provider.SqlServer\FreeSql.Provider.SqlServer.csproj" />

View File

@ -1,4 +1,5 @@
Imports System
Imports FreeSql.DataAnnotations
Imports Xunit
Namespace FreeSql.Tests.VB
@ -38,6 +39,17 @@ Namespace FreeSql.Tests.VB
Dim List9 = g.sqlserver.Select(Of Testvb).IncludeMany(Function(a) a.Testvb2s).ToList()
BaseEntity.Initialization(g.sqlserver)
Dim cowR As CowRecord = New CowRecord
cowR.Id = 1
cowR.Lact = 1
cowR.VetCount = 1
cowR.Save()
cowR.VetCount += 1
cowR.Update()
End Sub
End Class
@ -57,4 +69,53 @@ Class Testvb2
Property TestvbId As Integer
Property Testvb As Testvb
Property Context As String
End Class
End Class
<Index("uk_Primary", "Id,Lact", True)>
Public Class CowRecord
Inherits BaseEntity(Of CowRecord)
Private _Id As Integer
Private _Lact As Integer
Private _Pen As Integer
Private _BDAT As Date?
Private _FDAT As Date?
Private _DDAT As Date?
Private _EDAT As Date?
Private _ARDAT As Date?
Private _MKDAT As Date?
Private _BFDAT As Date?
Private _USDAT As Date?
Private _RC As Integer
Private _DMLK1 As Integer
Private _VetCount As Integer
<Column(IsPrimary:=True)>
Public Property Id As Integer
Get
Return _Id
End Get
Set(value As Integer)
_Id = value
End Set
End Property
<Column(IsPrimary:=True)>
Public Property Lact As Integer
Get
Return _Lact
End Get
Set(value As Integer)
_Lact = value
End Set
End Property
Public Property VetCount As Integer
Get
Return _VetCount
End Get
Set(value As Integer)
_VetCount = value
End Set
End Property
End Class