Skip to content

Commit 2cced20

Browse files
authored
Initialize skip collection navigations
1 parent 10c439f commit 2cced20

File tree

7 files changed

+51
-23
lines changed

7 files changed

+51
-23
lines changed

EFCore.VisualBasic/EFCore.VisualBasic.vbproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@
4646
</ItemGroup>
4747

4848
<ItemGroup>
49-
<PackageReference Include="Microsoft.EntityFrameworkCore.Cosmos" Version="6.0.0-rtm.21474.9">
49+
<PackageReference Include="Microsoft.EntityFrameworkCore.Cosmos" Version="6.0.0-rc.2.21480.5">
5050
<PrivateAssets>all</PrivateAssets>
5151
<IncludeAssets>all</IncludeAssets>
5252
</PackageReference>
53-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0-rtm.21474.9">
53+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0-rc.2.21480.5">
5454
<PrivateAssets>all</PrivateAssets>
5555
<IncludeAssets>all</IncludeAssets>
5656
</PackageReference>
57-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="6.0.0-rtm.21474.9">
57+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="6.0.0-rc.2.21480.5">
5858
<PrivateAssets>all</PrivateAssets>
5959
<IncludeAssets>all</IncludeAssets>
6060
</PackageReference>
61-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rtm.21474.9">
61+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rc.2.21480.5">
6262
<PrivateAssets>all</PrivateAssets>
6363
<IncludeAssets>all</IncludeAssets>
6464
</PackageReference>

EFCore.VisualBasic/Scaffolding/Internal/VisualBasicDbContextGenerator.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Namespace Scaffolding.Internal
175175

176176
For Each entityType In model.GetEntityTypes()
177177
If IsManyToManyJoinEntityType(entityType) Then Continue For
178-
_builder.AppendLine($"Public Overridable Property {entityType.GetDbSetName()} As DbSet(Of {entityType.Name})")
178+
_builder.AppendLine($"Public Overridable Property {_VBCode.Identifier(entityType.GetDbSetName())} As DbSet(Of {entityType.Name})")
179179
generated = True
180180
Next
181181

EFCore.VisualBasic/Scaffolding/Internal/VisualBasicEntityTypeGenerator.vb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,11 @@ Namespace Scaffolding.Internal
183183
Protected Overridable Sub GenerateConstructor(entityType As IEntityType)
184184
NotNull(entityType, NameOf(entityType))
185185

186-
Dim collectionNavigations = entityType.GetNavigations().Where(Function(n) n.IsCollection).ToList()
186+
Dim collectionNavigations = entityType.GetDeclaredNavigations().
187+
Cast(Of INavigationBase)().
188+
Concat(entityType.GetDeclaredSkipNavigations()).
189+
Where(Function(n) n.IsCollection).
190+
ToList()
187191

188192
If collectionNavigations.Count > 0 Then
189193
_sb.AppendLine($"Public Sub New()")
@@ -402,7 +406,7 @@ Namespace Scaffolding.Internal
402406
Dim referencedTypeName = navigation.TargetEntityType.Name
403407
Dim navigationType = If(navigation.IsCollection, $"ICollection(Of {referencedTypeName})", referencedTypeName)
404408

405-
_sb.AppendLine($"Public Overridable Property {navigation.Name} As {navigationType}")
409+
_sb.AppendLine($"Public Overridable Property {_code.Identifier(navigation.Name)} As {navigationType}")
406410
Next
407411
End If
408412
End Sub

Sandbox/Sandbox.vbproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0-rtm.21474.9" />
12-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0-rtm.21474.9" />
13-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rtm.21474.9" />
14-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0-rtm.21474.9">
11+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0-rc.2.21480.5" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0-rc.2.21480.5" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rc.2.21480.5" />
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0-rc.2.21480.5">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>

Test/EFCore.Design.Tests.Shared/EFCore.Design.Tests.Shared.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0-rtm.21474.9" />
10-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="6.0.0-rtm.21474.9" />
9+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0-rc.2.21480.5" />
10+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="6.0.0-rc.2.21480.5" />
1111
</ItemGroup>
1212

1313
</Project>

Test/EFCore.VisualBasic.Test/EFCore.VisualBasic.Test.vbproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="3.10.0" />
22-
<PackageReference Include="Microsoft.EntityFrameworkCore.Cosmos" Version="6.0.0-rtm.21474.9" />
23-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0-rtm.21474.9">
21+
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="3.11.0" />
22+
<PackageReference Include="Microsoft.EntityFrameworkCore.Cosmos" Version="6.0.0-rc.2.21480.5" />
23+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0-rc.2.21480.5">
2424
<PrivateAssets>all</PrivateAssets>
2525
<IncludeAssets>all</IncludeAssets>
2626
</PackageReference>
27-
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0-rtm.21474.9" />
28-
<PackageReference Include="Microsoft.EntityFrameworkCore.Specification.Tests" Version="6.0.0-rtm.21474.9" />
29-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0-rtm.21474.9" />
30-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite" Version="6.0.0-rtm.21474.9" />
31-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rtm.21474.9" />
32-
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="6.0.0-rtm.21474.5" />
33-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
27+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0-rc.2.21480.5" />
28+
<PackageReference Include="Microsoft.EntityFrameworkCore.Specification.Tests" Version="6.0.0-rc.2.21480.5" />
29+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0-rc.2.21480.5" />
30+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite" Version="6.0.0-rc.2.21480.5" />
31+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rc.2.21480.5" />
32+
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="6.0.0-rc.2.21480.5" />
33+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
3434
<PackageReference Include="xunit" Version="2.4.1" />
3535
<PackageReference Include="xunit.runner.console" Version="2.4.1">
3636
<PrivateAssets>all</PrivateAssets>

Test/EFCore.VisualBasic.Test/Scaffolding/Internal/VisualBasicEntityTypeGeneratorTest.vb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,10 @@ End Namespace
17741774
Dim expectedEntityCode1 =
17751775
"Namespace TestNamespace
17761776
Public Partial Class Blog
1777+
Public Sub New()
1778+
Posts = New HashSet(Of Post)()
1779+
End Sub
1780+
17771781
Public Property Id As Integer
17781782

17791783
Public Overridable Property Posts As ICollection(Of Post)
@@ -1784,6 +1788,10 @@ End Namespace
17841788
Dim expectedEntityCode2 =
17851789
"Namespace TestNamespace
17861790
Public Partial Class Post
1791+
Public Sub New()
1792+
Blogs = New HashSet(Of Blog)()
1793+
End Sub
1794+
17871795
Public Property Id As Integer
17881796

17891797
Public Overridable Property Blogs As ICollection(Of Blog)
@@ -1911,6 +1919,10 @@ End Namespace
19111919
Dim expectedEntityBlog =
19121920
"Namespace TestNamespace
19131921
Public Partial Class Blog
1922+
Public Sub New()
1923+
Posts = New HashSet(Of Post)()
1924+
End Sub
1925+
19141926
Public Property Id As Integer
19151927

19161928
Public Overridable Property Posts As ICollection(Of Post)
@@ -1920,6 +1932,10 @@ End Namespace
19201932
Dim expectedEntityPost =
19211933
"Namespace TestNamespace
19221934
Public Partial Class Post
1935+
Public Sub New()
1936+
Blogs = New HashSet(Of Blog)()
1937+
End Sub
1938+
19231939
Public Property Id As String
19241940

19251941
Public Overridable Property Blogs As ICollection(Of Blog)
@@ -2043,6 +2059,10 @@ Imports Microsoft.EntityFrameworkCore
20432059

20442060
Namespace TestNamespace
20452061
Public Partial Class Blog
2062+
Public Sub New()
2063+
Posts = New HashSet(Of Post)()
2064+
End Sub
2065+
20462066
<Key>
20472067
Public Property Id As Integer
20482068

@@ -2060,6 +2080,10 @@ Imports Microsoft.EntityFrameworkCore
20602080

20612081
Namespace TestNamespace
20622082
Public Partial Class Post
2083+
Public Sub New()
2084+
Blogs = New HashSet(Of Blog)()
2085+
End Sub
2086+
20632087
<Key>
20642088
Public Property Id As Integer
20652089

0 commit comments

Comments
 (0)