Db: Use precompiled model
This commit is contained in:
parent
8a27eca8b3
commit
efeb30331c
123
Pal.Client/Database/Compiled/ClientLocationEntityType.cs
Normal file
123
Pal.Client/Database/Compiled/ClientLocationEntityType.cs
Normal file
@ -0,0 +1,123 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
#pragma warning disable 219, 612, 618
|
||||
#nullable enable
|
||||
|
||||
namespace Pal.Client.Database.Compiled
|
||||
{
|
||||
internal partial class ClientLocationEntityType
|
||||
{
|
||||
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? baseEntityType = null)
|
||||
{
|
||||
var runtimeEntityType = model.AddEntityType(
|
||||
"Pal.Client.Database.ClientLocation",
|
||||
typeof(ClientLocation),
|
||||
baseEntityType);
|
||||
|
||||
var localId = runtimeEntityType.AddProperty(
|
||||
"LocalId",
|
||||
typeof(int),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("LocalId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<LocalId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
valueGenerated: ValueGenerated.OnAdd,
|
||||
afterSaveBehavior: PropertySaveBehavior.Throw);
|
||||
|
||||
var seen = runtimeEntityType.AddProperty(
|
||||
"Seen",
|
||||
typeof(bool),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("Seen", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<Seen>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var sinceVersion = runtimeEntityType.AddProperty(
|
||||
"SinceVersion",
|
||||
typeof(string),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("SinceVersion", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<SinceVersion>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var source = runtimeEntityType.AddProperty(
|
||||
"Source",
|
||||
typeof(ClientLocation.ESource),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("Source", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<Source>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var territoryType = runtimeEntityType.AddProperty(
|
||||
"TerritoryType",
|
||||
typeof(ushort),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("TerritoryType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<TerritoryType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var type = runtimeEntityType.AddProperty(
|
||||
"Type",
|
||||
typeof(ClientLocation.EType),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<Type>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var x = runtimeEntityType.AddProperty(
|
||||
"X",
|
||||
typeof(float),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("X", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<X>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var y = runtimeEntityType.AddProperty(
|
||||
"Y",
|
||||
typeof(float),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("Y", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<Y>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var z = runtimeEntityType.AddProperty(
|
||||
"Z",
|
||||
typeof(float),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("Z", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<Z>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var key = runtimeEntityType.AddKey(
|
||||
new[] { localId });
|
||||
runtimeEntityType.SetPrimaryKey(key);
|
||||
|
||||
return runtimeEntityType;
|
||||
}
|
||||
|
||||
public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType declaringEntityType, RuntimeEntityType targetEntityType, RuntimeEntityType joinEntityType)
|
||||
{
|
||||
var skipNavigation = declaringEntityType.AddSkipNavigation(
|
||||
"ImportedBy",
|
||||
targetEntityType,
|
||||
joinEntityType.FindForeignKey(
|
||||
new[] { joinEntityType.FindProperty("ImportedLocationsLocalId")! },
|
||||
declaringEntityType.FindKey(new[] { declaringEntityType.FindProperty("LocalId")! })!,
|
||||
declaringEntityType)!,
|
||||
true,
|
||||
false,
|
||||
typeof(List<ImportHistory>),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("ImportedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<ImportedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var inverse = targetEntityType.FindSkipNavigation("ImportedLocations");
|
||||
if (inverse != null)
|
||||
{
|
||||
skipNavigation.Inverse = inverse;
|
||||
inverse.Inverse = skipNavigation;
|
||||
}
|
||||
|
||||
return skipNavigation;
|
||||
}
|
||||
|
||||
public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
|
||||
{
|
||||
runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:Schema", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:TableName", "Locations");
|
||||
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
|
||||
|
||||
Customize(runtimeEntityType);
|
||||
}
|
||||
|
||||
static partial void Customize(RuntimeEntityType runtimeEntityType);
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
#pragma warning disable 219, 612, 618
|
||||
#nullable enable
|
||||
|
||||
namespace Pal.Client.Database.Compiled
|
||||
{
|
||||
internal partial class ClientLocationImportHistoryEntityType
|
||||
{
|
||||
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? baseEntityType = null)
|
||||
{
|
||||
var runtimeEntityType = model.AddEntityType(
|
||||
"ClientLocationImportHistory",
|
||||
typeof(Dictionary<string, object>),
|
||||
baseEntityType,
|
||||
sharedClrType: true,
|
||||
indexerPropertyInfo: RuntimeEntityType.FindIndexerProperty(typeof(Dictionary<string, object>)),
|
||||
propertyBag: true);
|
||||
|
||||
var importedById = runtimeEntityType.AddProperty(
|
||||
"ImportedById",
|
||||
typeof(Guid),
|
||||
propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(),
|
||||
afterSaveBehavior: PropertySaveBehavior.Throw);
|
||||
|
||||
var importedLocationsLocalId = runtimeEntityType.AddProperty(
|
||||
"ImportedLocationsLocalId",
|
||||
typeof(int),
|
||||
propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(),
|
||||
afterSaveBehavior: PropertySaveBehavior.Throw);
|
||||
|
||||
var key = runtimeEntityType.AddKey(
|
||||
new[] { importedById, importedLocationsLocalId });
|
||||
runtimeEntityType.SetPrimaryKey(key);
|
||||
|
||||
var index = runtimeEntityType.AddIndex(
|
||||
new[] { importedLocationsLocalId });
|
||||
|
||||
return runtimeEntityType;
|
||||
}
|
||||
|
||||
public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
|
||||
{
|
||||
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ImportedById")! },
|
||||
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id")! })!,
|
||||
principalEntityType,
|
||||
deleteBehavior: DeleteBehavior.Cascade,
|
||||
required: true);
|
||||
|
||||
return runtimeForeignKey;
|
||||
}
|
||||
|
||||
public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
|
||||
{
|
||||
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ImportedLocationsLocalId")! },
|
||||
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("LocalId")! })!,
|
||||
principalEntityType,
|
||||
deleteBehavior: DeleteBehavior.Cascade,
|
||||
required: true);
|
||||
|
||||
return runtimeForeignKey;
|
||||
}
|
||||
|
||||
public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
|
||||
{
|
||||
runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:Schema", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:TableName", "LocationImports");
|
||||
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
|
||||
|
||||
Customize(runtimeEntityType);
|
||||
}
|
||||
|
||||
static partial void Customize(RuntimeEntityType runtimeEntityType);
|
||||
}
|
||||
}
|
94
Pal.Client/Database/Compiled/ImportHistoryEntityType.cs
Normal file
94
Pal.Client/Database/Compiled/ImportHistoryEntityType.cs
Normal file
@ -0,0 +1,94 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
#pragma warning disable 219, 612, 618
|
||||
#nullable enable
|
||||
|
||||
namespace Pal.Client.Database.Compiled
|
||||
{
|
||||
internal partial class ImportHistoryEntityType
|
||||
{
|
||||
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? baseEntityType = null)
|
||||
{
|
||||
var runtimeEntityType = model.AddEntityType(
|
||||
"Pal.Client.Database.ImportHistory",
|
||||
typeof(ImportHistory),
|
||||
baseEntityType);
|
||||
|
||||
var id = runtimeEntityType.AddProperty(
|
||||
"Id",
|
||||
typeof(Guid),
|
||||
propertyInfo: typeof(ImportHistory).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ImportHistory).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
valueGenerated: ValueGenerated.OnAdd,
|
||||
afterSaveBehavior: PropertySaveBehavior.Throw);
|
||||
|
||||
var exportedAt = runtimeEntityType.AddProperty(
|
||||
"ExportedAt",
|
||||
typeof(DateTime),
|
||||
propertyInfo: typeof(ImportHistory).GetProperty("ExportedAt", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ImportHistory).GetField("<ExportedAt>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var importedAt = runtimeEntityType.AddProperty(
|
||||
"ImportedAt",
|
||||
typeof(DateTime),
|
||||
propertyInfo: typeof(ImportHistory).GetProperty("ImportedAt", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ImportHistory).GetField("<ImportedAt>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var remoteUrl = runtimeEntityType.AddProperty(
|
||||
"RemoteUrl",
|
||||
typeof(string),
|
||||
propertyInfo: typeof(ImportHistory).GetProperty("RemoteUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ImportHistory).GetField("<RemoteUrl>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
nullable: true);
|
||||
|
||||
var key = runtimeEntityType.AddKey(
|
||||
new[] { id });
|
||||
runtimeEntityType.SetPrimaryKey(key);
|
||||
|
||||
return runtimeEntityType;
|
||||
}
|
||||
|
||||
public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType declaringEntityType, RuntimeEntityType targetEntityType, RuntimeEntityType joinEntityType)
|
||||
{
|
||||
var skipNavigation = declaringEntityType.AddSkipNavigation(
|
||||
"ImportedLocations",
|
||||
targetEntityType,
|
||||
joinEntityType.FindForeignKey(
|
||||
new[] { joinEntityType.FindProperty("ImportedById")! },
|
||||
declaringEntityType.FindKey(new[] { declaringEntityType.FindProperty("Id")! })!,
|
||||
declaringEntityType)!,
|
||||
true,
|
||||
false,
|
||||
typeof(List<ClientLocation>),
|
||||
propertyInfo: typeof(ImportHistory).GetProperty("ImportedLocations", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ImportHistory).GetField("<ImportedLocations>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var inverse = targetEntityType.FindSkipNavigation("ImportedBy");
|
||||
if (inverse != null)
|
||||
{
|
||||
skipNavigation.Inverse = inverse;
|
||||
inverse.Inverse = skipNavigation;
|
||||
}
|
||||
|
||||
return skipNavigation;
|
||||
}
|
||||
|
||||
public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
|
||||
{
|
||||
runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:Schema", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:TableName", "Imports");
|
||||
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
|
||||
|
||||
Customize(runtimeEntityType);
|
||||
}
|
||||
|
||||
static partial void Customize(RuntimeEntityType runtimeEntityType);
|
||||
}
|
||||
}
|
28
Pal.Client/Database/Compiled/PalClientContextModel.cs
Normal file
28
Pal.Client/Database/Compiled/PalClientContextModel.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
#pragma warning disable 219, 612, 618
|
||||
#nullable enable
|
||||
|
||||
namespace Pal.Client.Database.Compiled
|
||||
{
|
||||
[DbContext(typeof(PalClientContext))]
|
||||
public partial class PalClientContextModel : RuntimeModel
|
||||
{
|
||||
static PalClientContextModel()
|
||||
{
|
||||
var model = new PalClientContextModel();
|
||||
model.Initialize();
|
||||
model.Customize();
|
||||
_instance = model;
|
||||
}
|
||||
|
||||
private static PalClientContextModel _instance;
|
||||
public static IModel Instance => _instance;
|
||||
|
||||
partial void Initialize();
|
||||
|
||||
partial void Customize();
|
||||
}
|
||||
}
|
35
Pal.Client/Database/Compiled/PalClientContextModelBuilder.cs
Normal file
35
Pal.Client/Database/Compiled/PalClientContextModelBuilder.cs
Normal file
@ -0,0 +1,35 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
#pragma warning disable 219, 612, 618
|
||||
#nullable enable
|
||||
|
||||
namespace Pal.Client.Database.Compiled
|
||||
{
|
||||
public partial class PalClientContextModel
|
||||
{
|
||||
partial void Initialize()
|
||||
{
|
||||
var clientLocationImportHistory = ClientLocationImportHistoryEntityType.Create(this);
|
||||
var clientLocation = ClientLocationEntityType.Create(this);
|
||||
var importHistory = ImportHistoryEntityType.Create(this);
|
||||
var remoteEncounter = RemoteEncounterEntityType.Create(this);
|
||||
|
||||
ClientLocationImportHistoryEntityType.CreateForeignKey1(clientLocationImportHistory, importHistory);
|
||||
ClientLocationImportHistoryEntityType.CreateForeignKey2(clientLocationImportHistory, clientLocation);
|
||||
RemoteEncounterEntityType.CreateForeignKey1(remoteEncounter, clientLocation);
|
||||
|
||||
ClientLocationEntityType.CreateSkipNavigation1(clientLocation, importHistory, clientLocationImportHistory);
|
||||
ImportHistoryEntityType.CreateSkipNavigation1(importHistory, clientLocation, clientLocationImportHistory);
|
||||
|
||||
ClientLocationImportHistoryEntityType.CreateAnnotations(clientLocationImportHistory);
|
||||
ClientLocationEntityType.CreateAnnotations(clientLocation);
|
||||
ImportHistoryEntityType.CreateAnnotations(importHistory);
|
||||
RemoteEncounterEntityType.CreateAnnotations(remoteEncounter);
|
||||
|
||||
AddAnnotation("ProductVersion", "7.0.3");
|
||||
}
|
||||
}
|
||||
}
|
92
Pal.Client/Database/Compiled/RemoteEncounterEntityType.cs
Normal file
92
Pal.Client/Database/Compiled/RemoteEncounterEntityType.cs
Normal file
@ -0,0 +1,92 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
#pragma warning disable 219, 612, 618
|
||||
#nullable enable
|
||||
|
||||
namespace Pal.Client.Database.Compiled
|
||||
{
|
||||
internal partial class RemoteEncounterEntityType
|
||||
{
|
||||
public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? baseEntityType = null)
|
||||
{
|
||||
var runtimeEntityType = model.AddEntityType(
|
||||
"Pal.Client.Database.RemoteEncounter",
|
||||
typeof(RemoteEncounter),
|
||||
baseEntityType);
|
||||
|
||||
var id = runtimeEntityType.AddProperty(
|
||||
"Id",
|
||||
typeof(int),
|
||||
propertyInfo: typeof(RemoteEncounter).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(RemoteEncounter).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
valueGenerated: ValueGenerated.OnAdd,
|
||||
afterSaveBehavior: PropertySaveBehavior.Throw);
|
||||
|
||||
var accountId = runtimeEntityType.AddProperty(
|
||||
"AccountId",
|
||||
typeof(string),
|
||||
propertyInfo: typeof(RemoteEncounter).GetProperty("AccountId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(RemoteEncounter).GetField("<AccountId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
maxLength: 13);
|
||||
|
||||
var clientLocationId = runtimeEntityType.AddProperty(
|
||||
"ClientLocationId",
|
||||
typeof(int),
|
||||
propertyInfo: typeof(RemoteEncounter).GetProperty("ClientLocationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(RemoteEncounter).GetField("<ClientLocationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var key = runtimeEntityType.AddKey(
|
||||
new[] { id });
|
||||
runtimeEntityType.SetPrimaryKey(key);
|
||||
|
||||
var index = runtimeEntityType.AddIndex(
|
||||
new[] { clientLocationId });
|
||||
|
||||
return runtimeEntityType;
|
||||
}
|
||||
|
||||
public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType)
|
||||
{
|
||||
var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ClientLocationId")! },
|
||||
principalEntityType.FindKey(new[] { principalEntityType.FindProperty("LocalId")! })!,
|
||||
principalEntityType,
|
||||
deleteBehavior: DeleteBehavior.Cascade,
|
||||
required: true);
|
||||
|
||||
var clientLocation = declaringEntityType.AddNavigation("ClientLocation",
|
||||
runtimeForeignKey,
|
||||
onDependent: true,
|
||||
typeof(ClientLocation),
|
||||
propertyInfo: typeof(RemoteEncounter).GetProperty("ClientLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(RemoteEncounter).GetField("<ClientLocation>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
var remoteEncounters = principalEntityType.AddNavigation("RemoteEncounters",
|
||||
runtimeForeignKey,
|
||||
onDependent: false,
|
||||
typeof(List<RemoteEncounter>),
|
||||
propertyInfo: typeof(ClientLocation).GetProperty("RemoteEncounters", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
|
||||
fieldInfo: typeof(ClientLocation).GetField("<RemoteEncounters>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
|
||||
|
||||
return runtimeForeignKey;
|
||||
}
|
||||
|
||||
public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
|
||||
{
|
||||
runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:Schema", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:SqlQuery", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:TableName", "RemoteEncounters");
|
||||
runtimeEntityType.AddAnnotation("Relational:ViewName", null);
|
||||
runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);
|
||||
|
||||
Customize(runtimeEntityType);
|
||||
}
|
||||
|
||||
static partial void Customize(RuntimeEntityType runtimeEntityType);
|
||||
}
|
||||
}
|
@ -99,7 +99,9 @@ namespace Pal.Client
|
||||
typeof(DependencyInjectionContext).Assembly.FullName);
|
||||
|
||||
// EF core
|
||||
_serviceCollection.AddDbContext<PalClientContext>(o => o.UseSqlite(_sqliteConnectionString));
|
||||
_serviceCollection.AddDbContext<PalClientContext>(o => o
|
||||
.UseSqlite(_sqliteConnectionString)
|
||||
.UseModel(Database.Compiled.PalClientContextModel.Instance));
|
||||
_serviceCollection.AddTransient<JsonMigration>();
|
||||
_serviceCollection.AddScoped<Cleanup>();
|
||||
|
||||
|
@ -13,3 +13,8 @@ To use with `dotnet ef` commands, specify it as `-c EF`, for example:
|
||||
```shell
|
||||
dotnet ef migrations add MigrationName --configuration EF
|
||||
```
|
||||
|
||||
To rebuild the compiled model:
|
||||
```shell
|
||||
dotnet ef dbcontext optimize --output-dir Database/Compiled --namespace Pal.Client.Database.Compiled --configuration EF
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user