Skip to content

Commit 10c439f

Browse files
authored
Add the compiled models feature
1 parent fc395ef commit 10c439f

23 files changed

+6498
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Imports Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal
2+
Imports Microsoft.EntityFrameworkCore.Metadata
3+
4+
Namespace Design.AnnotationCodeGeneratorProvider
5+
6+
''' <summary>
7+
''' This is an internal API that supports the Entity Framework Core infrastructure and not subject to
8+
''' the same compatibility standards as public APIs. It may be changed or removed without notice in
9+
''' any release. You should only use it directly in your code with extreme caution and knowing that
10+
''' doing so can result in application failures when updating to a new Entity Framework Core release.
11+
''' </summary>
12+
Public Class CosmosVisualBasicRuntimeAnnotationCodeGenerator
13+
Inherits VisualBasicRuntimeAnnotationCodeGenerator
14+
''' <summary>
15+
''' This is an internal API that supports the Entity Framework Core infrastructure and not subject to
16+
''' the same compatibility standards as public APIs. It may be changed or removed without notice in
17+
''' any release. You should only use it directly in your code with extreme caution and knowing that
18+
''' doing so can result in application failures when updating to a new Entity Framework Core release.
19+
''' </summary>
20+
Public Sub New(vbHelper As IVisualBasicHelper)
21+
MyBase.New(vbHelper)
22+
End Sub
23+
24+
''' <inheritdoc />
25+
Public Overrides Sub Generate(model As IModel, parameters As VisualBasicRuntimeAnnotationCodeGeneratorParameters)
26+
Dim annotations = parameters.Annotations
27+
If Not parameters.IsRuntime Then
28+
annotations.Remove(CosmosAnnotationNames.Throughput)
29+
End If
30+
31+
MyBase.Generate(model, parameters)
32+
End Sub
33+
34+
''' <inheritdoc />
35+
Public Overrides Sub Generate(entityType As IEntityType, parameters As VisualBasicRuntimeAnnotationCodeGeneratorParameters)
36+
37+
If Not parameters.IsRuntime Then
38+
With parameters.Annotations
39+
.Remove(CosmosAnnotationNames.AnalyticalStoreTimeToLive)
40+
.Remove(CosmosAnnotationNames.DefaultTimeToLive)
41+
.Remove(CosmosAnnotationNames.Throughput)
42+
End With
43+
End If
44+
45+
MyBase.Generate(entityType, parameters)
46+
End Sub
47+
48+
End Class
49+
End Namespace
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Imports Microsoft.EntityFrameworkCore.Design
2+
Imports Microsoft.Extensions.DependencyInjection
3+
4+
Namespace Design.AnnotationCodeGeneratorProvider
5+
<VisualBasicDesignTimeProviderServices(CosmosVisualBasicServices.ProviderName)>
6+
Public Class CosmosVisualBasicServices
7+
Implements IDesignTimeServices
8+
9+
Public Const ProviderName = "Microsoft.EntityFrameworkCore.Cosmos"
10+
11+
Public Sub ConfigureDesignTimeServices(services As IServiceCollection) Implements IDesignTimeServices.ConfigureDesignTimeServices
12+
services.AddSingleton(Of IVisualBasicRuntimeAnnotationCodeGenerator, CosmosVisualBasicRuntimeAnnotationCodeGenerator)
13+
End Sub
14+
End Class
15+
End Namespace
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Namespace Design.AnnotationCodeGeneratorProvider
2+
3+
''' <summary>
4+
''' This is an internal API that supports the Entity Framework Core infrastructure and not subject to
5+
''' the same compatibility standards as public APIs. It may be changed or removed without notice in
6+
''' any release. You should only use it directly in your code with extreme caution and knowing that
7+
''' doing so can result in application failures when updating to a new Entity Framework Core release.
8+
''' </summary>
9+
Public Class InMemoryVisualBasicRuntimeAnnotationCodeGenerator
10+
Inherits VisualBasicRuntimeAnnotationCodeGenerator
11+
''' <summary>
12+
''' This is an internal API that supports the Entity Framework Core infrastructure and not subject to
13+
''' the same compatibility standards as public APIs. It may be changed or removed without notice in
14+
''' any release. You should only use it directly in your code with extreme caution and knowing that
15+
''' doing so can result in application failures when updating to a new Entity Framework Core release.
16+
''' </summary>
17+
Public Sub New(vbHelper As IVisualBasicHelper)
18+
MyBase.New(vbHelper)
19+
End Sub
20+
End Class
21+
End Namespace
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Imports Microsoft.EntityFrameworkCore.Design
2+
Imports Microsoft.Extensions.DependencyInjection
3+
4+
Namespace Design.AnnotationCodeGeneratorProvider
5+
<VisualBasicDesignTimeProviderServices(InMemoryVisualBasicServices.ProviderName)>
6+
Public Class InMemoryVisualBasicServices
7+
Implements IDesignTimeServices
8+
9+
Public Const ProviderName = "Microsoft.EntityFrameworkCore.InMemory"
10+
11+
Public Sub ConfigureDesignTimeServices(services As IServiceCollection) Implements IDesignTimeServices.ConfigureDesignTimeServices
12+
services.AddSingleton(Of IVisualBasicRuntimeAnnotationCodeGenerator, InMemoryVisualBasicRuntimeAnnotationCodeGenerator)
13+
End Sub
14+
End Class
15+
End Namespace

0 commit comments

Comments
 (0)