diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..4a694c0f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,23 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/dotnet/.devcontainer/base.Dockerfile + +# [Choice] .NET version: 5.0, 3.1, 2.1 +ARG VARIANT="5.0" +FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} + +# [Option] Install Node.js +ARG INSTALL_NODE="false" +ARG NODE_VERSION="lts/*" +RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Option] Install Azure CLI +ARG INSTALL_AZURE_CLI="false" +COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/ +RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \ + && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..b154fbee --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,56 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/dotnet +{ + "name": "C# (.NET)", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update 'VARIANT' to pick a .NET Core version: 2.1, 3.1, 5.0 + "VARIANT": "5.0", + // Options + "INSTALL_NODE": "true", + "NODE_VERSION": "lts/*", + "INSTALL_AZURE_CLI": "false" + } + }, + + // Set *default* container specific settings.json values on container create. + "settings": {}, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-dotnettools.csharp" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [5000, 5001], + + // [Optional] To reuse of your local HTTPS dev cert: + // + // 1. Export it locally using this command: + // * Windows PowerShell: + // dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" + // * macOS/Linux terminal: + // dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" + // + // 2. Uncomment these 'remoteEnv' lines: + // "remoteEnv": { + // "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere", + // "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx", + // }, + // + // 3. Do one of the following depending on your scenario: + // * When using GitHub Codespaces and/or Remote - Containers: + // 1. Start the container + // 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer + // 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https" + // + // * If only using Remote - Containers with a local container, uncomment this line instead: + // "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "dotnet restore", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} diff --git a/.devcontainer/library-scripts/azcli-debian.sh b/.devcontainer/library-scripts/azcli-debian.sh new file mode 100644 index 00000000..7d09b0b8 --- /dev/null +++ b/.devcontainer/library-scripts/azcli-debian.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- +# +# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/azcli.md +# Maintainer: The VS Code and Codespaces Teams +# +# Syntax: ./azcli-debian.sh + +set -e + +if [ "$(id -u)" -ne 0 ]; then + echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' + exit 1 +fi + +export DEBIAN_FRONTEND=noninteractive + +# Install curl, apt-transport-https, lsb-release, or gpg if missing +if ! dpkg -s apt-transport-https curl ca-certificates lsb-release > /dev/null 2>&1 || ! type gpg > /dev/null 2>&1; then + if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then + apt-get update + fi + apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates lsb-release gnupg2 +fi + +# Install the Azure CLI +echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list +curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) +apt-get update +apt-get install -y azure-cli +echo "Done!" \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 4f64395a..8e69e32a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,9 +1,9 @@ - 7.0.0 - 7.0.0 - 7.0.0 - net7.0 - 7.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + net8.0 + 8.0.0 diff --git a/save-points/00-get-started/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/00-get-started/BlazingPizza.Server/BlazingPizza.Server.csproj index a1043cb6..e8687fc4 100644 --- a/save-points/00-get-started/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/00-get-started/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/00-get-started/BlazingPizza.Server/SeedData.cs b/save-points/00-get-started/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/00-get-started/BlazingPizza.Server/SeedData.cs +++ b/save-points/00-get-started/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/01-Components-and-layout/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/01-Components-and-layout/BlazingPizza.Server/BlazingPizza.Server.csproj index a1043cb6..e8687fc4 100644 --- a/save-points/01-Components-and-layout/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/01-Components-and-layout/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/01-Components-and-layout/BlazingPizza.Server/SeedData.cs b/save-points/01-Components-and-layout/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/01-Components-and-layout/BlazingPizza.Server/SeedData.cs +++ b/save-points/01-Components-and-layout/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/02-customize-a-pizza/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/02-customize-a-pizza/BlazingPizza.Server/BlazingPizza.Server.csproj index a1043cb6..e8687fc4 100644 --- a/save-points/02-customize-a-pizza/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/02-customize-a-pizza/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/02-customize-a-pizza/BlazingPizza.Server/SeedData.cs b/save-points/02-customize-a-pizza/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/02-customize-a-pizza/BlazingPizza.Server/SeedData.cs +++ b/save-points/02-customize-a-pizza/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/03-show-order-status/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/03-show-order-status/BlazingPizza.Server/BlazingPizza.Server.csproj index a1043cb6..e8687fc4 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/03-show-order-status/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/AddressEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/AddressEntityType.cs new file mode 100644 index 00000000..52f13d8a --- /dev/null +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/AddressEntityType.cs @@ -0,0 +1,110 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class AddressEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Address", + typeof(Address), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var city = runtimeEntityType.AddProperty( + "City", + typeof(string), + propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + city.TypeMapping = SqliteStringTypeMapping.Default; + + var line1 = runtimeEntityType.AddProperty( + "Line1", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + line1.TypeMapping = SqliteStringTypeMapping.Default; + + var line2 = runtimeEntityType.AddProperty( + "Line2", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + line2.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var postalCode = runtimeEntityType.AddProperty( + "PostalCode", + typeof(string), + propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + postalCode.TypeMapping = SqliteStringTypeMapping.Default; + + var region = runtimeEntityType.AddProperty( + "Region", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + region.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Address"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs similarity index 87% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs index 1dd4563b..6c5ca661 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class DeviceFlowCodesEntityType { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 200); + userCode.TypeMapping = SqliteStringTypeMapping.Default; var clientId = runtimeEntityType.AddProperty( "ClientId", @@ -32,12 +34,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; var creationTime = runtimeEntityType.AddProperty( "CreationTime", typeof(DateTime), propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", @@ -45,6 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", @@ -53,6 +59,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; var deviceCode = runtimeEntityType.AddProperty( "DeviceCode", @@ -60,12 +67,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + deviceCode.TypeMapping = SqliteStringTypeMapping.Default; var expiration = runtimeEntityType.AddProperty( "Expiration", typeof(DateTime?), propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; var sessionId = runtimeEntityType.AddProperty( "SessionId", @@ -74,6 +83,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; var subjectId = runtimeEntityType.AddProperty( "SubjectId", @@ -82,6 +92,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userCode }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs similarity index 76% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs index 8946b261..73cabada 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs @@ -3,14 +3,17 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityRoleClaimstringEntityType + internal partial class IdentityRoleClaimEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,7 +28,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var claimType = runtimeEntityType.AddProperty( "ClaimType", @@ -33,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; var claimValue = runtimeEntityType.AddProperty( "ClaimValue", @@ -40,12 +60,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; var roleId = runtimeEntityType.AddProperty( "RoleId", typeof(string), propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + roleId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs similarity index 90% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityRoleEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs index 2f1fec2b..3f46cdc5 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityRoleEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class IdentityRoleEntityType { @@ -24,6 +25,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var concurrencyStamp = runtimeEntityType.AddProperty( "ConcurrencyStamp", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -40,6 +43,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + name.TypeMapping = SqliteStringTypeMapping.Default; var normalizedName = runtimeEntityType.AddProperty( "NormalizedName", @@ -48,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedName.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs similarity index 76% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs index 55418a1e..5de58bf8 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs @@ -3,14 +3,17 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserClaimstringEntityType + internal partial class IdentityUserClaimEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,7 +28,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var claimType = runtimeEntityType.AddProperty( "ClaimType", @@ -33,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; var claimValue = runtimeEntityType.AddProperty( "ClaimValue", @@ -40,12 +60,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", typeof(string), propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs similarity index 90% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs index 3ca029bd..fb868abc 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserLoginstringEntityType + internal partial class IdentityUserLoginEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -26,6 +27,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; var providerKey = runtimeEntityType.AddProperty( "ProviderKey", @@ -34,6 +36,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + providerKey.TypeMapping = SqliteStringTypeMapping.Default; var providerDisplayName = runtimeEntityType.AddProperty( "ProviderDisplayName", @@ -41,12 +44,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + providerDisplayName.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", typeof(string), propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { loginProvider, providerKey }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs similarity index 92% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs index 70078d7a..f22fd836 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserRolestringEntityType + internal partial class IdentityUserRoleEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; var roleId = runtimeEntityType.AddProperty( "RoleId", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + roleId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userId, roleId }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs similarity index 90% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs index 93ba6d31..b4e36069 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserTokenstringEntityType + internal partial class IdentityUserTokenEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; var loginProvider = runtimeEntityType.AddProperty( "LoginProvider", @@ -33,6 +35,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -41,6 +44,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + name.TypeMapping = SqliteStringTypeMapping.Default; var value = runtimeEntityType.AddProperty( "Value", @@ -48,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + value.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userId, loginProvider, name }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/KeyEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/KeyEntityType.cs similarity index 61% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/KeyEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/KeyEntityType.cs index f6c6b4c7..8743240a 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/KeyEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/KeyEntityType.cs @@ -2,12 +2,15 @@ using System; using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class KeyEntityType { @@ -24,6 +27,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var algorithm = runtimeEntityType.AddProperty( "Algorithm", @@ -31,30 +35,66 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + algorithm.TypeMapping = SqliteStringTypeMapping.Default; var created = runtimeEntityType.AddProperty( "Created", typeof(DateTime), propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + created.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", typeof(string), propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + data.TypeMapping = SqliteStringTypeMapping.Default; var dataProtected = runtimeEntityType.AddProperty( "DataProtected", typeof(bool), propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + dataProtected.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var isX509Certificate = runtimeEntityType.AddProperty( "IsX509Certificate", typeof(bool), propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + isX509Certificate.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var use = runtimeEntityType.AddProperty( "Use", @@ -62,12 +102,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + use.TypeMapping = SqliteStringTypeMapping.Default; var version = runtimeEntityType.AddProperty( "Version", typeof(int), propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + version.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/LatLongEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs similarity index 56% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/LatLongEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs index 3fd254bd..657b8093 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/LatLongEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs @@ -2,12 +2,14 @@ using System; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class LatLongEntityType { @@ -21,19 +23,67 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas var orderId = runtimeEntityType.AddProperty( "OrderId", typeof(int), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var latitude = runtimeEntityType.AddProperty( "Latitude", typeof(double), propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + latitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); var longitude = runtimeEntityType.AddProperty( "Longitude", typeof(double), propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + longitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); var key = runtimeEntityType.AddKey( new[] { orderId }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs similarity index 68% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs index db236e4c..891722a1 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class NotificationSubscriptionEntityType { @@ -19,11 +22,26 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas var notificationSubscriptionId = runtimeEntityType.AddProperty( "NotificationSubscriptionId", - typeof(int), + typeof(int?), propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + notificationSubscriptionId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + keyComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + providerValueComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var auth = runtimeEntityType.AddProperty( "Auth", @@ -31,6 +49,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + auth.TypeMapping = SqliteStringTypeMapping.Default; var p256dh = runtimeEntityType.AddProperty( "P256dh", @@ -38,6 +57,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + p256dh.TypeMapping = SqliteStringTypeMapping.Default; var url = runtimeEntityType.AddProperty( "Url", @@ -45,6 +65,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + url.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", @@ -52,6 +73,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { notificationSubscriptionId }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/OrderEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/OrderEntityType.cs similarity index 63% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/OrderEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/OrderEntityType.cs index 9d9ec6fd..bf1e5171 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/OrderEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/OrderEntityType.cs @@ -1,12 +1,16 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class OrderEntityType { @@ -23,18 +27,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var createdTime = runtimeEntityType.AddProperty( "CreatedTime", typeof(DateTime), propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + createdTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var deliveryAddressId = runtimeEntityType.AddProperty( "DeliveryAddressId", - typeof(int?), - nullable: true); + typeof(int), + sentinel: 0); + deliveryAddressId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var userId = runtimeEntityType.AddProperty( "UserId", @@ -42,6 +79,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { orderId }); @@ -57,7 +95,9 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType); + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", runtimeForeignKey, diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PersistedGrantEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs similarity index 87% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PersistedGrantEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs index 842d53a5..c57731dd 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PersistedGrantEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PersistedGrantEntityType { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 200); + key.TypeMapping = SqliteStringTypeMapping.Default; var clientId = runtimeEntityType.AddProperty( "ClientId", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; var consumedTime = runtimeEntityType.AddProperty( "ConsumedTime", @@ -39,12 +42,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + consumedTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var creationTime = runtimeEntityType.AddProperty( "CreationTime", typeof(DateTime), propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", @@ -52,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", @@ -60,6 +67,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; var expiration = runtimeEntityType.AddProperty( "Expiration", @@ -67,6 +75,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; var sessionId = runtimeEntityType.AddProperty( "SessionId", @@ -75,6 +84,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; var subjectId = runtimeEntityType.AddProperty( "SubjectId", @@ -83,6 +93,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; var type = runtimeEntityType.AddProperty( "Type", @@ -90,6 +101,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + type.TypeMapping = SqliteStringTypeMapping.Default; var key0 = runtimeEntityType.AddKey( new[] { key }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs similarity index 62% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs index 3a124e63..f8ac05e4 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaEntityType { @@ -25,25 +27,89 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var orderId = runtimeEntityType.AddProperty( "OrderId", typeof(int), propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var size = runtimeEntityType.AddProperty( "Size", typeof(int), propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + size.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var specialId = runtimeEntityType.AddProperty( "SpecialId", typeof(int), propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + specialId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs similarity index 70% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs index e86b0f50..693286c8 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaSpecialEntityType { @@ -23,34 +26,52 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var basePrice = runtimeEntityType.AddProperty( "BasePrice", typeof(decimal), propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + basePrice.TypeMapping = SqliteDecimalTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + description.TypeMapping = SqliteStringTypeMapping.Default; var imageUrl = runtimeEntityType.AddProperty( "ImageUrl", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + imageUrl.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreContextModel.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs similarity index 50% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreContextModel.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs index 8b516a68..b7e36125 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreContextModel.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs @@ -5,15 +5,34 @@ #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { [DbContext(typeof(PizzaStoreContext))] public partial class PizzaStoreContextModel : RuntimeModel { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + static PizzaStoreContextModel() { var model = new PizzaStoreContextModel(); - model.Initialize(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + model.Customize(); _instance = model; } diff --git a/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs new file mode 100644 index 00000000..0f8d07cb --- /dev/null +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs @@ -0,0 +1,1619 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + public partial class PizzaStoreContextModel + { + partial void Initialize() + { + var address = AddressEntityType.Create(this); + var latLong = LatLongEntityType.Create(this); + var notificationSubscription = NotificationSubscriptionEntityType.Create(this); + var order = OrderEntityType.Create(this); + var pizza = PizzaEntityType.Create(this); + var pizzaSpecial = PizzaSpecialEntityType.Create(this); + var pizzaTopping = PizzaToppingEntityType.Create(this); + var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); + var topping = ToppingEntityType.Create(this); + var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); + var key = KeyEntityType.Create(this); + var persistedGrant = PersistedGrantEntityType.Create(this); + var identityRole = IdentityRoleEntityType.Create(this); + var identityRoleClaim = IdentityRoleClaimEntityType.Create(this); + var identityUserClaim = IdentityUserClaimEntityType.Create(this); + var identityUserLogin = IdentityUserLoginEntityType.Create(this); + var identityUserRole = IdentityUserRoleEntityType.Create(this); + var identityUserToken = IdentityUserTokenEntityType.Create(this); + + LatLongEntityType.CreateForeignKey1(latLong, order); + OrderEntityType.CreateForeignKey1(order, address); + PizzaEntityType.CreateForeignKey1(pizza, order); + PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); + PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); + PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); + IdentityRoleClaimEntityType.CreateForeignKey1(identityRoleClaim, identityRole); + IdentityUserClaimEntityType.CreateForeignKey1(identityUserClaim, pizzaStoreUser); + IdentityUserLoginEntityType.CreateForeignKey1(identityUserLogin, pizzaStoreUser); + IdentityUserRoleEntityType.CreateForeignKey1(identityUserRole, identityRole); + IdentityUserRoleEntityType.CreateForeignKey2(identityUserRole, pizzaStoreUser); + IdentityUserTokenEntityType.CreateForeignKey1(identityUserToken, pizzaStoreUser); + + AddressEntityType.CreateAnnotations(address); + LatLongEntityType.CreateAnnotations(latLong); + NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); + OrderEntityType.CreateAnnotations(order); + PizzaEntityType.CreateAnnotations(pizza); + PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); + PizzaToppingEntityType.CreateAnnotations(pizzaTopping); + PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); + ToppingEntityType.CreateAnnotations(topping); + DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); + KeyEntityType.CreateAnnotations(key); + PersistedGrantEntityType.CreateAnnotations(persistedGrant); + IdentityRoleEntityType.CreateAnnotations(identityRole); + IdentityRoleClaimEntityType.CreateAnnotations(identityRoleClaim); + IdentityUserClaimEntityType.CreateAnnotations(identityUserClaim); + IdentityUserLoginEntityType.CreateAnnotations(identityUserLogin); + IdentityUserRoleEntityType.CreateAnnotations(identityUserRole); + IdentityUserTokenEntityType.CreateAnnotations(identityUserToken); + + AddAnnotation("ProductVersion", "8.0.0"); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var address = FindEntityType("BlazingPizza.Address")!; + + var defaultTableMappings = new List>(); + address.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var blazingPizzaAddressTableBase = new TableBase("BlazingPizza.Address", null, relationalModel); + var cityColumnBase = new ColumnBase("City", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("City", cityColumnBase); + var idColumnBase = new ColumnBase("Id", "INTEGER", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Id", idColumnBase); + var line1ColumnBase = new ColumnBase("Line1", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line1", line1ColumnBase); + var line2ColumnBase = new ColumnBase("Line2", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line2", line2ColumnBase); + var nameColumnBase = new ColumnBase("Name", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Name", nameColumnBase); + var postalCodeColumnBase = new ColumnBase("PostalCode", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("PostalCode", postalCodeColumnBase); + var regionColumnBase = new ColumnBase("Region", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Region", regionColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Address", blazingPizzaAddressTableBase); + var blazingPizzaAddressMappingBase = new TableMappingBase(address, blazingPizzaAddressTableBase, true); + blazingPizzaAddressTableBase.AddTypeMapping(blazingPizzaAddressMappingBase, false); + defaultTableMappings.Add(blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, address.FindProperty("Id")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)cityColumnBase, address.FindProperty("City")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line1ColumnBase, address.FindProperty("Line1")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line2ColumnBase, address.FindProperty("Line2")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase, address.FindProperty("Name")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)postalCodeColumnBase, address.FindProperty("PostalCode")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)regionColumnBase, address.FindProperty("Region")!, blazingPizzaAddressMappingBase); + + var tableMappings = new List(); + address.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var addressTable = new Table("Address", null, relationalModel); + var idColumn = new Column("Id", "INTEGER", addressTable); + addressTable.Columns.Add("Id", idColumn); + var cityColumn = new Column("City", "TEXT", addressTable); + addressTable.Columns.Add("City", cityColumn); + var line1Column = new Column("Line1", "TEXT", addressTable); + addressTable.Columns.Add("Line1", line1Column); + var line2Column = new Column("Line2", "TEXT", addressTable); + addressTable.Columns.Add("Line2", line2Column); + var nameColumn = new Column("Name", "TEXT", addressTable); + addressTable.Columns.Add("Name", nameColumn); + var postalCodeColumn = new Column("PostalCode", "TEXT", addressTable); + addressTable.Columns.Add("PostalCode", postalCodeColumn); + var regionColumn = new Column("Region", "TEXT", addressTable); + addressTable.Columns.Add("Region", regionColumn); + var pK_Address = new UniqueConstraint("PK_Address", addressTable, new[] { idColumn }); + addressTable.PrimaryKey = pK_Address; + var pK_AddressUc = RelationalModel.GetKey(this, + "BlazingPizza.Address", + new[] { "Id" }); + pK_Address.MappedKeys.Add(pK_AddressUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AddressUc).Add(pK_Address); + addressTable.UniqueConstraints.Add("PK_Address", pK_Address); + relationalModel.Tables.Add(("Address", null), addressTable); + var addressTableMapping = new TableMapping(address, addressTable, true); + addressTable.AddTypeMapping(addressTableMapping, false); + tableMappings.Add(addressTableMapping); + RelationalModel.CreateColumnMapping(idColumn, address.FindProperty("Id")!, addressTableMapping); + RelationalModel.CreateColumnMapping(cityColumn, address.FindProperty("City")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line1Column, address.FindProperty("Line1")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line2Column, address.FindProperty("Line2")!, addressTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, address.FindProperty("Name")!, addressTableMapping); + RelationalModel.CreateColumnMapping(postalCodeColumn, address.FindProperty("PostalCode")!, addressTableMapping); + RelationalModel.CreateColumnMapping(regionColumn, address.FindProperty("Region")!, addressTableMapping); + + var latLong = FindEntityType("BlazingPizza.LatLong")!; + + var defaultTableMappings0 = new List>(); + latLong.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var blazingPizzaLatLongTableBase = new TableBase("BlazingPizza.LatLong", null, relationalModel); + var latitudeColumnBase = new ColumnBase("Latitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Latitude", latitudeColumnBase); + var longitudeColumnBase = new ColumnBase("Longitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Longitude", longitudeColumnBase); + var orderIdColumnBase = new ColumnBase("OrderId", "INTEGER", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("OrderId", orderIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.LatLong", blazingPizzaLatLongTableBase); + var blazingPizzaLatLongMappingBase = new TableMappingBase(latLong, blazingPizzaLatLongTableBase, true); + blazingPizzaLatLongTableBase.AddTypeMapping(blazingPizzaLatLongMappingBase, false); + defaultTableMappings0.Add(blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase, latLong.FindProperty("OrderId")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)latitudeColumnBase, latLong.FindProperty("Latitude")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)longitudeColumnBase, latLong.FindProperty("Longitude")!, blazingPizzaLatLongMappingBase); + + var tableMappings0 = new List(); + latLong.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var ordersTable = new Table("Orders", null, relationalModel); + var orderIdColumn = new Column("OrderId", "INTEGER", ordersTable); + ordersTable.Columns.Add("OrderId", orderIdColumn); + var createdTimeColumn = new Column("CreatedTime", "TEXT", ordersTable); + ordersTable.Columns.Add("CreatedTime", createdTimeColumn); + var deliveryAddressIdColumn = new Column("DeliveryAddressId", "INTEGER", ordersTable); + ordersTable.Columns.Add("DeliveryAddressId", deliveryAddressIdColumn); + var deliveryLocation_LatitudeColumn = new Column("DeliveryLocation_Latitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Latitude", deliveryLocation_LatitudeColumn); + var deliveryLocation_LongitudeColumn = new Column("DeliveryLocation_Longitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Longitude", deliveryLocation_LongitudeColumn); + var userIdColumn = new Column("UserId", "TEXT", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("UserId", userIdColumn); + var pK_Orders = new UniqueConstraint("PK_Orders", ordersTable, new[] { orderIdColumn }); + ordersTable.PrimaryKey = pK_Orders; + var pK_OrdersUc = RelationalModel.GetKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc).Add(pK_Orders); + var pK_OrdersUc0 = RelationalModel.GetKey(this, + "BlazingPizza.Order", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc0); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc0).Add(pK_Orders); + ordersTable.UniqueConstraints.Add("PK_Orders", pK_Orders); + var iX_Orders_DeliveryAddressId = new TableIndex( + "IX_Orders_DeliveryAddressId", ordersTable, new[] { deliveryAddressIdColumn }, false); + var iX_Orders_DeliveryAddressIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }); + iX_Orders_DeliveryAddressId.MappedIndexes.Add(iX_Orders_DeliveryAddressIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Orders_DeliveryAddressIdIx).Add(iX_Orders_DeliveryAddressId); + ordersTable.Indexes.Add("IX_Orders_DeliveryAddressId", iX_Orders_DeliveryAddressId); + relationalModel.Tables.Add(("Orders", null), ordersTable); + var ordersTableMapping = new TableMapping(latLong, ordersTable, true) + { + IsSharedTablePrincipal = false, + }; + ordersTable.AddTypeMapping(ordersTableMapping, true); + tableMappings0.Add(ordersTableMapping); + ordersTable.AddRowInternalForeignKey(latLong, RelationalModel.GetForeignKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" })); + RelationalModel.CreateColumnMapping(orderIdColumn, latLong.FindProperty("OrderId")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LatitudeColumn, latLong.FindProperty("Latitude")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LongitudeColumn, latLong.FindProperty("Longitude")!, ordersTableMapping); + + var notificationSubscription = FindEntityType("BlazingPizza.NotificationSubscription")!; + + var defaultTableMappings1 = new List>(); + notificationSubscription.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var blazingPizzaNotificationSubscriptionTableBase = new TableBase("BlazingPizza.NotificationSubscription", null, relationalModel); + var authColumnBase = new ColumnBase("Auth", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Auth", authColumnBase); + var notificationSubscriptionIdColumnBase = new ColumnBase("NotificationSubscriptionId", "INTEGER", blazingPizzaNotificationSubscriptionTableBase); + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumnBase); + var p256dhColumnBase = new ColumnBase("P256dh", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("P256dh", p256dhColumnBase); + var urlColumnBase = new ColumnBase("Url", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Url", urlColumnBase); + var userIdColumnBase = new ColumnBase("UserId", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("UserId", userIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.NotificationSubscription", blazingPizzaNotificationSubscriptionTableBase); + var blazingPizzaNotificationSubscriptionMappingBase = new TableMappingBase(notificationSubscription, blazingPizzaNotificationSubscriptionTableBase, true); + blazingPizzaNotificationSubscriptionTableBase.AddTypeMapping(blazingPizzaNotificationSubscriptionMappingBase, false); + defaultTableMappings1.Add(blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)notificationSubscriptionIdColumnBase, notificationSubscription.FindProperty("NotificationSubscriptionId")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)authColumnBase, notificationSubscription.FindProperty("Auth")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)p256dhColumnBase, notificationSubscription.FindProperty("P256dh")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)urlColumnBase, notificationSubscription.FindProperty("Url")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase, notificationSubscription.FindProperty("UserId")!, blazingPizzaNotificationSubscriptionMappingBase); + + var tableMappings1 = new List(); + notificationSubscription.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var notificationSubscriptionsTable = new Table("NotificationSubscriptions", null, relationalModel); + var notificationSubscriptionIdColumn = new Column("NotificationSubscriptionId", "INTEGER", notificationSubscriptionsTable); + notificationSubscriptionsTable.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumn); + var authColumn = new Column("Auth", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Auth", authColumn); + var p256dhColumn = new Column("P256dh", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("P256dh", p256dhColumn); + var urlColumn = new Column("Url", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Url", urlColumn); + var userIdColumn0 = new Column("UserId", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("UserId", userIdColumn0); + var pK_NotificationSubscriptions = new UniqueConstraint("PK_NotificationSubscriptions", notificationSubscriptionsTable, new[] { notificationSubscriptionIdColumn }); + notificationSubscriptionsTable.PrimaryKey = pK_NotificationSubscriptions; + var pK_NotificationSubscriptionsUc = RelationalModel.GetKey(this, + "BlazingPizza.NotificationSubscription", + new[] { "NotificationSubscriptionId" }); + pK_NotificationSubscriptions.MappedKeys.Add(pK_NotificationSubscriptionsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_NotificationSubscriptionsUc).Add(pK_NotificationSubscriptions); + notificationSubscriptionsTable.UniqueConstraints.Add("PK_NotificationSubscriptions", pK_NotificationSubscriptions); + relationalModel.Tables.Add(("NotificationSubscriptions", null), notificationSubscriptionsTable); + var notificationSubscriptionsTableMapping = new TableMapping(notificationSubscription, notificationSubscriptionsTable, true); + notificationSubscriptionsTable.AddTypeMapping(notificationSubscriptionsTableMapping, false); + tableMappings1.Add(notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(notificationSubscriptionIdColumn, notificationSubscription.FindProperty("NotificationSubscriptionId")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(authColumn, notificationSubscription.FindProperty("Auth")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(p256dhColumn, notificationSubscription.FindProperty("P256dh")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(urlColumn, notificationSubscription.FindProperty("Url")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn0, notificationSubscription.FindProperty("UserId")!, notificationSubscriptionsTableMapping); + + var order = FindEntityType("BlazingPizza.Order")!; + + var defaultTableMappings2 = new List>(); + order.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings2); + var blazingPizzaOrderTableBase = new TableBase("BlazingPizza.Order", null, relationalModel); + var createdTimeColumnBase = new ColumnBase("CreatedTime", "TEXT", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("CreatedTime", createdTimeColumnBase); + var deliveryAddressIdColumnBase = new ColumnBase("DeliveryAddressId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("DeliveryAddressId", deliveryAddressIdColumnBase); + var orderIdColumnBase0 = new ColumnBase("OrderId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("OrderId", orderIdColumnBase0); + var userIdColumnBase0 = new ColumnBase("UserId", "TEXT", blazingPizzaOrderTableBase) + { + IsNullable = true + }; + blazingPizzaOrderTableBase.Columns.Add("UserId", userIdColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.Order", blazingPizzaOrderTableBase); + var blazingPizzaOrderMappingBase = new TableMappingBase(order, blazingPizzaOrderTableBase, true); + blazingPizzaOrderTableBase.AddTypeMapping(blazingPizzaOrderMappingBase, false); + defaultTableMappings2.Add(blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase0, order.FindProperty("OrderId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdTimeColumnBase, order.FindProperty("CreatedTime")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deliveryAddressIdColumnBase, order.FindProperty("DeliveryAddressId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase0, order.FindProperty("UserId")!, blazingPizzaOrderMappingBase); + + var tableMappings2 = new List(); + order.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); + var ordersTableMapping0 = new TableMapping(order, ordersTable, true) + { + IsSharedTablePrincipal = true, + }; + ordersTable.AddTypeMapping(ordersTableMapping0, false); + tableMappings2.Add(ordersTableMapping0); + RelationalModel.CreateColumnMapping(orderIdColumn, order.FindProperty("OrderId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(createdTimeColumn, order.FindProperty("CreatedTime")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(deliveryAddressIdColumn, order.FindProperty("DeliveryAddressId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(userIdColumn, order.FindProperty("UserId")!, ordersTableMapping0); + + var pizza = FindEntityType("BlazingPizza.Pizza")!; + + var defaultTableMappings3 = new List>(); + pizza.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings3); + var blazingPizzaPizzaTableBase = new TableBase("BlazingPizza.Pizza", null, relationalModel); + var idColumnBase0 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Id", idColumnBase0); + var orderIdColumnBase1 = new ColumnBase("OrderId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("OrderId", orderIdColumnBase1); + var sizeColumnBase = new ColumnBase("Size", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Size", sizeColumnBase); + var specialIdColumnBase = new ColumnBase("SpecialId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("SpecialId", specialIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Pizza", blazingPizzaPizzaTableBase); + var blazingPizzaPizzaMappingBase = new TableMappingBase(pizza, blazingPizzaPizzaTableBase, true); + blazingPizzaPizzaTableBase.AddTypeMapping(blazingPizzaPizzaMappingBase, false); + defaultTableMappings3.Add(blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, pizza.FindProperty("Id")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase1, pizza.FindProperty("OrderId")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sizeColumnBase, pizza.FindProperty("Size")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)specialIdColumnBase, pizza.FindProperty("SpecialId")!, blazingPizzaPizzaMappingBase); + + var tableMappings3 = new List(); + pizza.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); + var pizzasTable = new Table("Pizzas", null, relationalModel); + var idColumn0 = new Column("Id", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Id", idColumn0); + var orderIdColumn0 = new Column("OrderId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("OrderId", orderIdColumn0); + var sizeColumn = new Column("Size", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Size", sizeColumn); + var specialIdColumn = new Column("SpecialId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("SpecialId", specialIdColumn); + var pK_Pizzas = new UniqueConstraint("PK_Pizzas", pizzasTable, new[] { idColumn0 }); + pizzasTable.PrimaryKey = pK_Pizzas; + var pK_PizzasUc = RelationalModel.GetKey(this, + "BlazingPizza.Pizza", + new[] { "Id" }); + pK_Pizzas.MappedKeys.Add(pK_PizzasUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzasUc).Add(pK_Pizzas); + pizzasTable.UniqueConstraints.Add("PK_Pizzas", pK_Pizzas); + var iX_Pizzas_OrderId = new TableIndex( + "IX_Pizzas_OrderId", pizzasTable, new[] { orderIdColumn0 }, false); + var iX_Pizzas_OrderIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }); + iX_Pizzas_OrderId.MappedIndexes.Add(iX_Pizzas_OrderIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_OrderIdIx).Add(iX_Pizzas_OrderId); + pizzasTable.Indexes.Add("IX_Pizzas_OrderId", iX_Pizzas_OrderId); + var iX_Pizzas_SpecialId = new TableIndex( + "IX_Pizzas_SpecialId", pizzasTable, new[] { specialIdColumn }, false); + var iX_Pizzas_SpecialIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }); + iX_Pizzas_SpecialId.MappedIndexes.Add(iX_Pizzas_SpecialIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_SpecialIdIx).Add(iX_Pizzas_SpecialId); + pizzasTable.Indexes.Add("IX_Pizzas_SpecialId", iX_Pizzas_SpecialId); + relationalModel.Tables.Add(("Pizzas", null), pizzasTable); + var pizzasTableMapping = new TableMapping(pizza, pizzasTable, true); + pizzasTable.AddTypeMapping(pizzasTableMapping, false); + tableMappings3.Add(pizzasTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, pizza.FindProperty("Id")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(orderIdColumn0, pizza.FindProperty("OrderId")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(sizeColumn, pizza.FindProperty("Size")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(specialIdColumn, pizza.FindProperty("SpecialId")!, pizzasTableMapping); + + var pizzaSpecial = FindEntityType("BlazingPizza.PizzaSpecial")!; + + var defaultTableMappings4 = new List>(); + pizzaSpecial.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); + var blazingPizzaPizzaSpecialTableBase = new TableBase("BlazingPizza.PizzaSpecial", null, relationalModel); + var basePriceColumnBase = new ColumnBase("BasePrice", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("BasePrice", basePriceColumnBase); + var descriptionColumnBase = new ColumnBase("Description", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Description", descriptionColumnBase); + var idColumnBase1 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Id", idColumnBase1); + var imageUrlColumnBase = new ColumnBase("ImageUrl", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("ImageUrl", imageUrlColumnBase); + var nameColumnBase0 = new ColumnBase("Name", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Name", nameColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaSpecial", blazingPizzaPizzaSpecialTableBase); + var blazingPizzaPizzaSpecialMappingBase = new TableMappingBase(pizzaSpecial, blazingPizzaPizzaSpecialTableBase, true); + blazingPizzaPizzaSpecialTableBase.AddTypeMapping(blazingPizzaPizzaSpecialMappingBase, false); + defaultTableMappings4.Add(blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, pizzaSpecial.FindProperty("Id")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)basePriceColumnBase, pizzaSpecial.FindProperty("BasePrice")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase, pizzaSpecial.FindProperty("Description")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)imageUrlColumnBase, pizzaSpecial.FindProperty("ImageUrl")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase0, pizzaSpecial.FindProperty("Name")!, blazingPizzaPizzaSpecialMappingBase); + + var tableMappings4 = new List(); + pizzaSpecial.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); + var specialsTable = new Table("Specials", null, relationalModel); + var idColumn1 = new Column("Id", "INTEGER", specialsTable); + specialsTable.Columns.Add("Id", idColumn1); + var basePriceColumn = new Column("BasePrice", "TEXT", specialsTable); + specialsTable.Columns.Add("BasePrice", basePriceColumn); + var descriptionColumn = new Column("Description", "TEXT", specialsTable); + specialsTable.Columns.Add("Description", descriptionColumn); + var imageUrlColumn = new Column("ImageUrl", "TEXT", specialsTable); + specialsTable.Columns.Add("ImageUrl", imageUrlColumn); + var nameColumn0 = new Column("Name", "TEXT", specialsTable); + specialsTable.Columns.Add("Name", nameColumn0); + var pK_Specials = new UniqueConstraint("PK_Specials", specialsTable, new[] { idColumn1 }); + specialsTable.PrimaryKey = pK_Specials; + var pK_SpecialsUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + pK_Specials.MappedKeys.Add(pK_SpecialsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_SpecialsUc).Add(pK_Specials); + specialsTable.UniqueConstraints.Add("PK_Specials", pK_Specials); + relationalModel.Tables.Add(("Specials", null), specialsTable); + var specialsTableMapping = new TableMapping(pizzaSpecial, specialsTable, true); + specialsTable.AddTypeMapping(specialsTableMapping, false); + tableMappings4.Add(specialsTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, pizzaSpecial.FindProperty("Id")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(basePriceColumn, pizzaSpecial.FindProperty("BasePrice")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn, pizzaSpecial.FindProperty("Description")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(imageUrlColumn, pizzaSpecial.FindProperty("ImageUrl")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn0, pizzaSpecial.FindProperty("Name")!, specialsTableMapping); + + var pizzaTopping = FindEntityType("BlazingPizza.PizzaTopping")!; + + var defaultTableMappings5 = new List>(); + pizzaTopping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings5); + var blazingPizzaPizzaToppingTableBase = new TableBase("BlazingPizza.PizzaTopping", null, relationalModel); + var pizzaIdColumnBase = new ColumnBase("PizzaId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("PizzaId", pizzaIdColumnBase); + var toppingIdColumnBase = new ColumnBase("ToppingId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("ToppingId", toppingIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaTopping", blazingPizzaPizzaToppingTableBase); + var blazingPizzaPizzaToppingMappingBase = new TableMappingBase(pizzaTopping, blazingPizzaPizzaToppingTableBase, true); + blazingPizzaPizzaToppingTableBase.AddTypeMapping(blazingPizzaPizzaToppingMappingBase, false); + defaultTableMappings5.Add(blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pizzaIdColumnBase, pizzaTopping.FindProperty("PizzaId")!, blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)toppingIdColumnBase, pizzaTopping.FindProperty("ToppingId")!, blazingPizzaPizzaToppingMappingBase); + + var tableMappings5 = new List(); + pizzaTopping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); + var pizzaToppingTable = new Table("PizzaTopping", null, relationalModel); + var pizzaIdColumn = new Column("PizzaId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("PizzaId", pizzaIdColumn); + var toppingIdColumn = new Column("ToppingId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("ToppingId", toppingIdColumn); + var pK_PizzaTopping = new UniqueConstraint("PK_PizzaTopping", pizzaToppingTable, new[] { pizzaIdColumn, toppingIdColumn }); + pizzaToppingTable.PrimaryKey = pK_PizzaTopping; + var pK_PizzaToppingUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId", "ToppingId" }); + pK_PizzaTopping.MappedKeys.Add(pK_PizzaToppingUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzaToppingUc).Add(pK_PizzaTopping); + pizzaToppingTable.UniqueConstraints.Add("PK_PizzaTopping", pK_PizzaTopping); + var iX_PizzaTopping_ToppingId = new TableIndex( + "IX_PizzaTopping_ToppingId", pizzaToppingTable, new[] { toppingIdColumn }, false); + var iX_PizzaTopping_ToppingIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }); + iX_PizzaTopping_ToppingId.MappedIndexes.Add(iX_PizzaTopping_ToppingIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PizzaTopping_ToppingIdIx).Add(iX_PizzaTopping_ToppingId); + pizzaToppingTable.Indexes.Add("IX_PizzaTopping_ToppingId", iX_PizzaTopping_ToppingId); + relationalModel.Tables.Add(("PizzaTopping", null), pizzaToppingTable); + var pizzaToppingTableMapping = new TableMapping(pizzaTopping, pizzaToppingTable, true); + pizzaToppingTable.AddTypeMapping(pizzaToppingTableMapping, false); + tableMappings5.Add(pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(pizzaIdColumn, pizzaTopping.FindProperty("PizzaId")!, pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(toppingIdColumn, pizzaTopping.FindProperty("ToppingId")!, pizzaToppingTableMapping); + + var pizzaStoreUser = FindEntityType("BlazingPizza.Server.PizzaStoreUser")!; + + var defaultTableMappings6 = new List>(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings6); + var blazingPizzaServerPizzaStoreUserTableBase = new TableBase("BlazingPizza.Server.PizzaStoreUser", null, relationalModel); + var accessFailedCountColumnBase = new ColumnBase("AccessFailedCount", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("AccessFailedCount", accessFailedCountColumnBase); + var concurrencyStampColumnBase = new ColumnBase("ConcurrencyStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase); + var emailColumnBase = new ColumnBase("Email", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Email", emailColumnBase); + var emailConfirmedColumnBase = new ColumnBase("EmailConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("EmailConfirmed", emailConfirmedColumnBase); + var idColumnBase2 = new ColumnBase("Id", "TEXT", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Id", idColumnBase2); + var lockoutEnabledColumnBase = new ColumnBase("LockoutEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnabled", lockoutEnabledColumnBase); + var lockoutEndColumnBase = new ColumnBase("LockoutEnd", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnd", lockoutEndColumnBase); + var normalizedEmailColumnBase = new ColumnBase("NormalizedEmail", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedEmail", normalizedEmailColumnBase); + var normalizedUserNameColumnBase = new ColumnBase("NormalizedUserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedUserName", normalizedUserNameColumnBase); + var passwordHashColumnBase = new ColumnBase("PasswordHash", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PasswordHash", passwordHashColumnBase); + var phoneNumberColumnBase = new ColumnBase("PhoneNumber", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumber", phoneNumberColumnBase); + var phoneNumberConfirmedColumnBase = new ColumnBase("PhoneNumberConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumnBase); + var securityStampColumnBase = new ColumnBase("SecurityStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("SecurityStamp", securityStampColumnBase); + var twoFactorEnabledColumnBase = new ColumnBase("TwoFactorEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumnBase); + var userNameColumnBase = new ColumnBase("UserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("UserName", userNameColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Server.PizzaStoreUser", blazingPizzaServerPizzaStoreUserTableBase); + var blazingPizzaServerPizzaStoreUserMappingBase = new TableMappingBase(pizzaStoreUser, blazingPizzaServerPizzaStoreUserTableBase, true); + blazingPizzaServerPizzaStoreUserTableBase.AddTypeMapping(blazingPizzaServerPizzaStoreUserMappingBase, false); + defaultTableMappings6.Add(blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, pizzaStoreUser.FindProperty("Id")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)accessFailedCountColumnBase, pizzaStoreUser.FindProperty("AccessFailedCount")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailColumnBase, pizzaStoreUser.FindProperty("Email")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailConfirmedColumnBase, pizzaStoreUser.FindProperty("EmailConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEnabledColumnBase, pizzaStoreUser.FindProperty("LockoutEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEndColumnBase, pizzaStoreUser.FindProperty("LockoutEnd")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedEmailColumnBase, pizzaStoreUser.FindProperty("NormalizedEmail")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedUserNameColumnBase, pizzaStoreUser.FindProperty("NormalizedUserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)passwordHashColumnBase, pizzaStoreUser.FindProperty("PasswordHash")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberColumnBase, pizzaStoreUser.FindProperty("PhoneNumber")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberConfirmedColumnBase, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)securityStampColumnBase, pizzaStoreUser.FindProperty("SecurityStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)twoFactorEnabledColumnBase, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userNameColumnBase, pizzaStoreUser.FindProperty("UserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + + var tableMappings6 = new List(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:TableMappings", tableMappings6); + var aspNetUsersTable = new Table("AspNetUsers", null, relationalModel); + var idColumn2 = new Column("Id", "TEXT", aspNetUsersTable); + aspNetUsersTable.Columns.Add("Id", idColumn2); + var accessFailedCountColumn = new Column("AccessFailedCount", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("AccessFailedCount", accessFailedCountColumn); + var concurrencyStampColumn = new Column("ConcurrencyStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn); + var emailColumn = new Column("Email", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("Email", emailColumn); + var emailConfirmedColumn = new Column("EmailConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("EmailConfirmed", emailConfirmedColumn); + var lockoutEnabledColumn = new Column("LockoutEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("LockoutEnabled", lockoutEnabledColumn); + var lockoutEndColumn = new Column("LockoutEnd", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("LockoutEnd", lockoutEndColumn); + var normalizedEmailColumn = new Column("NormalizedEmail", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedEmail", normalizedEmailColumn); + var normalizedUserNameColumn = new Column("NormalizedUserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedUserName", normalizedUserNameColumn); + var passwordHashColumn = new Column("PasswordHash", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PasswordHash", passwordHashColumn); + var phoneNumberColumn = new Column("PhoneNumber", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PhoneNumber", phoneNumberColumn); + var phoneNumberConfirmedColumn = new Column("PhoneNumberConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumn); + var securityStampColumn = new Column("SecurityStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("SecurityStamp", securityStampColumn); + var twoFactorEnabledColumn = new Column("TwoFactorEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumn); + var userNameColumn = new Column("UserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("UserName", userNameColumn); + var pK_AspNetUsers = new UniqueConstraint("PK_AspNetUsers", aspNetUsersTable, new[] { idColumn2 }); + aspNetUsersTable.PrimaryKey = pK_AspNetUsers; + var pK_AspNetUsersUc = RelationalModel.GetKey(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + pK_AspNetUsers.MappedKeys.Add(pK_AspNetUsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUsersUc).Add(pK_AspNetUsers); + aspNetUsersTable.UniqueConstraints.Add("PK_AspNetUsers", pK_AspNetUsers); + var emailIndex = new TableIndex( + "EmailIndex", aspNetUsersTable, new[] { normalizedEmailColumn }, false); + var emailIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedEmail" }); + emailIndex.MappedIndexes.Add(emailIndexIx); + RelationalModel.GetOrCreateTableIndexes(emailIndexIx).Add(emailIndex); + aspNetUsersTable.Indexes.Add("EmailIndex", emailIndex); + var userNameIndex = new TableIndex( + "UserNameIndex", aspNetUsersTable, new[] { normalizedUserNameColumn }, true); + var userNameIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedUserName" }); + userNameIndex.MappedIndexes.Add(userNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(userNameIndexIx).Add(userNameIndex); + aspNetUsersTable.Indexes.Add("UserNameIndex", userNameIndex); + relationalModel.Tables.Add(("AspNetUsers", null), aspNetUsersTable); + var aspNetUsersTableMapping = new TableMapping(pizzaStoreUser, aspNetUsersTable, true); + aspNetUsersTable.AddTypeMapping(aspNetUsersTableMapping, false); + tableMappings6.Add(aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(idColumn2, pizzaStoreUser.FindProperty("Id")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(accessFailedCountColumn, pizzaStoreUser.FindProperty("AccessFailedCount")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailColumn, pizzaStoreUser.FindProperty("Email")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailConfirmedColumn, pizzaStoreUser.FindProperty("EmailConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEnabledColumn, pizzaStoreUser.FindProperty("LockoutEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEndColumn, pizzaStoreUser.FindProperty("LockoutEnd")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedEmailColumn, pizzaStoreUser.FindProperty("NormalizedEmail")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedUserNameColumn, pizzaStoreUser.FindProperty("NormalizedUserName")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(passwordHashColumn, pizzaStoreUser.FindProperty("PasswordHash")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberColumn, pizzaStoreUser.FindProperty("PhoneNumber")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberConfirmedColumn, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(securityStampColumn, pizzaStoreUser.FindProperty("SecurityStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(twoFactorEnabledColumn, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(userNameColumn, pizzaStoreUser.FindProperty("UserName")!, aspNetUsersTableMapping); + + var topping = FindEntityType("BlazingPizza.Topping")!; + + var defaultTableMappings7 = new List>(); + topping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings7); + var blazingPizzaToppingTableBase = new TableBase("BlazingPizza.Topping", null, relationalModel); + var idColumnBase3 = new ColumnBase("Id", "INTEGER", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Id", idColumnBase3); + var nameColumnBase1 = new ColumnBase("Name", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Name", nameColumnBase1); + var priceColumnBase = new ColumnBase("Price", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Price", priceColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Topping", blazingPizzaToppingTableBase); + var blazingPizzaToppingMappingBase = new TableMappingBase(topping, blazingPizzaToppingTableBase, true); + blazingPizzaToppingTableBase.AddTypeMapping(blazingPizzaToppingMappingBase, false); + defaultTableMappings7.Add(blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase3, topping.FindProperty("Id")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase1, topping.FindProperty("Name")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)priceColumnBase, topping.FindProperty("Price")!, blazingPizzaToppingMappingBase); + + var tableMappings7 = new List(); + topping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings7); + var toppingsTable = new Table("Toppings", null, relationalModel); + var idColumn3 = new Column("Id", "INTEGER", toppingsTable); + toppingsTable.Columns.Add("Id", idColumn3); + var nameColumn1 = new Column("Name", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Name", nameColumn1); + var priceColumn = new Column("Price", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Price", priceColumn); + var pK_Toppings = new UniqueConstraint("PK_Toppings", toppingsTable, new[] { idColumn3 }); + toppingsTable.PrimaryKey = pK_Toppings; + var pK_ToppingsUc = RelationalModel.GetKey(this, + "BlazingPizza.Topping", + new[] { "Id" }); + pK_Toppings.MappedKeys.Add(pK_ToppingsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_ToppingsUc).Add(pK_Toppings); + toppingsTable.UniqueConstraints.Add("PK_Toppings", pK_Toppings); + relationalModel.Tables.Add(("Toppings", null), toppingsTable); + var toppingsTableMapping = new TableMapping(topping, toppingsTable, true); + toppingsTable.AddTypeMapping(toppingsTableMapping, false); + tableMappings7.Add(toppingsTableMapping); + RelationalModel.CreateColumnMapping(idColumn3, topping.FindProperty("Id")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn1, topping.FindProperty("Name")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(priceColumn, topping.FindProperty("Price")!, toppingsTableMapping); + + var deviceFlowCodes = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes")!; + + var defaultTableMappings8 = new List>(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings8); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", null, relationalModel); + var clientIdColumnBase = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("ClientId", clientIdColumnBase); + var creationTimeColumnBase = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("CreationTime", creationTimeColumnBase); + var dataColumnBase = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Data", dataColumnBase); + var descriptionColumnBase0 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Description", descriptionColumnBase0); + var deviceCodeColumnBase = new ColumnBase("DeviceCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("DeviceCode", deviceCodeColumnBase); + var expirationColumnBase = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Expiration", expirationColumnBase); + var sessionIdColumnBase = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SessionId", sessionIdColumnBase); + var subjectIdColumnBase = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SubjectId", subjectIdColumnBase); + var userCodeColumnBase = new ColumnBase("UserCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("UserCode", userCodeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase = new TableMappingBase(deviceFlowCodes, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase, false); + defaultTableMappings8.Add(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userCodeColumnBase, deviceFlowCodes.FindProperty("UserCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase, deviceFlowCodes.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase, deviceFlowCodes.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, deviceFlowCodes.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase0, deviceFlowCodes.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deviceCodeColumnBase, deviceFlowCodes.FindProperty("DeviceCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase, deviceFlowCodes.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase, deviceFlowCodes.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase, deviceFlowCodes.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + + var tableMappings8 = new List(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:TableMappings", tableMappings8); + var deviceCodesTable = new Table("DeviceCodes", null, relationalModel); + var userCodeColumn = new Column("UserCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("UserCode", userCodeColumn); + var clientIdColumn = new Column("ClientId", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("ClientId", clientIdColumn); + var creationTimeColumn = new Column("CreationTime", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("CreationTime", creationTimeColumn); + var dataColumn = new Column("Data", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Data", dataColumn); + var descriptionColumn0 = new Column("Description", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("Description", descriptionColumn0); + var deviceCodeColumn = new Column("DeviceCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("DeviceCode", deviceCodeColumn); + var expirationColumn = new Column("Expiration", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Expiration", expirationColumn); + var sessionIdColumn = new Column("SessionId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SessionId", sessionIdColumn); + var subjectIdColumn = new Column("SubjectId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SubjectId", subjectIdColumn); + var pK_DeviceCodes = new UniqueConstraint("PK_DeviceCodes", deviceCodesTable, new[] { userCodeColumn }); + deviceCodesTable.PrimaryKey = pK_DeviceCodes; + var pK_DeviceCodesUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "UserCode" }); + pK_DeviceCodes.MappedKeys.Add(pK_DeviceCodesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_DeviceCodesUc).Add(pK_DeviceCodes); + deviceCodesTable.UniqueConstraints.Add("PK_DeviceCodes", pK_DeviceCodes); + var iX_DeviceCodes_DeviceCode = new TableIndex( + "IX_DeviceCodes_DeviceCode", deviceCodesTable, new[] { deviceCodeColumn }, true); + var iX_DeviceCodes_DeviceCodeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "DeviceCode" }); + iX_DeviceCodes_DeviceCode.MappedIndexes.Add(iX_DeviceCodes_DeviceCodeIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_DeviceCodeIx).Add(iX_DeviceCodes_DeviceCode); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_DeviceCode", iX_DeviceCodes_DeviceCode); + var iX_DeviceCodes_Expiration = new TableIndex( + "IX_DeviceCodes_Expiration", deviceCodesTable, new[] { expirationColumn }, false); + var iX_DeviceCodes_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "Expiration" }); + iX_DeviceCodes_Expiration.MappedIndexes.Add(iX_DeviceCodes_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_ExpirationIx).Add(iX_DeviceCodes_Expiration); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_Expiration", iX_DeviceCodes_Expiration); + relationalModel.Tables.Add(("DeviceCodes", null), deviceCodesTable); + var deviceCodesTableMapping = new TableMapping(deviceFlowCodes, deviceCodesTable, true); + deviceCodesTable.AddTypeMapping(deviceCodesTableMapping, false); + tableMappings8.Add(deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(userCodeColumn, deviceFlowCodes.FindProperty("UserCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn, deviceFlowCodes.FindProperty("ClientId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn, deviceFlowCodes.FindProperty("CreationTime")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, deviceFlowCodes.FindProperty("Data")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn0, deviceFlowCodes.FindProperty("Description")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(deviceCodeColumn, deviceFlowCodes.FindProperty("DeviceCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn, deviceFlowCodes.FindProperty("Expiration")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn, deviceFlowCodes.FindProperty("SessionId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn, deviceFlowCodes.FindProperty("SubjectId")!, deviceCodesTableMapping); + + var key = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.Key")!; + + var defaultTableMappings9 = new List>(); + key.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings9); + var duendeIdentityServerEntityFrameworkEntitiesKeyTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.Key", null, relationalModel); + var algorithmColumnBase = new ColumnBase("Algorithm", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Algorithm", algorithmColumnBase); + var createdColumnBase = new ColumnBase("Created", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Created", createdColumnBase); + var dataColumnBase0 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Data", dataColumnBase0); + var dataProtectedColumnBase = new ColumnBase("DataProtected", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("DataProtected", dataProtectedColumnBase); + var idColumnBase4 = new ColumnBase("Id", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Id", idColumnBase4); + var isX509CertificateColumnBase = new ColumnBase("IsX509Certificate", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("IsX509Certificate", isX509CertificateColumnBase); + var useColumnBase = new ColumnBase("Use", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Use", useColumnBase); + var versionColumnBase = new ColumnBase("Version", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Version", versionColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.Key", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + var duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase = new TableMappingBase(key, duendeIdentityServerEntityFrameworkEntitiesKeyTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase, false); + defaultTableMappings9.Add(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase4, key.FindProperty("Id")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)algorithmColumnBase, key.FindProperty("Algorithm")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdColumnBase, key.FindProperty("Created")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase0, key.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataProtectedColumnBase, key.FindProperty("DataProtected")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)isX509CertificateColumnBase, key.FindProperty("IsX509Certificate")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)useColumnBase, key.FindProperty("Use")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)versionColumnBase, key.FindProperty("Version")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + + var tableMappings9 = new List(); + key.SetRuntimeAnnotation("Relational:TableMappings", tableMappings9); + var keysTable = new Table("Keys", null, relationalModel); + var idColumn4 = new Column("Id", "TEXT", keysTable); + keysTable.Columns.Add("Id", idColumn4); + var algorithmColumn = new Column("Algorithm", "TEXT", keysTable); + keysTable.Columns.Add("Algorithm", algorithmColumn); + var createdColumn = new Column("Created", "TEXT", keysTable); + keysTable.Columns.Add("Created", createdColumn); + var dataColumn0 = new Column("Data", "TEXT", keysTable); + keysTable.Columns.Add("Data", dataColumn0); + var dataProtectedColumn = new Column("DataProtected", "INTEGER", keysTable); + keysTable.Columns.Add("DataProtected", dataProtectedColumn); + var isX509CertificateColumn = new Column("IsX509Certificate", "INTEGER", keysTable); + keysTable.Columns.Add("IsX509Certificate", isX509CertificateColumn); + var useColumn = new Column("Use", "TEXT", keysTable) + { + IsNullable = true + }; + keysTable.Columns.Add("Use", useColumn); + var versionColumn = new Column("Version", "INTEGER", keysTable); + keysTable.Columns.Add("Version", versionColumn); + var pK_Keys = new UniqueConstraint("PK_Keys", keysTable, new[] { idColumn4 }); + keysTable.PrimaryKey = pK_Keys; + var pK_KeysUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Id" }); + pK_Keys.MappedKeys.Add(pK_KeysUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_KeysUc).Add(pK_Keys); + keysTable.UniqueConstraints.Add("PK_Keys", pK_Keys); + var iX_Keys_Use = new TableIndex( + "IX_Keys_Use", keysTable, new[] { useColumn }, false); + var iX_Keys_UseIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Use" }); + iX_Keys_Use.MappedIndexes.Add(iX_Keys_UseIx); + RelationalModel.GetOrCreateTableIndexes(iX_Keys_UseIx).Add(iX_Keys_Use); + keysTable.Indexes.Add("IX_Keys_Use", iX_Keys_Use); + relationalModel.Tables.Add(("Keys", null), keysTable); + var keysTableMapping = new TableMapping(key, keysTable, true); + keysTable.AddTypeMapping(keysTableMapping, false); + tableMappings9.Add(keysTableMapping); + RelationalModel.CreateColumnMapping(idColumn4, key.FindProperty("Id")!, keysTableMapping); + RelationalModel.CreateColumnMapping(algorithmColumn, key.FindProperty("Algorithm")!, keysTableMapping); + RelationalModel.CreateColumnMapping(createdColumn, key.FindProperty("Created")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataColumn0, key.FindProperty("Data")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataProtectedColumn, key.FindProperty("DataProtected")!, keysTableMapping); + RelationalModel.CreateColumnMapping(isX509CertificateColumn, key.FindProperty("IsX509Certificate")!, keysTableMapping); + RelationalModel.CreateColumnMapping(useColumn, key.FindProperty("Use")!, keysTableMapping); + RelationalModel.CreateColumnMapping(versionColumn, key.FindProperty("Version")!, keysTableMapping); + + var persistedGrant = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant")!; + + var defaultTableMappings10 = new List>(); + persistedGrant.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings10); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", null, relationalModel); + var clientIdColumnBase0 = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ClientId", clientIdColumnBase0); + var consumedTimeColumnBase = new ColumnBase("ConsumedTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ConsumedTime", consumedTimeColumnBase); + var creationTimeColumnBase0 = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("CreationTime", creationTimeColumnBase0); + var dataColumnBase1 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Data", dataColumnBase1); + var descriptionColumnBase1 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Description", descriptionColumnBase1); + var expirationColumnBase0 = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Expiration", expirationColumnBase0); + var keyColumnBase = new ColumnBase("Key", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Key", keyColumnBase); + var sessionIdColumnBase0 = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SessionId", sessionIdColumnBase0); + var subjectIdColumnBase0 = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SubjectId", subjectIdColumnBase0); + var typeColumnBase = new ColumnBase("Type", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Type", typeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase = new TableMappingBase(persistedGrant, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase, false); + defaultTableMappings10.Add(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)keyColumnBase, persistedGrant.FindProperty("Key")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase0, persistedGrant.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)consumedTimeColumnBase, persistedGrant.FindProperty("ConsumedTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase0, persistedGrant.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase1, persistedGrant.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase1, persistedGrant.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase0, persistedGrant.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase0, persistedGrant.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase0, persistedGrant.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)typeColumnBase, persistedGrant.FindProperty("Type")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + + var tableMappings10 = new List(); + persistedGrant.SetRuntimeAnnotation("Relational:TableMappings", tableMappings10); + var persistedGrantsTable = new Table("PersistedGrants", null, relationalModel); + var keyColumn = new Column("Key", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Key", keyColumn); + var clientIdColumn0 = new Column("ClientId", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("ClientId", clientIdColumn0); + var consumedTimeColumn = new Column("ConsumedTime", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("ConsumedTime", consumedTimeColumn); + var creationTimeColumn0 = new Column("CreationTime", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("CreationTime", creationTimeColumn0); + var dataColumn1 = new Column("Data", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Data", dataColumn1); + var descriptionColumn1 = new Column("Description", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Description", descriptionColumn1); + var expirationColumn0 = new Column("Expiration", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Expiration", expirationColumn0); + var sessionIdColumn0 = new Column("SessionId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SessionId", sessionIdColumn0); + var subjectIdColumn0 = new Column("SubjectId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SubjectId", subjectIdColumn0); + var typeColumn = new Column("Type", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Type", typeColumn); + var pK_PersistedGrants = new UniqueConstraint("PK_PersistedGrants", persistedGrantsTable, new[] { keyColumn }); + persistedGrantsTable.PrimaryKey = pK_PersistedGrants; + var pK_PersistedGrantsUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Key" }); + pK_PersistedGrants.MappedKeys.Add(pK_PersistedGrantsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PersistedGrantsUc).Add(pK_PersistedGrants); + persistedGrantsTable.UniqueConstraints.Add("PK_PersistedGrants", pK_PersistedGrants); + var iX_PersistedGrants_ConsumedTime = new TableIndex( + "IX_PersistedGrants_ConsumedTime", persistedGrantsTable, new[] { consumedTimeColumn }, false); + var iX_PersistedGrants_ConsumedTimeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "ConsumedTime" }); + iX_PersistedGrants_ConsumedTime.MappedIndexes.Add(iX_PersistedGrants_ConsumedTimeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ConsumedTimeIx).Add(iX_PersistedGrants_ConsumedTime); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_ConsumedTime", iX_PersistedGrants_ConsumedTime); + var iX_PersistedGrants_Expiration = new TableIndex( + "IX_PersistedGrants_Expiration", persistedGrantsTable, new[] { expirationColumn0 }, false); + var iX_PersistedGrants_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Expiration" }); + iX_PersistedGrants_Expiration.MappedIndexes.Add(iX_PersistedGrants_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ExpirationIx).Add(iX_PersistedGrants_Expiration); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_Expiration", iX_PersistedGrants_Expiration); + var iX_PersistedGrants_SubjectId_ClientId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_ClientId_Type", persistedGrantsTable, new[] { subjectIdColumn0, clientIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_ClientId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "ClientId", "Type" }); + iX_PersistedGrants_SubjectId_ClientId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_ClientId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_ClientId_TypeIx).Add(iX_PersistedGrants_SubjectId_ClientId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_ClientId_Type", iX_PersistedGrants_SubjectId_ClientId_Type); + var iX_PersistedGrants_SubjectId_SessionId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_SessionId_Type", persistedGrantsTable, new[] { subjectIdColumn0, sessionIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_SessionId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "SessionId", "Type" }); + iX_PersistedGrants_SubjectId_SessionId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_SessionId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_SessionId_TypeIx).Add(iX_PersistedGrants_SubjectId_SessionId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_SessionId_Type", iX_PersistedGrants_SubjectId_SessionId_Type); + relationalModel.Tables.Add(("PersistedGrants", null), persistedGrantsTable); + var persistedGrantsTableMapping = new TableMapping(persistedGrant, persistedGrantsTable, true); + persistedGrantsTable.AddTypeMapping(persistedGrantsTableMapping, false); + tableMappings10.Add(persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(keyColumn, persistedGrant.FindProperty("Key")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn0, persistedGrant.FindProperty("ClientId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(consumedTimeColumn, persistedGrant.FindProperty("ConsumedTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn0, persistedGrant.FindProperty("CreationTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(dataColumn1, persistedGrant.FindProperty("Data")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn1, persistedGrant.FindProperty("Description")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn0, persistedGrant.FindProperty("Expiration")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn0, persistedGrant.FindProperty("SessionId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn0, persistedGrant.FindProperty("SubjectId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(typeColumn, persistedGrant.FindProperty("Type")!, persistedGrantsTableMapping); + + var identityRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRole")!; + + var defaultTableMappings11 = new List>(); + identityRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings11); + var microsoftAspNetCoreIdentityIdentityRoleTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRole", null, relationalModel); + var concurrencyStampColumnBase0 = new ColumnBase("ConcurrencyStamp", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase0); + var idColumnBase5 = new ColumnBase("Id", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase); + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Id", idColumnBase5); + var nameColumnBase2 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Name", nameColumnBase2); + var normalizedNameColumnBase = new ColumnBase("NormalizedName", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("NormalizedName", normalizedNameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRole", microsoftAspNetCoreIdentityIdentityRoleTableBase); + var microsoftAspNetCoreIdentityIdentityRoleMappingBase = new TableMappingBase(identityRole, microsoftAspNetCoreIdentityIdentityRoleTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleMappingBase, false); + defaultTableMappings11.Add(microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase5, identityRole.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase0, identityRole.FindProperty("ConcurrencyStamp")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase2, identityRole.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedNameColumnBase, identityRole.FindProperty("NormalizedName")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + + var tableMappings11 = new List(); + identityRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings11); + var aspNetRolesTable = new Table("AspNetRoles", null, relationalModel); + var idColumn5 = new Column("Id", "TEXT", aspNetRolesTable); + aspNetRolesTable.Columns.Add("Id", idColumn5); + var concurrencyStampColumn0 = new Column("ConcurrencyStamp", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn0); + var nameColumn2 = new Column("Name", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("Name", nameColumn2); + var normalizedNameColumn = new Column("NormalizedName", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("NormalizedName", normalizedNameColumn); + var pK_AspNetRoles = new UniqueConstraint("PK_AspNetRoles", aspNetRolesTable, new[] { idColumn5 }); + aspNetRolesTable.PrimaryKey = pK_AspNetRoles; + var pK_AspNetRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + pK_AspNetRoles.MappedKeys.Add(pK_AspNetRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRolesUc).Add(pK_AspNetRoles); + aspNetRolesTable.UniqueConstraints.Add("PK_AspNetRoles", pK_AspNetRoles); + var roleNameIndex = new TableIndex( + "RoleNameIndex", aspNetRolesTable, new[] { normalizedNameColumn }, true); + var roleNameIndexIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "NormalizedName" }); + roleNameIndex.MappedIndexes.Add(roleNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(roleNameIndexIx).Add(roleNameIndex); + aspNetRolesTable.Indexes.Add("RoleNameIndex", roleNameIndex); + relationalModel.Tables.Add(("AspNetRoles", null), aspNetRolesTable); + var aspNetRolesTableMapping = new TableMapping(identityRole, aspNetRolesTable, true); + aspNetRolesTable.AddTypeMapping(aspNetRolesTableMapping, false); + tableMappings11.Add(aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(idColumn5, identityRole.FindProperty("Id")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn0, identityRole.FindProperty("ConcurrencyStamp")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(nameColumn2, identityRole.FindProperty("Name")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(normalizedNameColumn, identityRole.FindProperty("NormalizedName")!, aspNetRolesTableMapping); + + var identityRoleClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRoleClaim")!; + + var defaultTableMappings12 = new List>(); + identityRoleClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings12); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRoleClaim", null, relationalModel); + var claimTypeColumnBase = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase); + var claimValueColumnBase = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase); + var idColumnBase6 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("Id", idColumnBase6); + var roleIdColumnBase = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("RoleId", roleIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRoleClaim", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase = new TableMappingBase(identityRoleClaim, microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase, false); + defaultTableMappings12.Add(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase6, identityRoleClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase, identityRoleClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase, identityRoleClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase, identityRoleClaim.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + + var tableMappings12 = new List(); + identityRoleClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings12); + var aspNetRoleClaimsTable = new Table("AspNetRoleClaims", null, relationalModel); + var idColumn6 = new Column("Id", "INTEGER", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("Id", idColumn6); + var claimTypeColumn = new Column("ClaimType", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimType", claimTypeColumn); + var claimValueColumn = new Column("ClaimValue", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimValue", claimValueColumn); + var roleIdColumn = new Column("RoleId", "TEXT", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("RoleId", roleIdColumn); + var pK_AspNetRoleClaims = new UniqueConstraint("PK_AspNetRoleClaims", aspNetRoleClaimsTable, new[] { idColumn6 }); + aspNetRoleClaimsTable.PrimaryKey = pK_AspNetRoleClaims; + var pK_AspNetRoleClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "Id" }); + pK_AspNetRoleClaims.MappedKeys.Add(pK_AspNetRoleClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRoleClaimsUc).Add(pK_AspNetRoleClaims); + aspNetRoleClaimsTable.UniqueConstraints.Add("PK_AspNetRoleClaims", pK_AspNetRoleClaims); + var iX_AspNetRoleClaims_RoleId = new TableIndex( + "IX_AspNetRoleClaims_RoleId", aspNetRoleClaimsTable, new[] { roleIdColumn }, false); + var iX_AspNetRoleClaims_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }); + iX_AspNetRoleClaims_RoleId.MappedIndexes.Add(iX_AspNetRoleClaims_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetRoleClaims_RoleIdIx).Add(iX_AspNetRoleClaims_RoleId); + aspNetRoleClaimsTable.Indexes.Add("IX_AspNetRoleClaims_RoleId", iX_AspNetRoleClaims_RoleId); + relationalModel.Tables.Add(("AspNetRoleClaims", null), aspNetRoleClaimsTable); + var aspNetRoleClaimsTableMapping = new TableMapping(identityRoleClaim, aspNetRoleClaimsTable, true); + aspNetRoleClaimsTable.AddTypeMapping(aspNetRoleClaimsTableMapping, false); + tableMappings12.Add(aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn6, identityRoleClaim.FindProperty("Id")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn, identityRoleClaim.FindProperty("ClaimType")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn, identityRoleClaim.FindProperty("ClaimValue")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn, identityRoleClaim.FindProperty("RoleId")!, aspNetRoleClaimsTableMapping); + + var identityUserClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserClaim")!; + + var defaultTableMappings13 = new List>(); + identityUserClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings13); + var microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserClaim", null, relationalModel); + var claimTypeColumnBase0 = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase0); + var claimValueColumnBase0 = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase0); + var idColumnBase7 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("Id", idColumnBase7); + var userIdColumnBase1 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("UserId", userIdColumnBase1); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserClaim", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase = new TableMappingBase(identityUserClaim, microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase, false); + defaultTableMappings13.Add(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase7, identityUserClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase0, identityUserClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase0, identityUserClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase1, identityUserClaim.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + + var tableMappings13 = new List(); + identityUserClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings13); + var aspNetUserClaimsTable = new Table("AspNetUserClaims", null, relationalModel); + var idColumn7 = new Column("Id", "INTEGER", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("Id", idColumn7); + var claimTypeColumn0 = new Column("ClaimType", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimType", claimTypeColumn0); + var claimValueColumn0 = new Column("ClaimValue", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimValue", claimValueColumn0); + var userIdColumn1 = new Column("UserId", "TEXT", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("UserId", userIdColumn1); + var pK_AspNetUserClaims = new UniqueConstraint("PK_AspNetUserClaims", aspNetUserClaimsTable, new[] { idColumn7 }); + aspNetUserClaimsTable.PrimaryKey = pK_AspNetUserClaims; + var pK_AspNetUserClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "Id" }); + pK_AspNetUserClaims.MappedKeys.Add(pK_AspNetUserClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserClaimsUc).Add(pK_AspNetUserClaims); + aspNetUserClaimsTable.UniqueConstraints.Add("PK_AspNetUserClaims", pK_AspNetUserClaims); + var iX_AspNetUserClaims_UserId = new TableIndex( + "IX_AspNetUserClaims_UserId", aspNetUserClaimsTable, new[] { userIdColumn1 }, false); + var iX_AspNetUserClaims_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }); + iX_AspNetUserClaims_UserId.MappedIndexes.Add(iX_AspNetUserClaims_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserClaims_UserIdIx).Add(iX_AspNetUserClaims_UserId); + aspNetUserClaimsTable.Indexes.Add("IX_AspNetUserClaims_UserId", iX_AspNetUserClaims_UserId); + relationalModel.Tables.Add(("AspNetUserClaims", null), aspNetUserClaimsTable); + var aspNetUserClaimsTableMapping = new TableMapping(identityUserClaim, aspNetUserClaimsTable, true); + aspNetUserClaimsTable.AddTypeMapping(aspNetUserClaimsTableMapping, false); + tableMappings13.Add(aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn7, identityUserClaim.FindProperty("Id")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn0, identityUserClaim.FindProperty("ClaimType")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn0, identityUserClaim.FindProperty("ClaimValue")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn1, identityUserClaim.FindProperty("UserId")!, aspNetUserClaimsTableMapping); + + var identityUserLogin = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserLogin")!; + + var defaultTableMappings14 = new List>(); + identityUserLogin.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings14); + var microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserLogin", null, relationalModel); + var loginProviderColumnBase = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase); + var providerDisplayNameColumnBase = new ColumnBase("ProviderDisplayName", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderDisplayName", providerDisplayNameColumnBase); + var providerKeyColumnBase = new ColumnBase("ProviderKey", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderKey", providerKeyColumnBase); + var userIdColumnBase2 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("UserId", userIdColumnBase2); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserLogin", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase = new TableMappingBase(identityUserLogin, microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase, false); + defaultTableMappings14.Add(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase, identityUserLogin.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerKeyColumnBase, identityUserLogin.FindProperty("ProviderKey")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerDisplayNameColumnBase, identityUserLogin.FindProperty("ProviderDisplayName")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase2, identityUserLogin.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + + var tableMappings14 = new List(); + identityUserLogin.SetRuntimeAnnotation("Relational:TableMappings", tableMappings14); + var aspNetUserLoginsTable = new Table("AspNetUserLogins", null, relationalModel); + var loginProviderColumn = new Column("LoginProvider", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("LoginProvider", loginProviderColumn); + var providerKeyColumn = new Column("ProviderKey", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("ProviderKey", providerKeyColumn); + var providerDisplayNameColumn = new Column("ProviderDisplayName", "TEXT", aspNetUserLoginsTable) + { + IsNullable = true + }; + aspNetUserLoginsTable.Columns.Add("ProviderDisplayName", providerDisplayNameColumn); + var userIdColumn2 = new Column("UserId", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("UserId", userIdColumn2); + var pK_AspNetUserLogins = new UniqueConstraint("PK_AspNetUserLogins", aspNetUserLoginsTable, new[] { loginProviderColumn, providerKeyColumn }); + aspNetUserLoginsTable.PrimaryKey = pK_AspNetUserLogins; + var pK_AspNetUserLoginsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "LoginProvider", "ProviderKey" }); + pK_AspNetUserLogins.MappedKeys.Add(pK_AspNetUserLoginsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserLoginsUc).Add(pK_AspNetUserLogins); + aspNetUserLoginsTable.UniqueConstraints.Add("PK_AspNetUserLogins", pK_AspNetUserLogins); + var iX_AspNetUserLogins_UserId = new TableIndex( + "IX_AspNetUserLogins_UserId", aspNetUserLoginsTable, new[] { userIdColumn2 }, false); + var iX_AspNetUserLogins_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }); + iX_AspNetUserLogins_UserId.MappedIndexes.Add(iX_AspNetUserLogins_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserLogins_UserIdIx).Add(iX_AspNetUserLogins_UserId); + aspNetUserLoginsTable.Indexes.Add("IX_AspNetUserLogins_UserId", iX_AspNetUserLogins_UserId); + relationalModel.Tables.Add(("AspNetUserLogins", null), aspNetUserLoginsTable); + var aspNetUserLoginsTableMapping = new TableMapping(identityUserLogin, aspNetUserLoginsTable, true); + aspNetUserLoginsTable.AddTypeMapping(aspNetUserLoginsTableMapping, false); + tableMappings14.Add(aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn, identityUserLogin.FindProperty("LoginProvider")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerKeyColumn, identityUserLogin.FindProperty("ProviderKey")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerDisplayNameColumn, identityUserLogin.FindProperty("ProviderDisplayName")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn2, identityUserLogin.FindProperty("UserId")!, aspNetUserLoginsTableMapping); + + var identityUserRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserRole")!; + + var defaultTableMappings15 = new List>(); + identityUserRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings15); + var microsoftAspNetCoreIdentityIdentityUserRolestringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserRole", null, relationalModel); + var roleIdColumnBase0 = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("RoleId", roleIdColumnBase0); + var userIdColumnBase3 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("UserId", userIdColumnBase3); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserRole", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + var microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase = new TableMappingBase(identityUserRole, microsoftAspNetCoreIdentityIdentityUserRolestringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase, false); + defaultTableMappings15.Add(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase0, identityUserRole.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase3, identityUserRole.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + + var tableMappings15 = new List(); + identityUserRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings15); + var aspNetUserRolesTable = new Table("AspNetUserRoles", null, relationalModel); + var userIdColumn3 = new Column("UserId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("UserId", userIdColumn3); + var roleIdColumn0 = new Column("RoleId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("RoleId", roleIdColumn0); + var pK_AspNetUserRoles = new UniqueConstraint("PK_AspNetUserRoles", aspNetUserRolesTable, new[] { userIdColumn3, roleIdColumn0 }); + aspNetUserRolesTable.PrimaryKey = pK_AspNetUserRoles; + var pK_AspNetUserRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId", "RoleId" }); + pK_AspNetUserRoles.MappedKeys.Add(pK_AspNetUserRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserRolesUc).Add(pK_AspNetUserRoles); + aspNetUserRolesTable.UniqueConstraints.Add("PK_AspNetUserRoles", pK_AspNetUserRoles); + var iX_AspNetUserRoles_RoleId = new TableIndex( + "IX_AspNetUserRoles_RoleId", aspNetUserRolesTable, new[] { roleIdColumn0 }, false); + var iX_AspNetUserRoles_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }); + iX_AspNetUserRoles_RoleId.MappedIndexes.Add(iX_AspNetUserRoles_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserRoles_RoleIdIx).Add(iX_AspNetUserRoles_RoleId); + aspNetUserRolesTable.Indexes.Add("IX_AspNetUserRoles_RoleId", iX_AspNetUserRoles_RoleId); + relationalModel.Tables.Add(("AspNetUserRoles", null), aspNetUserRolesTable); + var aspNetUserRolesTableMapping = new TableMapping(identityUserRole, aspNetUserRolesTable, true); + aspNetUserRolesTable.AddTypeMapping(aspNetUserRolesTableMapping, false); + tableMappings15.Add(aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn0, identityUserRole.FindProperty("RoleId")!, aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn3, identityUserRole.FindProperty("UserId")!, aspNetUserRolesTableMapping); + + var identityUserToken = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserToken")!; + + var defaultTableMappings16 = new List>(); + identityUserToken.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings16); + var microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserToken", null, relationalModel); + var loginProviderColumnBase0 = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase0); + var nameColumnBase3 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Name", nameColumnBase3); + var userIdColumnBase4 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("UserId", userIdColumnBase4); + var valueColumnBase = new ColumnBase("Value", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Value", valueColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserToken", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase = new TableMappingBase(identityUserToken, microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase, false); + defaultTableMappings16.Add(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase0, identityUserToken.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase3, identityUserToken.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase4, identityUserToken.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueColumnBase, identityUserToken.FindProperty("Value")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + + var tableMappings16 = new List(); + identityUserToken.SetRuntimeAnnotation("Relational:TableMappings", tableMappings16); + var aspNetUserTokensTable = new Table("AspNetUserTokens", null, relationalModel); + var userIdColumn4 = new Column("UserId", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("UserId", userIdColumn4); + var loginProviderColumn0 = new Column("LoginProvider", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("LoginProvider", loginProviderColumn0); + var nameColumn3 = new Column("Name", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("Name", nameColumn3); + var valueColumn = new Column("Value", "TEXT", aspNetUserTokensTable) + { + IsNullable = true + }; + aspNetUserTokensTable.Columns.Add("Value", valueColumn); + var pK_AspNetUserTokens = new UniqueConstraint("PK_AspNetUserTokens", aspNetUserTokensTable, new[] { userIdColumn4, loginProviderColumn0, nameColumn3 }); + aspNetUserTokensTable.PrimaryKey = pK_AspNetUserTokens; + var pK_AspNetUserTokensUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId", "LoginProvider", "Name" }); + pK_AspNetUserTokens.MappedKeys.Add(pK_AspNetUserTokensUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserTokensUc).Add(pK_AspNetUserTokens); + aspNetUserTokensTable.UniqueConstraints.Add("PK_AspNetUserTokens", pK_AspNetUserTokens); + relationalModel.Tables.Add(("AspNetUserTokens", null), aspNetUserTokensTable); + var aspNetUserTokensTableMapping = new TableMapping(identityUserToken, aspNetUserTokensTable, true); + aspNetUserTokensTable.AddTypeMapping(aspNetUserTokensTableMapping, false); + tableMappings16.Add(aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn0, identityUserToken.FindProperty("LoginProvider")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(nameColumn3, identityUserToken.FindProperty("Name")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn4, identityUserToken.FindProperty("UserId")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(valueColumn, identityUserToken.FindProperty("Value")!, aspNetUserTokensTableMapping); + var fK_AspNetRoleClaims_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetRoleClaims_AspNetRoles_RoleId", aspNetRoleClaimsTable, aspNetRolesTable, + new[] { roleIdColumn }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetRoleClaims_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetRoleClaims_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk).Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRoleClaimsTable.ForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + var fK_AspNetUserClaims_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserClaims_AspNetUsers_UserId", aspNetUserClaimsTable, aspNetUsersTable, + new[] { userIdColumn1 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserClaims_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserClaims_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserClaims_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserClaims_AspNetUsers_UserIdFk).Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUserClaimsTable.ForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + var fK_AspNetUserLogins_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserLogins_AspNetUsers_UserId", aspNetUserLoginsTable, aspNetUsersTable, + new[] { userIdColumn2 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserLogins_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserLogins_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserLogins_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserLogins_AspNetUsers_UserIdFk).Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUserLoginsTable.ForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + var fK_AspNetUserRoles_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetRoles_RoleId", aspNetUserRolesTable, aspNetRolesTable, + new[] { roleIdColumn0 }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetRoles_RoleIdFk).Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + var fK_AspNetUserRoles_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetUsers_UserId", aspNetUserRolesTable, aspNetUsersTable, + new[] { userIdColumn3 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetUsers_UserIdFk).Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + var fK_AspNetUserTokens_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserTokens_AspNetUsers_UserId", aspNetUserTokensTable, aspNetUsersTable, + new[] { userIdColumn4 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserTokens_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserTokens_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserTokens_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserTokens_AspNetUsers_UserIdFk).Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUserTokensTable.ForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + var fK_Orders_Address_DeliveryAddressId = new ForeignKeyConstraint( + "FK_Orders_Address_DeliveryAddressId", ordersTable, addressTable, + new[] { deliveryAddressIdColumn }, + addressTable.FindUniqueConstraint("PK_Address")!, ReferentialAction.Cascade); + var fK_Orders_Address_DeliveryAddressIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }, + "BlazingPizza.Address", + new[] { "Id" }); + fK_Orders_Address_DeliveryAddressId.MappedForeignKeys.Add(fK_Orders_Address_DeliveryAddressIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Orders_Address_DeliveryAddressIdFk).Add(fK_Orders_Address_DeliveryAddressId); + ordersTable.ForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + addressTable.ReferencingForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + var fK_Pizzas_Orders_OrderId = new ForeignKeyConstraint( + "FK_Pizzas_Orders_OrderId", pizzasTable, ordersTable, + new[] { orderIdColumn0 }, + ordersTable.FindUniqueConstraint("PK_Orders")!, ReferentialAction.Cascade); + var fK_Pizzas_Orders_OrderIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" }); + fK_Pizzas_Orders_OrderId.MappedForeignKeys.Add(fK_Pizzas_Orders_OrderIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Orders_OrderIdFk).Add(fK_Pizzas_Orders_OrderId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + ordersTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + var fK_Pizzas_Specials_SpecialId = new ForeignKeyConstraint( + "FK_Pizzas_Specials_SpecialId", pizzasTable, specialsTable, + new[] { specialIdColumn }, + specialsTable.FindUniqueConstraint("PK_Specials")!, ReferentialAction.Cascade); + var fK_Pizzas_Specials_SpecialIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + fK_Pizzas_Specials_SpecialId.MappedForeignKeys.Add(fK_Pizzas_Specials_SpecialIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Specials_SpecialIdFk).Add(fK_Pizzas_Specials_SpecialId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + specialsTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + var fK_PizzaTopping_Pizzas_PizzaId = new ForeignKeyConstraint( + "FK_PizzaTopping_Pizzas_PizzaId", pizzaToppingTable, pizzasTable, + new[] { pizzaIdColumn }, + pizzasTable.FindUniqueConstraint("PK_Pizzas")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Pizzas_PizzaIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId" }, + "BlazingPizza.Pizza", + new[] { "Id" }); + fK_PizzaTopping_Pizzas_PizzaId.MappedForeignKeys.Add(fK_PizzaTopping_Pizzas_PizzaIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Pizzas_PizzaIdFk).Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzasTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + var fK_PizzaTopping_Toppings_ToppingId = new ForeignKeyConstraint( + "FK_PizzaTopping_Toppings_ToppingId", pizzaToppingTable, toppingsTable, + new[] { toppingIdColumn }, + toppingsTable.FindUniqueConstraint("PK_Toppings")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Toppings_ToppingIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }, + "BlazingPizza.Topping", + new[] { "Id" }); + fK_PizzaTopping_Toppings_ToppingId.MappedForeignKeys.Add(fK_PizzaTopping_Toppings_ToppingIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Toppings_ToppingIdFk).Add(fK_PizzaTopping_Toppings_ToppingId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + toppingsTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs similarity index 63% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs index 18b2d96d..7295425c 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs @@ -2,12 +2,15 @@ using System; using System.Reflection; using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaStoreUserEntityType { @@ -24,12 +27,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var accessFailedCount = runtimeEntityType.AddProperty( "AccessFailedCount", typeof(int), propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + accessFailedCount.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var concurrencyStamp = runtimeEntityType.AddProperty( "ConcurrencyStamp", @@ -38,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; var email = runtimeEntityType.AddProperty( "Email", @@ -46,18 +67,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + email.TypeMapping = SqliteStringTypeMapping.Default; var emailConfirmed = runtimeEntityType.AddProperty( "EmailConfirmed", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + emailConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var lockoutEnabled = runtimeEntityType.AddProperty( "LockoutEnabled", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + lockoutEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var lockoutEnd = runtimeEntityType.AddProperty( "LockoutEnd", @@ -65,6 +119,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + lockoutEnd.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default; var normalizedEmail = runtimeEntityType.AddProperty( "NormalizedEmail", @@ -73,6 +128,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedEmail.TypeMapping = SqliteStringTypeMapping.Default; var normalizedUserName = runtimeEntityType.AddProperty( "NormalizedUserName", @@ -81,6 +137,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedUserName.TypeMapping = SqliteStringTypeMapping.Default; var passwordHash = runtimeEntityType.AddProperty( "PasswordHash", @@ -88,6 +145,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + passwordHash.TypeMapping = SqliteStringTypeMapping.Default; var phoneNumber = runtimeEntityType.AddProperty( "PhoneNumber", @@ -95,12 +153,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + phoneNumber.TypeMapping = SqliteStringTypeMapping.Default; var phoneNumberConfirmed = runtimeEntityType.AddProperty( "PhoneNumberConfirmed", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + phoneNumberConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var securityStamp = runtimeEntityType.AddProperty( "SecurityStamp", @@ -108,12 +183,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + securityStamp.TypeMapping = SqliteStringTypeMapping.Default; var twoFactorEnabled = runtimeEntityType.AddProperty( "TwoFactorEnabled", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + twoFactorEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var userName = runtimeEntityType.AddProperty( "UserName", @@ -122,6 +214,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + userName.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaToppingEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs similarity index 72% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaToppingEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs index b97d2a24..803ab153 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaToppingEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaToppingEntityType { @@ -24,14 +26,46 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int), propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + pizzaId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var toppingId = runtimeEntityType.AddProperty( "ToppingId", typeof(int), propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + toppingId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { pizzaId, toppingId }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/ToppingEntityType.cs b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs similarity index 68% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/ToppingEntityType.cs rename to save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs index 9295f9bf..d3a19507 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/ToppingEntityType.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class ToppingEntityType { @@ -23,20 +26,38 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var name = runtimeEntityType.AddProperty( "Name", typeof(string), propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; var price = runtimeEntityType.AddProperty( "Price", typeof(decimal), propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + price.TypeMapping = SqliteDecimalTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs b/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs deleted file mode 100644 index ba42d6b0..00000000 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - public partial class PizzaStoreContextModel - { - partial void Initialize() - { - var address = AddressEntityType.Create(this); - var latLong = LatLongEntityType.Create(this); - var notificationSubscription = NotificationSubscriptionEntityType.Create(this); - var order = OrderEntityType.Create(this); - var pizza = PizzaEntityType.Create(this); - var pizzaSpecial = PizzaSpecialEntityType.Create(this); - var pizzaTopping = PizzaToppingEntityType.Create(this); - var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); - var topping = ToppingEntityType.Create(this); - var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); - var key = KeyEntityType.Create(this); - var persistedGrant = PersistedGrantEntityType.Create(this); - var identityRole = IdentityRoleEntityType.Create(this); - var identityRoleClaimstring = IdentityRoleClaimstringEntityType.Create(this); - var identityUserClaimstring = IdentityUserClaimstringEntityType.Create(this); - var identityUserLoginstring = IdentityUserLoginstringEntityType.Create(this); - var identityUserRolestring = IdentityUserRolestringEntityType.Create(this); - var identityUserTokenstring = IdentityUserTokenstringEntityType.Create(this); - - LatLongEntityType.CreateForeignKey1(latLong, order); - OrderEntityType.CreateForeignKey1(order, address); - PizzaEntityType.CreateForeignKey1(pizza, order); - PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); - PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); - PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); - IdentityRoleClaimstringEntityType.CreateForeignKey1(identityRoleClaimstring, identityRole); - IdentityUserClaimstringEntityType.CreateForeignKey1(identityUserClaimstring, pizzaStoreUser); - IdentityUserLoginstringEntityType.CreateForeignKey1(identityUserLoginstring, pizzaStoreUser); - IdentityUserRolestringEntityType.CreateForeignKey1(identityUserRolestring, identityRole); - IdentityUserRolestringEntityType.CreateForeignKey2(identityUserRolestring, pizzaStoreUser); - IdentityUserTokenstringEntityType.CreateForeignKey1(identityUserTokenstring, pizzaStoreUser); - - AddressEntityType.CreateAnnotations(address); - LatLongEntityType.CreateAnnotations(latLong); - NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); - OrderEntityType.CreateAnnotations(order); - PizzaEntityType.CreateAnnotations(pizza); - PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); - PizzaToppingEntityType.CreateAnnotations(pizzaTopping); - PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); - ToppingEntityType.CreateAnnotations(topping); - DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); - KeyEntityType.CreateAnnotations(key); - PersistedGrantEntityType.CreateAnnotations(persistedGrant); - IdentityRoleEntityType.CreateAnnotations(identityRole); - IdentityRoleClaimstringEntityType.CreateAnnotations(identityRoleClaimstring); - IdentityUserClaimstringEntityType.CreateAnnotations(identityUserClaimstring); - IdentityUserLoginstringEntityType.CreateAnnotations(identityUserLoginstring); - IdentityUserRolestringEntityType.CreateAnnotations(identityUserRolestring); - IdentityUserTokenstringEntityType.CreateAnnotations(identityUserTokenstring); - - AddAnnotation("ProductVersion", "7.0.0"); - } - } -} diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Program.cs b/save-points/03-show-order-status/BlazingPizza.Server/Program.cs index b83debb4..9db9e7ea 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Program.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddDbContext(options => options.UseSqlite("Data Source=pizza.db") - .UseModel(BlazingPizza.Server.Models.PizzaStoreContextModel.Instance)); + .UseModel(BlazingPizza.Server.CompiledModels.PizzaStoreContextModel.Instance)); builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/SeedData.cs b/save-points/03-show-order-status/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/SeedData.cs +++ b/save-points/03-show-order-status/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/04-refactor-state-management/BlazingPizza.Server/BlazingPizza.Server.csproj index a1043cb6..e8687fc4 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/BlazingPizza.Server.sln b/save-points/04-refactor-state-management/BlazingPizza.Server/BlazingPizza.Server.sln new file mode 100644 index 00000000..65c513d9 --- /dev/null +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/BlazingPizza.Server.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazingPizza.Server", "BlazingPizza.Server.csproj", "{D73BBCF6-9CEE-4067-813A-9B624CA40B14}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D73BBCF6-9CEE-4067-813A-9B624CA40B14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D73BBCF6-9CEE-4067-813A-9B624CA40B14}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D73BBCF6-9CEE-4067-813A-9B624CA40B14}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D73BBCF6-9CEE-4067-813A-9B624CA40B14}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3657D7C9-159B-4738-B1E5-2CF183755F86} + EndGlobalSection +EndGlobal diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/AddressEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/AddressEntityType.cs new file mode 100644 index 00000000..52f13d8a --- /dev/null +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/AddressEntityType.cs @@ -0,0 +1,110 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class AddressEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Address", + typeof(Address), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var city = runtimeEntityType.AddProperty( + "City", + typeof(string), + propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + city.TypeMapping = SqliteStringTypeMapping.Default; + + var line1 = runtimeEntityType.AddProperty( + "Line1", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + line1.TypeMapping = SqliteStringTypeMapping.Default; + + var line2 = runtimeEntityType.AddProperty( + "Line2", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + line2.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var postalCode = runtimeEntityType.AddProperty( + "PostalCode", + typeof(string), + propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + postalCode.TypeMapping = SqliteStringTypeMapping.Default; + + var region = runtimeEntityType.AddProperty( + "Region", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + region.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Address"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs similarity index 87% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs index 1dd4563b..6c5ca661 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class DeviceFlowCodesEntityType { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 200); + userCode.TypeMapping = SqliteStringTypeMapping.Default; var clientId = runtimeEntityType.AddProperty( "ClientId", @@ -32,12 +34,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; var creationTime = runtimeEntityType.AddProperty( "CreationTime", typeof(DateTime), propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", @@ -45,6 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", @@ -53,6 +59,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; var deviceCode = runtimeEntityType.AddProperty( "DeviceCode", @@ -60,12 +67,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + deviceCode.TypeMapping = SqliteStringTypeMapping.Default; var expiration = runtimeEntityType.AddProperty( "Expiration", typeof(DateTime?), propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; var sessionId = runtimeEntityType.AddProperty( "SessionId", @@ -74,6 +83,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; var subjectId = runtimeEntityType.AddProperty( "SubjectId", @@ -82,6 +92,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userCode }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs similarity index 76% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs index 8946b261..73cabada 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs @@ -3,14 +3,17 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityRoleClaimstringEntityType + internal partial class IdentityRoleClaimEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,7 +28,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var claimType = runtimeEntityType.AddProperty( "ClaimType", @@ -33,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; var claimValue = runtimeEntityType.AddProperty( "ClaimValue", @@ -40,12 +60,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; var roleId = runtimeEntityType.AddProperty( "RoleId", typeof(string), propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + roleId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs similarity index 90% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityRoleEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs index 2f1fec2b..3f46cdc5 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityRoleEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class IdentityRoleEntityType { @@ -24,6 +25,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var concurrencyStamp = runtimeEntityType.AddProperty( "ConcurrencyStamp", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -40,6 +43,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + name.TypeMapping = SqliteStringTypeMapping.Default; var normalizedName = runtimeEntityType.AddProperty( "NormalizedName", @@ -48,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedName.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs similarity index 76% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs index 55418a1e..5de58bf8 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs @@ -3,14 +3,17 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserClaimstringEntityType + internal partial class IdentityUserClaimEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,7 +28,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var claimType = runtimeEntityType.AddProperty( "ClaimType", @@ -33,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; var claimValue = runtimeEntityType.AddProperty( "ClaimValue", @@ -40,12 +60,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", typeof(string), propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs similarity index 90% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs index 3ca029bd..fb868abc 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserLoginstringEntityType + internal partial class IdentityUserLoginEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -26,6 +27,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; var providerKey = runtimeEntityType.AddProperty( "ProviderKey", @@ -34,6 +36,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + providerKey.TypeMapping = SqliteStringTypeMapping.Default; var providerDisplayName = runtimeEntityType.AddProperty( "ProviderDisplayName", @@ -41,12 +44,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + providerDisplayName.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", typeof(string), propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { loginProvider, providerKey }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs similarity index 92% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs index 70078d7a..f22fd836 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserRolestringEntityType + internal partial class IdentityUserRoleEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; var roleId = runtimeEntityType.AddProperty( "RoleId", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + roleId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userId, roleId }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs similarity index 90% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs index 93ba6d31..b4e36069 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserTokenstringEntityType + internal partial class IdentityUserTokenEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; var loginProvider = runtimeEntityType.AddProperty( "LoginProvider", @@ -33,6 +35,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -41,6 +44,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + name.TypeMapping = SqliteStringTypeMapping.Default; var value = runtimeEntityType.AddProperty( "Value", @@ -48,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + value.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userId, loginProvider, name }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/KeyEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/KeyEntityType.cs similarity index 61% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/KeyEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/KeyEntityType.cs index f6c6b4c7..8743240a 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/KeyEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/KeyEntityType.cs @@ -2,12 +2,15 @@ using System; using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class KeyEntityType { @@ -24,6 +27,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var algorithm = runtimeEntityType.AddProperty( "Algorithm", @@ -31,30 +35,66 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + algorithm.TypeMapping = SqliteStringTypeMapping.Default; var created = runtimeEntityType.AddProperty( "Created", typeof(DateTime), propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + created.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", typeof(string), propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + data.TypeMapping = SqliteStringTypeMapping.Default; var dataProtected = runtimeEntityType.AddProperty( "DataProtected", typeof(bool), propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + dataProtected.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var isX509Certificate = runtimeEntityType.AddProperty( "IsX509Certificate", typeof(bool), propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + isX509Certificate.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var use = runtimeEntityType.AddProperty( "Use", @@ -62,12 +102,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + use.TypeMapping = SqliteStringTypeMapping.Default; var version = runtimeEntityType.AddProperty( "Version", typeof(int), propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + version.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/LatLongEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs similarity index 56% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/LatLongEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs index 3fd254bd..657b8093 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/LatLongEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs @@ -2,12 +2,14 @@ using System; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class LatLongEntityType { @@ -21,19 +23,67 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas var orderId = runtimeEntityType.AddProperty( "OrderId", typeof(int), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var latitude = runtimeEntityType.AddProperty( "Latitude", typeof(double), propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + latitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); var longitude = runtimeEntityType.AddProperty( "Longitude", typeof(double), propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + longitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); var key = runtimeEntityType.AddKey( new[] { orderId }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs similarity index 68% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs index db236e4c..891722a1 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class NotificationSubscriptionEntityType { @@ -19,11 +22,26 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas var notificationSubscriptionId = runtimeEntityType.AddProperty( "NotificationSubscriptionId", - typeof(int), + typeof(int?), propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + notificationSubscriptionId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + keyComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + providerValueComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var auth = runtimeEntityType.AddProperty( "Auth", @@ -31,6 +49,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + auth.TypeMapping = SqliteStringTypeMapping.Default; var p256dh = runtimeEntityType.AddProperty( "P256dh", @@ -38,6 +57,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + p256dh.TypeMapping = SqliteStringTypeMapping.Default; var url = runtimeEntityType.AddProperty( "Url", @@ -45,6 +65,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + url.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", @@ -52,6 +73,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { notificationSubscriptionId }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/OrderEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/OrderEntityType.cs similarity index 63% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/OrderEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/OrderEntityType.cs index 9d9ec6fd..bf1e5171 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/OrderEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/OrderEntityType.cs @@ -1,12 +1,16 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class OrderEntityType { @@ -23,18 +27,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var createdTime = runtimeEntityType.AddProperty( "CreatedTime", typeof(DateTime), propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + createdTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var deliveryAddressId = runtimeEntityType.AddProperty( "DeliveryAddressId", - typeof(int?), - nullable: true); + typeof(int), + sentinel: 0); + deliveryAddressId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var userId = runtimeEntityType.AddProperty( "UserId", @@ -42,6 +79,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { orderId }); @@ -57,7 +95,9 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType); + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", runtimeForeignKey, diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PersistedGrantEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs similarity index 87% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PersistedGrantEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs index 842d53a5..c57731dd 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PersistedGrantEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PersistedGrantEntityType { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 200); + key.TypeMapping = SqliteStringTypeMapping.Default; var clientId = runtimeEntityType.AddProperty( "ClientId", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; var consumedTime = runtimeEntityType.AddProperty( "ConsumedTime", @@ -39,12 +42,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + consumedTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var creationTime = runtimeEntityType.AddProperty( "CreationTime", typeof(DateTime), propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", @@ -52,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", @@ -60,6 +67,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; var expiration = runtimeEntityType.AddProperty( "Expiration", @@ -67,6 +75,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; var sessionId = runtimeEntityType.AddProperty( "SessionId", @@ -75,6 +84,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; var subjectId = runtimeEntityType.AddProperty( "SubjectId", @@ -83,6 +93,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; var type = runtimeEntityType.AddProperty( "Type", @@ -90,6 +101,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + type.TypeMapping = SqliteStringTypeMapping.Default; var key0 = runtimeEntityType.AddKey( new[] { key }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs similarity index 62% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs index 3a124e63..f8ac05e4 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaEntityType { @@ -25,25 +27,89 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var orderId = runtimeEntityType.AddProperty( "OrderId", typeof(int), propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var size = runtimeEntityType.AddProperty( "Size", typeof(int), propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + size.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var specialId = runtimeEntityType.AddProperty( "SpecialId", typeof(int), propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + specialId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs similarity index 70% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs index e86b0f50..693286c8 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaSpecialEntityType { @@ -23,34 +26,52 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var basePrice = runtimeEntityType.AddProperty( "BasePrice", typeof(decimal), propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + basePrice.TypeMapping = SqliteDecimalTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + description.TypeMapping = SqliteStringTypeMapping.Default; var imageUrl = runtimeEntityType.AddProperty( "ImageUrl", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + imageUrl.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreContextModel.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs similarity index 50% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreContextModel.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs index 8b516a68..b7e36125 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreContextModel.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs @@ -5,15 +5,34 @@ #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { [DbContext(typeof(PizzaStoreContext))] public partial class PizzaStoreContextModel : RuntimeModel { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + static PizzaStoreContextModel() { var model = new PizzaStoreContextModel(); - model.Initialize(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + model.Customize(); _instance = model; } diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs new file mode 100644 index 00000000..0f8d07cb --- /dev/null +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs @@ -0,0 +1,1619 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + public partial class PizzaStoreContextModel + { + partial void Initialize() + { + var address = AddressEntityType.Create(this); + var latLong = LatLongEntityType.Create(this); + var notificationSubscription = NotificationSubscriptionEntityType.Create(this); + var order = OrderEntityType.Create(this); + var pizza = PizzaEntityType.Create(this); + var pizzaSpecial = PizzaSpecialEntityType.Create(this); + var pizzaTopping = PizzaToppingEntityType.Create(this); + var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); + var topping = ToppingEntityType.Create(this); + var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); + var key = KeyEntityType.Create(this); + var persistedGrant = PersistedGrantEntityType.Create(this); + var identityRole = IdentityRoleEntityType.Create(this); + var identityRoleClaim = IdentityRoleClaimEntityType.Create(this); + var identityUserClaim = IdentityUserClaimEntityType.Create(this); + var identityUserLogin = IdentityUserLoginEntityType.Create(this); + var identityUserRole = IdentityUserRoleEntityType.Create(this); + var identityUserToken = IdentityUserTokenEntityType.Create(this); + + LatLongEntityType.CreateForeignKey1(latLong, order); + OrderEntityType.CreateForeignKey1(order, address); + PizzaEntityType.CreateForeignKey1(pizza, order); + PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); + PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); + PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); + IdentityRoleClaimEntityType.CreateForeignKey1(identityRoleClaim, identityRole); + IdentityUserClaimEntityType.CreateForeignKey1(identityUserClaim, pizzaStoreUser); + IdentityUserLoginEntityType.CreateForeignKey1(identityUserLogin, pizzaStoreUser); + IdentityUserRoleEntityType.CreateForeignKey1(identityUserRole, identityRole); + IdentityUserRoleEntityType.CreateForeignKey2(identityUserRole, pizzaStoreUser); + IdentityUserTokenEntityType.CreateForeignKey1(identityUserToken, pizzaStoreUser); + + AddressEntityType.CreateAnnotations(address); + LatLongEntityType.CreateAnnotations(latLong); + NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); + OrderEntityType.CreateAnnotations(order); + PizzaEntityType.CreateAnnotations(pizza); + PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); + PizzaToppingEntityType.CreateAnnotations(pizzaTopping); + PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); + ToppingEntityType.CreateAnnotations(topping); + DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); + KeyEntityType.CreateAnnotations(key); + PersistedGrantEntityType.CreateAnnotations(persistedGrant); + IdentityRoleEntityType.CreateAnnotations(identityRole); + IdentityRoleClaimEntityType.CreateAnnotations(identityRoleClaim); + IdentityUserClaimEntityType.CreateAnnotations(identityUserClaim); + IdentityUserLoginEntityType.CreateAnnotations(identityUserLogin); + IdentityUserRoleEntityType.CreateAnnotations(identityUserRole); + IdentityUserTokenEntityType.CreateAnnotations(identityUserToken); + + AddAnnotation("ProductVersion", "8.0.0"); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var address = FindEntityType("BlazingPizza.Address")!; + + var defaultTableMappings = new List>(); + address.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var blazingPizzaAddressTableBase = new TableBase("BlazingPizza.Address", null, relationalModel); + var cityColumnBase = new ColumnBase("City", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("City", cityColumnBase); + var idColumnBase = new ColumnBase("Id", "INTEGER", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Id", idColumnBase); + var line1ColumnBase = new ColumnBase("Line1", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line1", line1ColumnBase); + var line2ColumnBase = new ColumnBase("Line2", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line2", line2ColumnBase); + var nameColumnBase = new ColumnBase("Name", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Name", nameColumnBase); + var postalCodeColumnBase = new ColumnBase("PostalCode", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("PostalCode", postalCodeColumnBase); + var regionColumnBase = new ColumnBase("Region", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Region", regionColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Address", blazingPizzaAddressTableBase); + var blazingPizzaAddressMappingBase = new TableMappingBase(address, blazingPizzaAddressTableBase, true); + blazingPizzaAddressTableBase.AddTypeMapping(blazingPizzaAddressMappingBase, false); + defaultTableMappings.Add(blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, address.FindProperty("Id")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)cityColumnBase, address.FindProperty("City")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line1ColumnBase, address.FindProperty("Line1")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line2ColumnBase, address.FindProperty("Line2")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase, address.FindProperty("Name")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)postalCodeColumnBase, address.FindProperty("PostalCode")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)regionColumnBase, address.FindProperty("Region")!, blazingPizzaAddressMappingBase); + + var tableMappings = new List(); + address.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var addressTable = new Table("Address", null, relationalModel); + var idColumn = new Column("Id", "INTEGER", addressTable); + addressTable.Columns.Add("Id", idColumn); + var cityColumn = new Column("City", "TEXT", addressTable); + addressTable.Columns.Add("City", cityColumn); + var line1Column = new Column("Line1", "TEXT", addressTable); + addressTable.Columns.Add("Line1", line1Column); + var line2Column = new Column("Line2", "TEXT", addressTable); + addressTable.Columns.Add("Line2", line2Column); + var nameColumn = new Column("Name", "TEXT", addressTable); + addressTable.Columns.Add("Name", nameColumn); + var postalCodeColumn = new Column("PostalCode", "TEXT", addressTable); + addressTable.Columns.Add("PostalCode", postalCodeColumn); + var regionColumn = new Column("Region", "TEXT", addressTable); + addressTable.Columns.Add("Region", regionColumn); + var pK_Address = new UniqueConstraint("PK_Address", addressTable, new[] { idColumn }); + addressTable.PrimaryKey = pK_Address; + var pK_AddressUc = RelationalModel.GetKey(this, + "BlazingPizza.Address", + new[] { "Id" }); + pK_Address.MappedKeys.Add(pK_AddressUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AddressUc).Add(pK_Address); + addressTable.UniqueConstraints.Add("PK_Address", pK_Address); + relationalModel.Tables.Add(("Address", null), addressTable); + var addressTableMapping = new TableMapping(address, addressTable, true); + addressTable.AddTypeMapping(addressTableMapping, false); + tableMappings.Add(addressTableMapping); + RelationalModel.CreateColumnMapping(idColumn, address.FindProperty("Id")!, addressTableMapping); + RelationalModel.CreateColumnMapping(cityColumn, address.FindProperty("City")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line1Column, address.FindProperty("Line1")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line2Column, address.FindProperty("Line2")!, addressTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, address.FindProperty("Name")!, addressTableMapping); + RelationalModel.CreateColumnMapping(postalCodeColumn, address.FindProperty("PostalCode")!, addressTableMapping); + RelationalModel.CreateColumnMapping(regionColumn, address.FindProperty("Region")!, addressTableMapping); + + var latLong = FindEntityType("BlazingPizza.LatLong")!; + + var defaultTableMappings0 = new List>(); + latLong.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var blazingPizzaLatLongTableBase = new TableBase("BlazingPizza.LatLong", null, relationalModel); + var latitudeColumnBase = new ColumnBase("Latitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Latitude", latitudeColumnBase); + var longitudeColumnBase = new ColumnBase("Longitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Longitude", longitudeColumnBase); + var orderIdColumnBase = new ColumnBase("OrderId", "INTEGER", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("OrderId", orderIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.LatLong", blazingPizzaLatLongTableBase); + var blazingPizzaLatLongMappingBase = new TableMappingBase(latLong, blazingPizzaLatLongTableBase, true); + blazingPizzaLatLongTableBase.AddTypeMapping(blazingPizzaLatLongMappingBase, false); + defaultTableMappings0.Add(blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase, latLong.FindProperty("OrderId")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)latitudeColumnBase, latLong.FindProperty("Latitude")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)longitudeColumnBase, latLong.FindProperty("Longitude")!, blazingPizzaLatLongMappingBase); + + var tableMappings0 = new List(); + latLong.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var ordersTable = new Table("Orders", null, relationalModel); + var orderIdColumn = new Column("OrderId", "INTEGER", ordersTable); + ordersTable.Columns.Add("OrderId", orderIdColumn); + var createdTimeColumn = new Column("CreatedTime", "TEXT", ordersTable); + ordersTable.Columns.Add("CreatedTime", createdTimeColumn); + var deliveryAddressIdColumn = new Column("DeliveryAddressId", "INTEGER", ordersTable); + ordersTable.Columns.Add("DeliveryAddressId", deliveryAddressIdColumn); + var deliveryLocation_LatitudeColumn = new Column("DeliveryLocation_Latitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Latitude", deliveryLocation_LatitudeColumn); + var deliveryLocation_LongitudeColumn = new Column("DeliveryLocation_Longitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Longitude", deliveryLocation_LongitudeColumn); + var userIdColumn = new Column("UserId", "TEXT", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("UserId", userIdColumn); + var pK_Orders = new UniqueConstraint("PK_Orders", ordersTable, new[] { orderIdColumn }); + ordersTable.PrimaryKey = pK_Orders; + var pK_OrdersUc = RelationalModel.GetKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc).Add(pK_Orders); + var pK_OrdersUc0 = RelationalModel.GetKey(this, + "BlazingPizza.Order", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc0); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc0).Add(pK_Orders); + ordersTable.UniqueConstraints.Add("PK_Orders", pK_Orders); + var iX_Orders_DeliveryAddressId = new TableIndex( + "IX_Orders_DeliveryAddressId", ordersTable, new[] { deliveryAddressIdColumn }, false); + var iX_Orders_DeliveryAddressIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }); + iX_Orders_DeliveryAddressId.MappedIndexes.Add(iX_Orders_DeliveryAddressIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Orders_DeliveryAddressIdIx).Add(iX_Orders_DeliveryAddressId); + ordersTable.Indexes.Add("IX_Orders_DeliveryAddressId", iX_Orders_DeliveryAddressId); + relationalModel.Tables.Add(("Orders", null), ordersTable); + var ordersTableMapping = new TableMapping(latLong, ordersTable, true) + { + IsSharedTablePrincipal = false, + }; + ordersTable.AddTypeMapping(ordersTableMapping, true); + tableMappings0.Add(ordersTableMapping); + ordersTable.AddRowInternalForeignKey(latLong, RelationalModel.GetForeignKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" })); + RelationalModel.CreateColumnMapping(orderIdColumn, latLong.FindProperty("OrderId")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LatitudeColumn, latLong.FindProperty("Latitude")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LongitudeColumn, latLong.FindProperty("Longitude")!, ordersTableMapping); + + var notificationSubscription = FindEntityType("BlazingPizza.NotificationSubscription")!; + + var defaultTableMappings1 = new List>(); + notificationSubscription.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var blazingPizzaNotificationSubscriptionTableBase = new TableBase("BlazingPizza.NotificationSubscription", null, relationalModel); + var authColumnBase = new ColumnBase("Auth", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Auth", authColumnBase); + var notificationSubscriptionIdColumnBase = new ColumnBase("NotificationSubscriptionId", "INTEGER", blazingPizzaNotificationSubscriptionTableBase); + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumnBase); + var p256dhColumnBase = new ColumnBase("P256dh", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("P256dh", p256dhColumnBase); + var urlColumnBase = new ColumnBase("Url", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Url", urlColumnBase); + var userIdColumnBase = new ColumnBase("UserId", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("UserId", userIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.NotificationSubscription", blazingPizzaNotificationSubscriptionTableBase); + var blazingPizzaNotificationSubscriptionMappingBase = new TableMappingBase(notificationSubscription, blazingPizzaNotificationSubscriptionTableBase, true); + blazingPizzaNotificationSubscriptionTableBase.AddTypeMapping(blazingPizzaNotificationSubscriptionMappingBase, false); + defaultTableMappings1.Add(blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)notificationSubscriptionIdColumnBase, notificationSubscription.FindProperty("NotificationSubscriptionId")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)authColumnBase, notificationSubscription.FindProperty("Auth")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)p256dhColumnBase, notificationSubscription.FindProperty("P256dh")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)urlColumnBase, notificationSubscription.FindProperty("Url")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase, notificationSubscription.FindProperty("UserId")!, blazingPizzaNotificationSubscriptionMappingBase); + + var tableMappings1 = new List(); + notificationSubscription.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var notificationSubscriptionsTable = new Table("NotificationSubscriptions", null, relationalModel); + var notificationSubscriptionIdColumn = new Column("NotificationSubscriptionId", "INTEGER", notificationSubscriptionsTable); + notificationSubscriptionsTable.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumn); + var authColumn = new Column("Auth", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Auth", authColumn); + var p256dhColumn = new Column("P256dh", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("P256dh", p256dhColumn); + var urlColumn = new Column("Url", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Url", urlColumn); + var userIdColumn0 = new Column("UserId", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("UserId", userIdColumn0); + var pK_NotificationSubscriptions = new UniqueConstraint("PK_NotificationSubscriptions", notificationSubscriptionsTable, new[] { notificationSubscriptionIdColumn }); + notificationSubscriptionsTable.PrimaryKey = pK_NotificationSubscriptions; + var pK_NotificationSubscriptionsUc = RelationalModel.GetKey(this, + "BlazingPizza.NotificationSubscription", + new[] { "NotificationSubscriptionId" }); + pK_NotificationSubscriptions.MappedKeys.Add(pK_NotificationSubscriptionsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_NotificationSubscriptionsUc).Add(pK_NotificationSubscriptions); + notificationSubscriptionsTable.UniqueConstraints.Add("PK_NotificationSubscriptions", pK_NotificationSubscriptions); + relationalModel.Tables.Add(("NotificationSubscriptions", null), notificationSubscriptionsTable); + var notificationSubscriptionsTableMapping = new TableMapping(notificationSubscription, notificationSubscriptionsTable, true); + notificationSubscriptionsTable.AddTypeMapping(notificationSubscriptionsTableMapping, false); + tableMappings1.Add(notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(notificationSubscriptionIdColumn, notificationSubscription.FindProperty("NotificationSubscriptionId")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(authColumn, notificationSubscription.FindProperty("Auth")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(p256dhColumn, notificationSubscription.FindProperty("P256dh")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(urlColumn, notificationSubscription.FindProperty("Url")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn0, notificationSubscription.FindProperty("UserId")!, notificationSubscriptionsTableMapping); + + var order = FindEntityType("BlazingPizza.Order")!; + + var defaultTableMappings2 = new List>(); + order.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings2); + var blazingPizzaOrderTableBase = new TableBase("BlazingPizza.Order", null, relationalModel); + var createdTimeColumnBase = new ColumnBase("CreatedTime", "TEXT", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("CreatedTime", createdTimeColumnBase); + var deliveryAddressIdColumnBase = new ColumnBase("DeliveryAddressId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("DeliveryAddressId", deliveryAddressIdColumnBase); + var orderIdColumnBase0 = new ColumnBase("OrderId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("OrderId", orderIdColumnBase0); + var userIdColumnBase0 = new ColumnBase("UserId", "TEXT", blazingPizzaOrderTableBase) + { + IsNullable = true + }; + blazingPizzaOrderTableBase.Columns.Add("UserId", userIdColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.Order", blazingPizzaOrderTableBase); + var blazingPizzaOrderMappingBase = new TableMappingBase(order, blazingPizzaOrderTableBase, true); + blazingPizzaOrderTableBase.AddTypeMapping(blazingPizzaOrderMappingBase, false); + defaultTableMappings2.Add(blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase0, order.FindProperty("OrderId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdTimeColumnBase, order.FindProperty("CreatedTime")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deliveryAddressIdColumnBase, order.FindProperty("DeliveryAddressId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase0, order.FindProperty("UserId")!, blazingPizzaOrderMappingBase); + + var tableMappings2 = new List(); + order.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); + var ordersTableMapping0 = new TableMapping(order, ordersTable, true) + { + IsSharedTablePrincipal = true, + }; + ordersTable.AddTypeMapping(ordersTableMapping0, false); + tableMappings2.Add(ordersTableMapping0); + RelationalModel.CreateColumnMapping(orderIdColumn, order.FindProperty("OrderId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(createdTimeColumn, order.FindProperty("CreatedTime")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(deliveryAddressIdColumn, order.FindProperty("DeliveryAddressId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(userIdColumn, order.FindProperty("UserId")!, ordersTableMapping0); + + var pizza = FindEntityType("BlazingPizza.Pizza")!; + + var defaultTableMappings3 = new List>(); + pizza.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings3); + var blazingPizzaPizzaTableBase = new TableBase("BlazingPizza.Pizza", null, relationalModel); + var idColumnBase0 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Id", idColumnBase0); + var orderIdColumnBase1 = new ColumnBase("OrderId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("OrderId", orderIdColumnBase1); + var sizeColumnBase = new ColumnBase("Size", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Size", sizeColumnBase); + var specialIdColumnBase = new ColumnBase("SpecialId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("SpecialId", specialIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Pizza", blazingPizzaPizzaTableBase); + var blazingPizzaPizzaMappingBase = new TableMappingBase(pizza, blazingPizzaPizzaTableBase, true); + blazingPizzaPizzaTableBase.AddTypeMapping(blazingPizzaPizzaMappingBase, false); + defaultTableMappings3.Add(blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, pizza.FindProperty("Id")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase1, pizza.FindProperty("OrderId")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sizeColumnBase, pizza.FindProperty("Size")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)specialIdColumnBase, pizza.FindProperty("SpecialId")!, blazingPizzaPizzaMappingBase); + + var tableMappings3 = new List(); + pizza.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); + var pizzasTable = new Table("Pizzas", null, relationalModel); + var idColumn0 = new Column("Id", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Id", idColumn0); + var orderIdColumn0 = new Column("OrderId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("OrderId", orderIdColumn0); + var sizeColumn = new Column("Size", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Size", sizeColumn); + var specialIdColumn = new Column("SpecialId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("SpecialId", specialIdColumn); + var pK_Pizzas = new UniqueConstraint("PK_Pizzas", pizzasTable, new[] { idColumn0 }); + pizzasTable.PrimaryKey = pK_Pizzas; + var pK_PizzasUc = RelationalModel.GetKey(this, + "BlazingPizza.Pizza", + new[] { "Id" }); + pK_Pizzas.MappedKeys.Add(pK_PizzasUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzasUc).Add(pK_Pizzas); + pizzasTable.UniqueConstraints.Add("PK_Pizzas", pK_Pizzas); + var iX_Pizzas_OrderId = new TableIndex( + "IX_Pizzas_OrderId", pizzasTable, new[] { orderIdColumn0 }, false); + var iX_Pizzas_OrderIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }); + iX_Pizzas_OrderId.MappedIndexes.Add(iX_Pizzas_OrderIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_OrderIdIx).Add(iX_Pizzas_OrderId); + pizzasTable.Indexes.Add("IX_Pizzas_OrderId", iX_Pizzas_OrderId); + var iX_Pizzas_SpecialId = new TableIndex( + "IX_Pizzas_SpecialId", pizzasTable, new[] { specialIdColumn }, false); + var iX_Pizzas_SpecialIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }); + iX_Pizzas_SpecialId.MappedIndexes.Add(iX_Pizzas_SpecialIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_SpecialIdIx).Add(iX_Pizzas_SpecialId); + pizzasTable.Indexes.Add("IX_Pizzas_SpecialId", iX_Pizzas_SpecialId); + relationalModel.Tables.Add(("Pizzas", null), pizzasTable); + var pizzasTableMapping = new TableMapping(pizza, pizzasTable, true); + pizzasTable.AddTypeMapping(pizzasTableMapping, false); + tableMappings3.Add(pizzasTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, pizza.FindProperty("Id")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(orderIdColumn0, pizza.FindProperty("OrderId")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(sizeColumn, pizza.FindProperty("Size")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(specialIdColumn, pizza.FindProperty("SpecialId")!, pizzasTableMapping); + + var pizzaSpecial = FindEntityType("BlazingPizza.PizzaSpecial")!; + + var defaultTableMappings4 = new List>(); + pizzaSpecial.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); + var blazingPizzaPizzaSpecialTableBase = new TableBase("BlazingPizza.PizzaSpecial", null, relationalModel); + var basePriceColumnBase = new ColumnBase("BasePrice", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("BasePrice", basePriceColumnBase); + var descriptionColumnBase = new ColumnBase("Description", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Description", descriptionColumnBase); + var idColumnBase1 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Id", idColumnBase1); + var imageUrlColumnBase = new ColumnBase("ImageUrl", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("ImageUrl", imageUrlColumnBase); + var nameColumnBase0 = new ColumnBase("Name", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Name", nameColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaSpecial", blazingPizzaPizzaSpecialTableBase); + var blazingPizzaPizzaSpecialMappingBase = new TableMappingBase(pizzaSpecial, blazingPizzaPizzaSpecialTableBase, true); + blazingPizzaPizzaSpecialTableBase.AddTypeMapping(blazingPizzaPizzaSpecialMappingBase, false); + defaultTableMappings4.Add(blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, pizzaSpecial.FindProperty("Id")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)basePriceColumnBase, pizzaSpecial.FindProperty("BasePrice")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase, pizzaSpecial.FindProperty("Description")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)imageUrlColumnBase, pizzaSpecial.FindProperty("ImageUrl")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase0, pizzaSpecial.FindProperty("Name")!, blazingPizzaPizzaSpecialMappingBase); + + var tableMappings4 = new List(); + pizzaSpecial.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); + var specialsTable = new Table("Specials", null, relationalModel); + var idColumn1 = new Column("Id", "INTEGER", specialsTable); + specialsTable.Columns.Add("Id", idColumn1); + var basePriceColumn = new Column("BasePrice", "TEXT", specialsTable); + specialsTable.Columns.Add("BasePrice", basePriceColumn); + var descriptionColumn = new Column("Description", "TEXT", specialsTable); + specialsTable.Columns.Add("Description", descriptionColumn); + var imageUrlColumn = new Column("ImageUrl", "TEXT", specialsTable); + specialsTable.Columns.Add("ImageUrl", imageUrlColumn); + var nameColumn0 = new Column("Name", "TEXT", specialsTable); + specialsTable.Columns.Add("Name", nameColumn0); + var pK_Specials = new UniqueConstraint("PK_Specials", specialsTable, new[] { idColumn1 }); + specialsTable.PrimaryKey = pK_Specials; + var pK_SpecialsUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + pK_Specials.MappedKeys.Add(pK_SpecialsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_SpecialsUc).Add(pK_Specials); + specialsTable.UniqueConstraints.Add("PK_Specials", pK_Specials); + relationalModel.Tables.Add(("Specials", null), specialsTable); + var specialsTableMapping = new TableMapping(pizzaSpecial, specialsTable, true); + specialsTable.AddTypeMapping(specialsTableMapping, false); + tableMappings4.Add(specialsTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, pizzaSpecial.FindProperty("Id")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(basePriceColumn, pizzaSpecial.FindProperty("BasePrice")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn, pizzaSpecial.FindProperty("Description")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(imageUrlColumn, pizzaSpecial.FindProperty("ImageUrl")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn0, pizzaSpecial.FindProperty("Name")!, specialsTableMapping); + + var pizzaTopping = FindEntityType("BlazingPizza.PizzaTopping")!; + + var defaultTableMappings5 = new List>(); + pizzaTopping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings5); + var blazingPizzaPizzaToppingTableBase = new TableBase("BlazingPizza.PizzaTopping", null, relationalModel); + var pizzaIdColumnBase = new ColumnBase("PizzaId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("PizzaId", pizzaIdColumnBase); + var toppingIdColumnBase = new ColumnBase("ToppingId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("ToppingId", toppingIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaTopping", blazingPizzaPizzaToppingTableBase); + var blazingPizzaPizzaToppingMappingBase = new TableMappingBase(pizzaTopping, blazingPizzaPizzaToppingTableBase, true); + blazingPizzaPizzaToppingTableBase.AddTypeMapping(blazingPizzaPizzaToppingMappingBase, false); + defaultTableMappings5.Add(blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pizzaIdColumnBase, pizzaTopping.FindProperty("PizzaId")!, blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)toppingIdColumnBase, pizzaTopping.FindProperty("ToppingId")!, blazingPizzaPizzaToppingMappingBase); + + var tableMappings5 = new List(); + pizzaTopping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); + var pizzaToppingTable = new Table("PizzaTopping", null, relationalModel); + var pizzaIdColumn = new Column("PizzaId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("PizzaId", pizzaIdColumn); + var toppingIdColumn = new Column("ToppingId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("ToppingId", toppingIdColumn); + var pK_PizzaTopping = new UniqueConstraint("PK_PizzaTopping", pizzaToppingTable, new[] { pizzaIdColumn, toppingIdColumn }); + pizzaToppingTable.PrimaryKey = pK_PizzaTopping; + var pK_PizzaToppingUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId", "ToppingId" }); + pK_PizzaTopping.MappedKeys.Add(pK_PizzaToppingUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzaToppingUc).Add(pK_PizzaTopping); + pizzaToppingTable.UniqueConstraints.Add("PK_PizzaTopping", pK_PizzaTopping); + var iX_PizzaTopping_ToppingId = new TableIndex( + "IX_PizzaTopping_ToppingId", pizzaToppingTable, new[] { toppingIdColumn }, false); + var iX_PizzaTopping_ToppingIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }); + iX_PizzaTopping_ToppingId.MappedIndexes.Add(iX_PizzaTopping_ToppingIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PizzaTopping_ToppingIdIx).Add(iX_PizzaTopping_ToppingId); + pizzaToppingTable.Indexes.Add("IX_PizzaTopping_ToppingId", iX_PizzaTopping_ToppingId); + relationalModel.Tables.Add(("PizzaTopping", null), pizzaToppingTable); + var pizzaToppingTableMapping = new TableMapping(pizzaTopping, pizzaToppingTable, true); + pizzaToppingTable.AddTypeMapping(pizzaToppingTableMapping, false); + tableMappings5.Add(pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(pizzaIdColumn, pizzaTopping.FindProperty("PizzaId")!, pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(toppingIdColumn, pizzaTopping.FindProperty("ToppingId")!, pizzaToppingTableMapping); + + var pizzaStoreUser = FindEntityType("BlazingPizza.Server.PizzaStoreUser")!; + + var defaultTableMappings6 = new List>(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings6); + var blazingPizzaServerPizzaStoreUserTableBase = new TableBase("BlazingPizza.Server.PizzaStoreUser", null, relationalModel); + var accessFailedCountColumnBase = new ColumnBase("AccessFailedCount", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("AccessFailedCount", accessFailedCountColumnBase); + var concurrencyStampColumnBase = new ColumnBase("ConcurrencyStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase); + var emailColumnBase = new ColumnBase("Email", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Email", emailColumnBase); + var emailConfirmedColumnBase = new ColumnBase("EmailConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("EmailConfirmed", emailConfirmedColumnBase); + var idColumnBase2 = new ColumnBase("Id", "TEXT", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Id", idColumnBase2); + var lockoutEnabledColumnBase = new ColumnBase("LockoutEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnabled", lockoutEnabledColumnBase); + var lockoutEndColumnBase = new ColumnBase("LockoutEnd", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnd", lockoutEndColumnBase); + var normalizedEmailColumnBase = new ColumnBase("NormalizedEmail", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedEmail", normalizedEmailColumnBase); + var normalizedUserNameColumnBase = new ColumnBase("NormalizedUserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedUserName", normalizedUserNameColumnBase); + var passwordHashColumnBase = new ColumnBase("PasswordHash", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PasswordHash", passwordHashColumnBase); + var phoneNumberColumnBase = new ColumnBase("PhoneNumber", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumber", phoneNumberColumnBase); + var phoneNumberConfirmedColumnBase = new ColumnBase("PhoneNumberConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumnBase); + var securityStampColumnBase = new ColumnBase("SecurityStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("SecurityStamp", securityStampColumnBase); + var twoFactorEnabledColumnBase = new ColumnBase("TwoFactorEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumnBase); + var userNameColumnBase = new ColumnBase("UserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("UserName", userNameColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Server.PizzaStoreUser", blazingPizzaServerPizzaStoreUserTableBase); + var blazingPizzaServerPizzaStoreUserMappingBase = new TableMappingBase(pizzaStoreUser, blazingPizzaServerPizzaStoreUserTableBase, true); + blazingPizzaServerPizzaStoreUserTableBase.AddTypeMapping(blazingPizzaServerPizzaStoreUserMappingBase, false); + defaultTableMappings6.Add(blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, pizzaStoreUser.FindProperty("Id")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)accessFailedCountColumnBase, pizzaStoreUser.FindProperty("AccessFailedCount")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailColumnBase, pizzaStoreUser.FindProperty("Email")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailConfirmedColumnBase, pizzaStoreUser.FindProperty("EmailConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEnabledColumnBase, pizzaStoreUser.FindProperty("LockoutEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEndColumnBase, pizzaStoreUser.FindProperty("LockoutEnd")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedEmailColumnBase, pizzaStoreUser.FindProperty("NormalizedEmail")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedUserNameColumnBase, pizzaStoreUser.FindProperty("NormalizedUserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)passwordHashColumnBase, pizzaStoreUser.FindProperty("PasswordHash")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberColumnBase, pizzaStoreUser.FindProperty("PhoneNumber")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberConfirmedColumnBase, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)securityStampColumnBase, pizzaStoreUser.FindProperty("SecurityStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)twoFactorEnabledColumnBase, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userNameColumnBase, pizzaStoreUser.FindProperty("UserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + + var tableMappings6 = new List(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:TableMappings", tableMappings6); + var aspNetUsersTable = new Table("AspNetUsers", null, relationalModel); + var idColumn2 = new Column("Id", "TEXT", aspNetUsersTable); + aspNetUsersTable.Columns.Add("Id", idColumn2); + var accessFailedCountColumn = new Column("AccessFailedCount", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("AccessFailedCount", accessFailedCountColumn); + var concurrencyStampColumn = new Column("ConcurrencyStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn); + var emailColumn = new Column("Email", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("Email", emailColumn); + var emailConfirmedColumn = new Column("EmailConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("EmailConfirmed", emailConfirmedColumn); + var lockoutEnabledColumn = new Column("LockoutEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("LockoutEnabled", lockoutEnabledColumn); + var lockoutEndColumn = new Column("LockoutEnd", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("LockoutEnd", lockoutEndColumn); + var normalizedEmailColumn = new Column("NormalizedEmail", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedEmail", normalizedEmailColumn); + var normalizedUserNameColumn = new Column("NormalizedUserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedUserName", normalizedUserNameColumn); + var passwordHashColumn = new Column("PasswordHash", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PasswordHash", passwordHashColumn); + var phoneNumberColumn = new Column("PhoneNumber", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PhoneNumber", phoneNumberColumn); + var phoneNumberConfirmedColumn = new Column("PhoneNumberConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumn); + var securityStampColumn = new Column("SecurityStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("SecurityStamp", securityStampColumn); + var twoFactorEnabledColumn = new Column("TwoFactorEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumn); + var userNameColumn = new Column("UserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("UserName", userNameColumn); + var pK_AspNetUsers = new UniqueConstraint("PK_AspNetUsers", aspNetUsersTable, new[] { idColumn2 }); + aspNetUsersTable.PrimaryKey = pK_AspNetUsers; + var pK_AspNetUsersUc = RelationalModel.GetKey(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + pK_AspNetUsers.MappedKeys.Add(pK_AspNetUsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUsersUc).Add(pK_AspNetUsers); + aspNetUsersTable.UniqueConstraints.Add("PK_AspNetUsers", pK_AspNetUsers); + var emailIndex = new TableIndex( + "EmailIndex", aspNetUsersTable, new[] { normalizedEmailColumn }, false); + var emailIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedEmail" }); + emailIndex.MappedIndexes.Add(emailIndexIx); + RelationalModel.GetOrCreateTableIndexes(emailIndexIx).Add(emailIndex); + aspNetUsersTable.Indexes.Add("EmailIndex", emailIndex); + var userNameIndex = new TableIndex( + "UserNameIndex", aspNetUsersTable, new[] { normalizedUserNameColumn }, true); + var userNameIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedUserName" }); + userNameIndex.MappedIndexes.Add(userNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(userNameIndexIx).Add(userNameIndex); + aspNetUsersTable.Indexes.Add("UserNameIndex", userNameIndex); + relationalModel.Tables.Add(("AspNetUsers", null), aspNetUsersTable); + var aspNetUsersTableMapping = new TableMapping(pizzaStoreUser, aspNetUsersTable, true); + aspNetUsersTable.AddTypeMapping(aspNetUsersTableMapping, false); + tableMappings6.Add(aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(idColumn2, pizzaStoreUser.FindProperty("Id")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(accessFailedCountColumn, pizzaStoreUser.FindProperty("AccessFailedCount")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailColumn, pizzaStoreUser.FindProperty("Email")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailConfirmedColumn, pizzaStoreUser.FindProperty("EmailConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEnabledColumn, pizzaStoreUser.FindProperty("LockoutEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEndColumn, pizzaStoreUser.FindProperty("LockoutEnd")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedEmailColumn, pizzaStoreUser.FindProperty("NormalizedEmail")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedUserNameColumn, pizzaStoreUser.FindProperty("NormalizedUserName")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(passwordHashColumn, pizzaStoreUser.FindProperty("PasswordHash")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberColumn, pizzaStoreUser.FindProperty("PhoneNumber")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberConfirmedColumn, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(securityStampColumn, pizzaStoreUser.FindProperty("SecurityStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(twoFactorEnabledColumn, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(userNameColumn, pizzaStoreUser.FindProperty("UserName")!, aspNetUsersTableMapping); + + var topping = FindEntityType("BlazingPizza.Topping")!; + + var defaultTableMappings7 = new List>(); + topping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings7); + var blazingPizzaToppingTableBase = new TableBase("BlazingPizza.Topping", null, relationalModel); + var idColumnBase3 = new ColumnBase("Id", "INTEGER", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Id", idColumnBase3); + var nameColumnBase1 = new ColumnBase("Name", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Name", nameColumnBase1); + var priceColumnBase = new ColumnBase("Price", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Price", priceColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Topping", blazingPizzaToppingTableBase); + var blazingPizzaToppingMappingBase = new TableMappingBase(topping, blazingPizzaToppingTableBase, true); + blazingPizzaToppingTableBase.AddTypeMapping(blazingPizzaToppingMappingBase, false); + defaultTableMappings7.Add(blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase3, topping.FindProperty("Id")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase1, topping.FindProperty("Name")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)priceColumnBase, topping.FindProperty("Price")!, blazingPizzaToppingMappingBase); + + var tableMappings7 = new List(); + topping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings7); + var toppingsTable = new Table("Toppings", null, relationalModel); + var idColumn3 = new Column("Id", "INTEGER", toppingsTable); + toppingsTable.Columns.Add("Id", idColumn3); + var nameColumn1 = new Column("Name", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Name", nameColumn1); + var priceColumn = new Column("Price", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Price", priceColumn); + var pK_Toppings = new UniqueConstraint("PK_Toppings", toppingsTable, new[] { idColumn3 }); + toppingsTable.PrimaryKey = pK_Toppings; + var pK_ToppingsUc = RelationalModel.GetKey(this, + "BlazingPizza.Topping", + new[] { "Id" }); + pK_Toppings.MappedKeys.Add(pK_ToppingsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_ToppingsUc).Add(pK_Toppings); + toppingsTable.UniqueConstraints.Add("PK_Toppings", pK_Toppings); + relationalModel.Tables.Add(("Toppings", null), toppingsTable); + var toppingsTableMapping = new TableMapping(topping, toppingsTable, true); + toppingsTable.AddTypeMapping(toppingsTableMapping, false); + tableMappings7.Add(toppingsTableMapping); + RelationalModel.CreateColumnMapping(idColumn3, topping.FindProperty("Id")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn1, topping.FindProperty("Name")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(priceColumn, topping.FindProperty("Price")!, toppingsTableMapping); + + var deviceFlowCodes = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes")!; + + var defaultTableMappings8 = new List>(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings8); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", null, relationalModel); + var clientIdColumnBase = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("ClientId", clientIdColumnBase); + var creationTimeColumnBase = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("CreationTime", creationTimeColumnBase); + var dataColumnBase = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Data", dataColumnBase); + var descriptionColumnBase0 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Description", descriptionColumnBase0); + var deviceCodeColumnBase = new ColumnBase("DeviceCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("DeviceCode", deviceCodeColumnBase); + var expirationColumnBase = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Expiration", expirationColumnBase); + var sessionIdColumnBase = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SessionId", sessionIdColumnBase); + var subjectIdColumnBase = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SubjectId", subjectIdColumnBase); + var userCodeColumnBase = new ColumnBase("UserCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("UserCode", userCodeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase = new TableMappingBase(deviceFlowCodes, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase, false); + defaultTableMappings8.Add(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userCodeColumnBase, deviceFlowCodes.FindProperty("UserCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase, deviceFlowCodes.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase, deviceFlowCodes.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, deviceFlowCodes.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase0, deviceFlowCodes.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deviceCodeColumnBase, deviceFlowCodes.FindProperty("DeviceCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase, deviceFlowCodes.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase, deviceFlowCodes.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase, deviceFlowCodes.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + + var tableMappings8 = new List(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:TableMappings", tableMappings8); + var deviceCodesTable = new Table("DeviceCodes", null, relationalModel); + var userCodeColumn = new Column("UserCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("UserCode", userCodeColumn); + var clientIdColumn = new Column("ClientId", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("ClientId", clientIdColumn); + var creationTimeColumn = new Column("CreationTime", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("CreationTime", creationTimeColumn); + var dataColumn = new Column("Data", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Data", dataColumn); + var descriptionColumn0 = new Column("Description", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("Description", descriptionColumn0); + var deviceCodeColumn = new Column("DeviceCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("DeviceCode", deviceCodeColumn); + var expirationColumn = new Column("Expiration", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Expiration", expirationColumn); + var sessionIdColumn = new Column("SessionId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SessionId", sessionIdColumn); + var subjectIdColumn = new Column("SubjectId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SubjectId", subjectIdColumn); + var pK_DeviceCodes = new UniqueConstraint("PK_DeviceCodes", deviceCodesTable, new[] { userCodeColumn }); + deviceCodesTable.PrimaryKey = pK_DeviceCodes; + var pK_DeviceCodesUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "UserCode" }); + pK_DeviceCodes.MappedKeys.Add(pK_DeviceCodesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_DeviceCodesUc).Add(pK_DeviceCodes); + deviceCodesTable.UniqueConstraints.Add("PK_DeviceCodes", pK_DeviceCodes); + var iX_DeviceCodes_DeviceCode = new TableIndex( + "IX_DeviceCodes_DeviceCode", deviceCodesTable, new[] { deviceCodeColumn }, true); + var iX_DeviceCodes_DeviceCodeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "DeviceCode" }); + iX_DeviceCodes_DeviceCode.MappedIndexes.Add(iX_DeviceCodes_DeviceCodeIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_DeviceCodeIx).Add(iX_DeviceCodes_DeviceCode); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_DeviceCode", iX_DeviceCodes_DeviceCode); + var iX_DeviceCodes_Expiration = new TableIndex( + "IX_DeviceCodes_Expiration", deviceCodesTable, new[] { expirationColumn }, false); + var iX_DeviceCodes_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "Expiration" }); + iX_DeviceCodes_Expiration.MappedIndexes.Add(iX_DeviceCodes_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_ExpirationIx).Add(iX_DeviceCodes_Expiration); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_Expiration", iX_DeviceCodes_Expiration); + relationalModel.Tables.Add(("DeviceCodes", null), deviceCodesTable); + var deviceCodesTableMapping = new TableMapping(deviceFlowCodes, deviceCodesTable, true); + deviceCodesTable.AddTypeMapping(deviceCodesTableMapping, false); + tableMappings8.Add(deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(userCodeColumn, deviceFlowCodes.FindProperty("UserCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn, deviceFlowCodes.FindProperty("ClientId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn, deviceFlowCodes.FindProperty("CreationTime")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, deviceFlowCodes.FindProperty("Data")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn0, deviceFlowCodes.FindProperty("Description")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(deviceCodeColumn, deviceFlowCodes.FindProperty("DeviceCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn, deviceFlowCodes.FindProperty("Expiration")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn, deviceFlowCodes.FindProperty("SessionId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn, deviceFlowCodes.FindProperty("SubjectId")!, deviceCodesTableMapping); + + var key = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.Key")!; + + var defaultTableMappings9 = new List>(); + key.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings9); + var duendeIdentityServerEntityFrameworkEntitiesKeyTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.Key", null, relationalModel); + var algorithmColumnBase = new ColumnBase("Algorithm", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Algorithm", algorithmColumnBase); + var createdColumnBase = new ColumnBase("Created", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Created", createdColumnBase); + var dataColumnBase0 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Data", dataColumnBase0); + var dataProtectedColumnBase = new ColumnBase("DataProtected", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("DataProtected", dataProtectedColumnBase); + var idColumnBase4 = new ColumnBase("Id", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Id", idColumnBase4); + var isX509CertificateColumnBase = new ColumnBase("IsX509Certificate", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("IsX509Certificate", isX509CertificateColumnBase); + var useColumnBase = new ColumnBase("Use", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Use", useColumnBase); + var versionColumnBase = new ColumnBase("Version", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Version", versionColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.Key", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + var duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase = new TableMappingBase(key, duendeIdentityServerEntityFrameworkEntitiesKeyTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase, false); + defaultTableMappings9.Add(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase4, key.FindProperty("Id")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)algorithmColumnBase, key.FindProperty("Algorithm")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdColumnBase, key.FindProperty("Created")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase0, key.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataProtectedColumnBase, key.FindProperty("DataProtected")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)isX509CertificateColumnBase, key.FindProperty("IsX509Certificate")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)useColumnBase, key.FindProperty("Use")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)versionColumnBase, key.FindProperty("Version")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + + var tableMappings9 = new List(); + key.SetRuntimeAnnotation("Relational:TableMappings", tableMappings9); + var keysTable = new Table("Keys", null, relationalModel); + var idColumn4 = new Column("Id", "TEXT", keysTable); + keysTable.Columns.Add("Id", idColumn4); + var algorithmColumn = new Column("Algorithm", "TEXT", keysTable); + keysTable.Columns.Add("Algorithm", algorithmColumn); + var createdColumn = new Column("Created", "TEXT", keysTable); + keysTable.Columns.Add("Created", createdColumn); + var dataColumn0 = new Column("Data", "TEXT", keysTable); + keysTable.Columns.Add("Data", dataColumn0); + var dataProtectedColumn = new Column("DataProtected", "INTEGER", keysTable); + keysTable.Columns.Add("DataProtected", dataProtectedColumn); + var isX509CertificateColumn = new Column("IsX509Certificate", "INTEGER", keysTable); + keysTable.Columns.Add("IsX509Certificate", isX509CertificateColumn); + var useColumn = new Column("Use", "TEXT", keysTable) + { + IsNullable = true + }; + keysTable.Columns.Add("Use", useColumn); + var versionColumn = new Column("Version", "INTEGER", keysTable); + keysTable.Columns.Add("Version", versionColumn); + var pK_Keys = new UniqueConstraint("PK_Keys", keysTable, new[] { idColumn4 }); + keysTable.PrimaryKey = pK_Keys; + var pK_KeysUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Id" }); + pK_Keys.MappedKeys.Add(pK_KeysUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_KeysUc).Add(pK_Keys); + keysTable.UniqueConstraints.Add("PK_Keys", pK_Keys); + var iX_Keys_Use = new TableIndex( + "IX_Keys_Use", keysTable, new[] { useColumn }, false); + var iX_Keys_UseIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Use" }); + iX_Keys_Use.MappedIndexes.Add(iX_Keys_UseIx); + RelationalModel.GetOrCreateTableIndexes(iX_Keys_UseIx).Add(iX_Keys_Use); + keysTable.Indexes.Add("IX_Keys_Use", iX_Keys_Use); + relationalModel.Tables.Add(("Keys", null), keysTable); + var keysTableMapping = new TableMapping(key, keysTable, true); + keysTable.AddTypeMapping(keysTableMapping, false); + tableMappings9.Add(keysTableMapping); + RelationalModel.CreateColumnMapping(idColumn4, key.FindProperty("Id")!, keysTableMapping); + RelationalModel.CreateColumnMapping(algorithmColumn, key.FindProperty("Algorithm")!, keysTableMapping); + RelationalModel.CreateColumnMapping(createdColumn, key.FindProperty("Created")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataColumn0, key.FindProperty("Data")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataProtectedColumn, key.FindProperty("DataProtected")!, keysTableMapping); + RelationalModel.CreateColumnMapping(isX509CertificateColumn, key.FindProperty("IsX509Certificate")!, keysTableMapping); + RelationalModel.CreateColumnMapping(useColumn, key.FindProperty("Use")!, keysTableMapping); + RelationalModel.CreateColumnMapping(versionColumn, key.FindProperty("Version")!, keysTableMapping); + + var persistedGrant = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant")!; + + var defaultTableMappings10 = new List>(); + persistedGrant.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings10); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", null, relationalModel); + var clientIdColumnBase0 = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ClientId", clientIdColumnBase0); + var consumedTimeColumnBase = new ColumnBase("ConsumedTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ConsumedTime", consumedTimeColumnBase); + var creationTimeColumnBase0 = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("CreationTime", creationTimeColumnBase0); + var dataColumnBase1 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Data", dataColumnBase1); + var descriptionColumnBase1 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Description", descriptionColumnBase1); + var expirationColumnBase0 = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Expiration", expirationColumnBase0); + var keyColumnBase = new ColumnBase("Key", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Key", keyColumnBase); + var sessionIdColumnBase0 = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SessionId", sessionIdColumnBase0); + var subjectIdColumnBase0 = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SubjectId", subjectIdColumnBase0); + var typeColumnBase = new ColumnBase("Type", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Type", typeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase = new TableMappingBase(persistedGrant, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase, false); + defaultTableMappings10.Add(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)keyColumnBase, persistedGrant.FindProperty("Key")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase0, persistedGrant.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)consumedTimeColumnBase, persistedGrant.FindProperty("ConsumedTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase0, persistedGrant.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase1, persistedGrant.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase1, persistedGrant.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase0, persistedGrant.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase0, persistedGrant.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase0, persistedGrant.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)typeColumnBase, persistedGrant.FindProperty("Type")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + + var tableMappings10 = new List(); + persistedGrant.SetRuntimeAnnotation("Relational:TableMappings", tableMappings10); + var persistedGrantsTable = new Table("PersistedGrants", null, relationalModel); + var keyColumn = new Column("Key", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Key", keyColumn); + var clientIdColumn0 = new Column("ClientId", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("ClientId", clientIdColumn0); + var consumedTimeColumn = new Column("ConsumedTime", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("ConsumedTime", consumedTimeColumn); + var creationTimeColumn0 = new Column("CreationTime", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("CreationTime", creationTimeColumn0); + var dataColumn1 = new Column("Data", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Data", dataColumn1); + var descriptionColumn1 = new Column("Description", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Description", descriptionColumn1); + var expirationColumn0 = new Column("Expiration", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Expiration", expirationColumn0); + var sessionIdColumn0 = new Column("SessionId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SessionId", sessionIdColumn0); + var subjectIdColumn0 = new Column("SubjectId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SubjectId", subjectIdColumn0); + var typeColumn = new Column("Type", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Type", typeColumn); + var pK_PersistedGrants = new UniqueConstraint("PK_PersistedGrants", persistedGrantsTable, new[] { keyColumn }); + persistedGrantsTable.PrimaryKey = pK_PersistedGrants; + var pK_PersistedGrantsUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Key" }); + pK_PersistedGrants.MappedKeys.Add(pK_PersistedGrantsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PersistedGrantsUc).Add(pK_PersistedGrants); + persistedGrantsTable.UniqueConstraints.Add("PK_PersistedGrants", pK_PersistedGrants); + var iX_PersistedGrants_ConsumedTime = new TableIndex( + "IX_PersistedGrants_ConsumedTime", persistedGrantsTable, new[] { consumedTimeColumn }, false); + var iX_PersistedGrants_ConsumedTimeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "ConsumedTime" }); + iX_PersistedGrants_ConsumedTime.MappedIndexes.Add(iX_PersistedGrants_ConsumedTimeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ConsumedTimeIx).Add(iX_PersistedGrants_ConsumedTime); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_ConsumedTime", iX_PersistedGrants_ConsumedTime); + var iX_PersistedGrants_Expiration = new TableIndex( + "IX_PersistedGrants_Expiration", persistedGrantsTable, new[] { expirationColumn0 }, false); + var iX_PersistedGrants_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Expiration" }); + iX_PersistedGrants_Expiration.MappedIndexes.Add(iX_PersistedGrants_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ExpirationIx).Add(iX_PersistedGrants_Expiration); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_Expiration", iX_PersistedGrants_Expiration); + var iX_PersistedGrants_SubjectId_ClientId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_ClientId_Type", persistedGrantsTable, new[] { subjectIdColumn0, clientIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_ClientId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "ClientId", "Type" }); + iX_PersistedGrants_SubjectId_ClientId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_ClientId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_ClientId_TypeIx).Add(iX_PersistedGrants_SubjectId_ClientId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_ClientId_Type", iX_PersistedGrants_SubjectId_ClientId_Type); + var iX_PersistedGrants_SubjectId_SessionId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_SessionId_Type", persistedGrantsTable, new[] { subjectIdColumn0, sessionIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_SessionId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "SessionId", "Type" }); + iX_PersistedGrants_SubjectId_SessionId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_SessionId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_SessionId_TypeIx).Add(iX_PersistedGrants_SubjectId_SessionId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_SessionId_Type", iX_PersistedGrants_SubjectId_SessionId_Type); + relationalModel.Tables.Add(("PersistedGrants", null), persistedGrantsTable); + var persistedGrantsTableMapping = new TableMapping(persistedGrant, persistedGrantsTable, true); + persistedGrantsTable.AddTypeMapping(persistedGrantsTableMapping, false); + tableMappings10.Add(persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(keyColumn, persistedGrant.FindProperty("Key")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn0, persistedGrant.FindProperty("ClientId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(consumedTimeColumn, persistedGrant.FindProperty("ConsumedTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn0, persistedGrant.FindProperty("CreationTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(dataColumn1, persistedGrant.FindProperty("Data")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn1, persistedGrant.FindProperty("Description")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn0, persistedGrant.FindProperty("Expiration")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn0, persistedGrant.FindProperty("SessionId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn0, persistedGrant.FindProperty("SubjectId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(typeColumn, persistedGrant.FindProperty("Type")!, persistedGrantsTableMapping); + + var identityRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRole")!; + + var defaultTableMappings11 = new List>(); + identityRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings11); + var microsoftAspNetCoreIdentityIdentityRoleTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRole", null, relationalModel); + var concurrencyStampColumnBase0 = new ColumnBase("ConcurrencyStamp", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase0); + var idColumnBase5 = new ColumnBase("Id", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase); + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Id", idColumnBase5); + var nameColumnBase2 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Name", nameColumnBase2); + var normalizedNameColumnBase = new ColumnBase("NormalizedName", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("NormalizedName", normalizedNameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRole", microsoftAspNetCoreIdentityIdentityRoleTableBase); + var microsoftAspNetCoreIdentityIdentityRoleMappingBase = new TableMappingBase(identityRole, microsoftAspNetCoreIdentityIdentityRoleTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleMappingBase, false); + defaultTableMappings11.Add(microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase5, identityRole.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase0, identityRole.FindProperty("ConcurrencyStamp")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase2, identityRole.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedNameColumnBase, identityRole.FindProperty("NormalizedName")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + + var tableMappings11 = new List(); + identityRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings11); + var aspNetRolesTable = new Table("AspNetRoles", null, relationalModel); + var idColumn5 = new Column("Id", "TEXT", aspNetRolesTable); + aspNetRolesTable.Columns.Add("Id", idColumn5); + var concurrencyStampColumn0 = new Column("ConcurrencyStamp", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn0); + var nameColumn2 = new Column("Name", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("Name", nameColumn2); + var normalizedNameColumn = new Column("NormalizedName", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("NormalizedName", normalizedNameColumn); + var pK_AspNetRoles = new UniqueConstraint("PK_AspNetRoles", aspNetRolesTable, new[] { idColumn5 }); + aspNetRolesTable.PrimaryKey = pK_AspNetRoles; + var pK_AspNetRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + pK_AspNetRoles.MappedKeys.Add(pK_AspNetRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRolesUc).Add(pK_AspNetRoles); + aspNetRolesTable.UniqueConstraints.Add("PK_AspNetRoles", pK_AspNetRoles); + var roleNameIndex = new TableIndex( + "RoleNameIndex", aspNetRolesTable, new[] { normalizedNameColumn }, true); + var roleNameIndexIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "NormalizedName" }); + roleNameIndex.MappedIndexes.Add(roleNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(roleNameIndexIx).Add(roleNameIndex); + aspNetRolesTable.Indexes.Add("RoleNameIndex", roleNameIndex); + relationalModel.Tables.Add(("AspNetRoles", null), aspNetRolesTable); + var aspNetRolesTableMapping = new TableMapping(identityRole, aspNetRolesTable, true); + aspNetRolesTable.AddTypeMapping(aspNetRolesTableMapping, false); + tableMappings11.Add(aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(idColumn5, identityRole.FindProperty("Id")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn0, identityRole.FindProperty("ConcurrencyStamp")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(nameColumn2, identityRole.FindProperty("Name")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(normalizedNameColumn, identityRole.FindProperty("NormalizedName")!, aspNetRolesTableMapping); + + var identityRoleClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRoleClaim")!; + + var defaultTableMappings12 = new List>(); + identityRoleClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings12); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRoleClaim", null, relationalModel); + var claimTypeColumnBase = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase); + var claimValueColumnBase = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase); + var idColumnBase6 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("Id", idColumnBase6); + var roleIdColumnBase = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("RoleId", roleIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRoleClaim", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase = new TableMappingBase(identityRoleClaim, microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase, false); + defaultTableMappings12.Add(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase6, identityRoleClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase, identityRoleClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase, identityRoleClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase, identityRoleClaim.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + + var tableMappings12 = new List(); + identityRoleClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings12); + var aspNetRoleClaimsTable = new Table("AspNetRoleClaims", null, relationalModel); + var idColumn6 = new Column("Id", "INTEGER", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("Id", idColumn6); + var claimTypeColumn = new Column("ClaimType", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimType", claimTypeColumn); + var claimValueColumn = new Column("ClaimValue", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimValue", claimValueColumn); + var roleIdColumn = new Column("RoleId", "TEXT", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("RoleId", roleIdColumn); + var pK_AspNetRoleClaims = new UniqueConstraint("PK_AspNetRoleClaims", aspNetRoleClaimsTable, new[] { idColumn6 }); + aspNetRoleClaimsTable.PrimaryKey = pK_AspNetRoleClaims; + var pK_AspNetRoleClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "Id" }); + pK_AspNetRoleClaims.MappedKeys.Add(pK_AspNetRoleClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRoleClaimsUc).Add(pK_AspNetRoleClaims); + aspNetRoleClaimsTable.UniqueConstraints.Add("PK_AspNetRoleClaims", pK_AspNetRoleClaims); + var iX_AspNetRoleClaims_RoleId = new TableIndex( + "IX_AspNetRoleClaims_RoleId", aspNetRoleClaimsTable, new[] { roleIdColumn }, false); + var iX_AspNetRoleClaims_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }); + iX_AspNetRoleClaims_RoleId.MappedIndexes.Add(iX_AspNetRoleClaims_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetRoleClaims_RoleIdIx).Add(iX_AspNetRoleClaims_RoleId); + aspNetRoleClaimsTable.Indexes.Add("IX_AspNetRoleClaims_RoleId", iX_AspNetRoleClaims_RoleId); + relationalModel.Tables.Add(("AspNetRoleClaims", null), aspNetRoleClaimsTable); + var aspNetRoleClaimsTableMapping = new TableMapping(identityRoleClaim, aspNetRoleClaimsTable, true); + aspNetRoleClaimsTable.AddTypeMapping(aspNetRoleClaimsTableMapping, false); + tableMappings12.Add(aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn6, identityRoleClaim.FindProperty("Id")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn, identityRoleClaim.FindProperty("ClaimType")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn, identityRoleClaim.FindProperty("ClaimValue")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn, identityRoleClaim.FindProperty("RoleId")!, aspNetRoleClaimsTableMapping); + + var identityUserClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserClaim")!; + + var defaultTableMappings13 = new List>(); + identityUserClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings13); + var microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserClaim", null, relationalModel); + var claimTypeColumnBase0 = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase0); + var claimValueColumnBase0 = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase0); + var idColumnBase7 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("Id", idColumnBase7); + var userIdColumnBase1 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("UserId", userIdColumnBase1); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserClaim", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase = new TableMappingBase(identityUserClaim, microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase, false); + defaultTableMappings13.Add(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase7, identityUserClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase0, identityUserClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase0, identityUserClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase1, identityUserClaim.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + + var tableMappings13 = new List(); + identityUserClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings13); + var aspNetUserClaimsTable = new Table("AspNetUserClaims", null, relationalModel); + var idColumn7 = new Column("Id", "INTEGER", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("Id", idColumn7); + var claimTypeColumn0 = new Column("ClaimType", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimType", claimTypeColumn0); + var claimValueColumn0 = new Column("ClaimValue", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimValue", claimValueColumn0); + var userIdColumn1 = new Column("UserId", "TEXT", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("UserId", userIdColumn1); + var pK_AspNetUserClaims = new UniqueConstraint("PK_AspNetUserClaims", aspNetUserClaimsTable, new[] { idColumn7 }); + aspNetUserClaimsTable.PrimaryKey = pK_AspNetUserClaims; + var pK_AspNetUserClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "Id" }); + pK_AspNetUserClaims.MappedKeys.Add(pK_AspNetUserClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserClaimsUc).Add(pK_AspNetUserClaims); + aspNetUserClaimsTable.UniqueConstraints.Add("PK_AspNetUserClaims", pK_AspNetUserClaims); + var iX_AspNetUserClaims_UserId = new TableIndex( + "IX_AspNetUserClaims_UserId", aspNetUserClaimsTable, new[] { userIdColumn1 }, false); + var iX_AspNetUserClaims_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }); + iX_AspNetUserClaims_UserId.MappedIndexes.Add(iX_AspNetUserClaims_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserClaims_UserIdIx).Add(iX_AspNetUserClaims_UserId); + aspNetUserClaimsTable.Indexes.Add("IX_AspNetUserClaims_UserId", iX_AspNetUserClaims_UserId); + relationalModel.Tables.Add(("AspNetUserClaims", null), aspNetUserClaimsTable); + var aspNetUserClaimsTableMapping = new TableMapping(identityUserClaim, aspNetUserClaimsTable, true); + aspNetUserClaimsTable.AddTypeMapping(aspNetUserClaimsTableMapping, false); + tableMappings13.Add(aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn7, identityUserClaim.FindProperty("Id")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn0, identityUserClaim.FindProperty("ClaimType")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn0, identityUserClaim.FindProperty("ClaimValue")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn1, identityUserClaim.FindProperty("UserId")!, aspNetUserClaimsTableMapping); + + var identityUserLogin = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserLogin")!; + + var defaultTableMappings14 = new List>(); + identityUserLogin.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings14); + var microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserLogin", null, relationalModel); + var loginProviderColumnBase = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase); + var providerDisplayNameColumnBase = new ColumnBase("ProviderDisplayName", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderDisplayName", providerDisplayNameColumnBase); + var providerKeyColumnBase = new ColumnBase("ProviderKey", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderKey", providerKeyColumnBase); + var userIdColumnBase2 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("UserId", userIdColumnBase2); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserLogin", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase = new TableMappingBase(identityUserLogin, microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase, false); + defaultTableMappings14.Add(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase, identityUserLogin.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerKeyColumnBase, identityUserLogin.FindProperty("ProviderKey")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerDisplayNameColumnBase, identityUserLogin.FindProperty("ProviderDisplayName")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase2, identityUserLogin.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + + var tableMappings14 = new List(); + identityUserLogin.SetRuntimeAnnotation("Relational:TableMappings", tableMappings14); + var aspNetUserLoginsTable = new Table("AspNetUserLogins", null, relationalModel); + var loginProviderColumn = new Column("LoginProvider", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("LoginProvider", loginProviderColumn); + var providerKeyColumn = new Column("ProviderKey", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("ProviderKey", providerKeyColumn); + var providerDisplayNameColumn = new Column("ProviderDisplayName", "TEXT", aspNetUserLoginsTable) + { + IsNullable = true + }; + aspNetUserLoginsTable.Columns.Add("ProviderDisplayName", providerDisplayNameColumn); + var userIdColumn2 = new Column("UserId", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("UserId", userIdColumn2); + var pK_AspNetUserLogins = new UniqueConstraint("PK_AspNetUserLogins", aspNetUserLoginsTable, new[] { loginProviderColumn, providerKeyColumn }); + aspNetUserLoginsTable.PrimaryKey = pK_AspNetUserLogins; + var pK_AspNetUserLoginsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "LoginProvider", "ProviderKey" }); + pK_AspNetUserLogins.MappedKeys.Add(pK_AspNetUserLoginsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserLoginsUc).Add(pK_AspNetUserLogins); + aspNetUserLoginsTable.UniqueConstraints.Add("PK_AspNetUserLogins", pK_AspNetUserLogins); + var iX_AspNetUserLogins_UserId = new TableIndex( + "IX_AspNetUserLogins_UserId", aspNetUserLoginsTable, new[] { userIdColumn2 }, false); + var iX_AspNetUserLogins_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }); + iX_AspNetUserLogins_UserId.MappedIndexes.Add(iX_AspNetUserLogins_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserLogins_UserIdIx).Add(iX_AspNetUserLogins_UserId); + aspNetUserLoginsTable.Indexes.Add("IX_AspNetUserLogins_UserId", iX_AspNetUserLogins_UserId); + relationalModel.Tables.Add(("AspNetUserLogins", null), aspNetUserLoginsTable); + var aspNetUserLoginsTableMapping = new TableMapping(identityUserLogin, aspNetUserLoginsTable, true); + aspNetUserLoginsTable.AddTypeMapping(aspNetUserLoginsTableMapping, false); + tableMappings14.Add(aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn, identityUserLogin.FindProperty("LoginProvider")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerKeyColumn, identityUserLogin.FindProperty("ProviderKey")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerDisplayNameColumn, identityUserLogin.FindProperty("ProviderDisplayName")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn2, identityUserLogin.FindProperty("UserId")!, aspNetUserLoginsTableMapping); + + var identityUserRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserRole")!; + + var defaultTableMappings15 = new List>(); + identityUserRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings15); + var microsoftAspNetCoreIdentityIdentityUserRolestringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserRole", null, relationalModel); + var roleIdColumnBase0 = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("RoleId", roleIdColumnBase0); + var userIdColumnBase3 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("UserId", userIdColumnBase3); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserRole", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + var microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase = new TableMappingBase(identityUserRole, microsoftAspNetCoreIdentityIdentityUserRolestringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase, false); + defaultTableMappings15.Add(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase0, identityUserRole.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase3, identityUserRole.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + + var tableMappings15 = new List(); + identityUserRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings15); + var aspNetUserRolesTable = new Table("AspNetUserRoles", null, relationalModel); + var userIdColumn3 = new Column("UserId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("UserId", userIdColumn3); + var roleIdColumn0 = new Column("RoleId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("RoleId", roleIdColumn0); + var pK_AspNetUserRoles = new UniqueConstraint("PK_AspNetUserRoles", aspNetUserRolesTable, new[] { userIdColumn3, roleIdColumn0 }); + aspNetUserRolesTable.PrimaryKey = pK_AspNetUserRoles; + var pK_AspNetUserRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId", "RoleId" }); + pK_AspNetUserRoles.MappedKeys.Add(pK_AspNetUserRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserRolesUc).Add(pK_AspNetUserRoles); + aspNetUserRolesTable.UniqueConstraints.Add("PK_AspNetUserRoles", pK_AspNetUserRoles); + var iX_AspNetUserRoles_RoleId = new TableIndex( + "IX_AspNetUserRoles_RoleId", aspNetUserRolesTable, new[] { roleIdColumn0 }, false); + var iX_AspNetUserRoles_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }); + iX_AspNetUserRoles_RoleId.MappedIndexes.Add(iX_AspNetUserRoles_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserRoles_RoleIdIx).Add(iX_AspNetUserRoles_RoleId); + aspNetUserRolesTable.Indexes.Add("IX_AspNetUserRoles_RoleId", iX_AspNetUserRoles_RoleId); + relationalModel.Tables.Add(("AspNetUserRoles", null), aspNetUserRolesTable); + var aspNetUserRolesTableMapping = new TableMapping(identityUserRole, aspNetUserRolesTable, true); + aspNetUserRolesTable.AddTypeMapping(aspNetUserRolesTableMapping, false); + tableMappings15.Add(aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn0, identityUserRole.FindProperty("RoleId")!, aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn3, identityUserRole.FindProperty("UserId")!, aspNetUserRolesTableMapping); + + var identityUserToken = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserToken")!; + + var defaultTableMappings16 = new List>(); + identityUserToken.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings16); + var microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserToken", null, relationalModel); + var loginProviderColumnBase0 = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase0); + var nameColumnBase3 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Name", nameColumnBase3); + var userIdColumnBase4 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("UserId", userIdColumnBase4); + var valueColumnBase = new ColumnBase("Value", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Value", valueColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserToken", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase = new TableMappingBase(identityUserToken, microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase, false); + defaultTableMappings16.Add(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase0, identityUserToken.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase3, identityUserToken.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase4, identityUserToken.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueColumnBase, identityUserToken.FindProperty("Value")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + + var tableMappings16 = new List(); + identityUserToken.SetRuntimeAnnotation("Relational:TableMappings", tableMappings16); + var aspNetUserTokensTable = new Table("AspNetUserTokens", null, relationalModel); + var userIdColumn4 = new Column("UserId", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("UserId", userIdColumn4); + var loginProviderColumn0 = new Column("LoginProvider", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("LoginProvider", loginProviderColumn0); + var nameColumn3 = new Column("Name", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("Name", nameColumn3); + var valueColumn = new Column("Value", "TEXT", aspNetUserTokensTable) + { + IsNullable = true + }; + aspNetUserTokensTable.Columns.Add("Value", valueColumn); + var pK_AspNetUserTokens = new UniqueConstraint("PK_AspNetUserTokens", aspNetUserTokensTable, new[] { userIdColumn4, loginProviderColumn0, nameColumn3 }); + aspNetUserTokensTable.PrimaryKey = pK_AspNetUserTokens; + var pK_AspNetUserTokensUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId", "LoginProvider", "Name" }); + pK_AspNetUserTokens.MappedKeys.Add(pK_AspNetUserTokensUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserTokensUc).Add(pK_AspNetUserTokens); + aspNetUserTokensTable.UniqueConstraints.Add("PK_AspNetUserTokens", pK_AspNetUserTokens); + relationalModel.Tables.Add(("AspNetUserTokens", null), aspNetUserTokensTable); + var aspNetUserTokensTableMapping = new TableMapping(identityUserToken, aspNetUserTokensTable, true); + aspNetUserTokensTable.AddTypeMapping(aspNetUserTokensTableMapping, false); + tableMappings16.Add(aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn0, identityUserToken.FindProperty("LoginProvider")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(nameColumn3, identityUserToken.FindProperty("Name")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn4, identityUserToken.FindProperty("UserId")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(valueColumn, identityUserToken.FindProperty("Value")!, aspNetUserTokensTableMapping); + var fK_AspNetRoleClaims_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetRoleClaims_AspNetRoles_RoleId", aspNetRoleClaimsTable, aspNetRolesTable, + new[] { roleIdColumn }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetRoleClaims_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetRoleClaims_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk).Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRoleClaimsTable.ForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + var fK_AspNetUserClaims_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserClaims_AspNetUsers_UserId", aspNetUserClaimsTable, aspNetUsersTable, + new[] { userIdColumn1 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserClaims_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserClaims_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserClaims_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserClaims_AspNetUsers_UserIdFk).Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUserClaimsTable.ForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + var fK_AspNetUserLogins_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserLogins_AspNetUsers_UserId", aspNetUserLoginsTable, aspNetUsersTable, + new[] { userIdColumn2 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserLogins_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserLogins_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserLogins_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserLogins_AspNetUsers_UserIdFk).Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUserLoginsTable.ForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + var fK_AspNetUserRoles_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetRoles_RoleId", aspNetUserRolesTable, aspNetRolesTable, + new[] { roleIdColumn0 }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetRoles_RoleIdFk).Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + var fK_AspNetUserRoles_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetUsers_UserId", aspNetUserRolesTable, aspNetUsersTable, + new[] { userIdColumn3 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetUsers_UserIdFk).Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + var fK_AspNetUserTokens_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserTokens_AspNetUsers_UserId", aspNetUserTokensTable, aspNetUsersTable, + new[] { userIdColumn4 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserTokens_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserTokens_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserTokens_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserTokens_AspNetUsers_UserIdFk).Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUserTokensTable.ForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + var fK_Orders_Address_DeliveryAddressId = new ForeignKeyConstraint( + "FK_Orders_Address_DeliveryAddressId", ordersTable, addressTable, + new[] { deliveryAddressIdColumn }, + addressTable.FindUniqueConstraint("PK_Address")!, ReferentialAction.Cascade); + var fK_Orders_Address_DeliveryAddressIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }, + "BlazingPizza.Address", + new[] { "Id" }); + fK_Orders_Address_DeliveryAddressId.MappedForeignKeys.Add(fK_Orders_Address_DeliveryAddressIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Orders_Address_DeliveryAddressIdFk).Add(fK_Orders_Address_DeliveryAddressId); + ordersTable.ForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + addressTable.ReferencingForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + var fK_Pizzas_Orders_OrderId = new ForeignKeyConstraint( + "FK_Pizzas_Orders_OrderId", pizzasTable, ordersTable, + new[] { orderIdColumn0 }, + ordersTable.FindUniqueConstraint("PK_Orders")!, ReferentialAction.Cascade); + var fK_Pizzas_Orders_OrderIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" }); + fK_Pizzas_Orders_OrderId.MappedForeignKeys.Add(fK_Pizzas_Orders_OrderIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Orders_OrderIdFk).Add(fK_Pizzas_Orders_OrderId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + ordersTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + var fK_Pizzas_Specials_SpecialId = new ForeignKeyConstraint( + "FK_Pizzas_Specials_SpecialId", pizzasTable, specialsTable, + new[] { specialIdColumn }, + specialsTable.FindUniqueConstraint("PK_Specials")!, ReferentialAction.Cascade); + var fK_Pizzas_Specials_SpecialIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + fK_Pizzas_Specials_SpecialId.MappedForeignKeys.Add(fK_Pizzas_Specials_SpecialIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Specials_SpecialIdFk).Add(fK_Pizzas_Specials_SpecialId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + specialsTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + var fK_PizzaTopping_Pizzas_PizzaId = new ForeignKeyConstraint( + "FK_PizzaTopping_Pizzas_PizzaId", pizzaToppingTable, pizzasTable, + new[] { pizzaIdColumn }, + pizzasTable.FindUniqueConstraint("PK_Pizzas")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Pizzas_PizzaIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId" }, + "BlazingPizza.Pizza", + new[] { "Id" }); + fK_PizzaTopping_Pizzas_PizzaId.MappedForeignKeys.Add(fK_PizzaTopping_Pizzas_PizzaIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Pizzas_PizzaIdFk).Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzasTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + var fK_PizzaTopping_Toppings_ToppingId = new ForeignKeyConstraint( + "FK_PizzaTopping_Toppings_ToppingId", pizzaToppingTable, toppingsTable, + new[] { toppingIdColumn }, + toppingsTable.FindUniqueConstraint("PK_Toppings")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Toppings_ToppingIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }, + "BlazingPizza.Topping", + new[] { "Id" }); + fK_PizzaTopping_Toppings_ToppingId.MappedForeignKeys.Add(fK_PizzaTopping_Toppings_ToppingIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Toppings_ToppingIdFk).Add(fK_PizzaTopping_Toppings_ToppingId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + toppingsTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs similarity index 63% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs index 18b2d96d..7295425c 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs @@ -2,12 +2,15 @@ using System; using System.Reflection; using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaStoreUserEntityType { @@ -24,12 +27,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var accessFailedCount = runtimeEntityType.AddProperty( "AccessFailedCount", typeof(int), propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + accessFailedCount.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var concurrencyStamp = runtimeEntityType.AddProperty( "ConcurrencyStamp", @@ -38,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; var email = runtimeEntityType.AddProperty( "Email", @@ -46,18 +67,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + email.TypeMapping = SqliteStringTypeMapping.Default; var emailConfirmed = runtimeEntityType.AddProperty( "EmailConfirmed", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + emailConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var lockoutEnabled = runtimeEntityType.AddProperty( "LockoutEnabled", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + lockoutEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var lockoutEnd = runtimeEntityType.AddProperty( "LockoutEnd", @@ -65,6 +119,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + lockoutEnd.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default; var normalizedEmail = runtimeEntityType.AddProperty( "NormalizedEmail", @@ -73,6 +128,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedEmail.TypeMapping = SqliteStringTypeMapping.Default; var normalizedUserName = runtimeEntityType.AddProperty( "NormalizedUserName", @@ -81,6 +137,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedUserName.TypeMapping = SqliteStringTypeMapping.Default; var passwordHash = runtimeEntityType.AddProperty( "PasswordHash", @@ -88,6 +145,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + passwordHash.TypeMapping = SqliteStringTypeMapping.Default; var phoneNumber = runtimeEntityType.AddProperty( "PhoneNumber", @@ -95,12 +153,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + phoneNumber.TypeMapping = SqliteStringTypeMapping.Default; var phoneNumberConfirmed = runtimeEntityType.AddProperty( "PhoneNumberConfirmed", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + phoneNumberConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var securityStamp = runtimeEntityType.AddProperty( "SecurityStamp", @@ -108,12 +183,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + securityStamp.TypeMapping = SqliteStringTypeMapping.Default; var twoFactorEnabled = runtimeEntityType.AddProperty( "TwoFactorEnabled", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + twoFactorEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var userName = runtimeEntityType.AddProperty( "UserName", @@ -122,6 +214,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + userName.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaToppingEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs similarity index 72% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaToppingEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs index b97d2a24..803ab153 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaToppingEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaToppingEntityType { @@ -24,14 +26,46 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int), propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + pizzaId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var toppingId = runtimeEntityType.AddProperty( "ToppingId", typeof(int), propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + toppingId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { pizzaId, toppingId }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/ToppingEntityType.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs similarity index 68% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/ToppingEntityType.cs rename to save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs index 9295f9bf..d3a19507 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/ToppingEntityType.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class ToppingEntityType { @@ -23,20 +26,38 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var name = runtimeEntityType.AddProperty( "Name", typeof(string), propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; var price = runtimeEntityType.AddProperty( "Price", typeof(decimal), propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + price.TypeMapping = SqliteDecimalTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs deleted file mode 100644 index ba42d6b0..00000000 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - public partial class PizzaStoreContextModel - { - partial void Initialize() - { - var address = AddressEntityType.Create(this); - var latLong = LatLongEntityType.Create(this); - var notificationSubscription = NotificationSubscriptionEntityType.Create(this); - var order = OrderEntityType.Create(this); - var pizza = PizzaEntityType.Create(this); - var pizzaSpecial = PizzaSpecialEntityType.Create(this); - var pizzaTopping = PizzaToppingEntityType.Create(this); - var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); - var topping = ToppingEntityType.Create(this); - var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); - var key = KeyEntityType.Create(this); - var persistedGrant = PersistedGrantEntityType.Create(this); - var identityRole = IdentityRoleEntityType.Create(this); - var identityRoleClaimstring = IdentityRoleClaimstringEntityType.Create(this); - var identityUserClaimstring = IdentityUserClaimstringEntityType.Create(this); - var identityUserLoginstring = IdentityUserLoginstringEntityType.Create(this); - var identityUserRolestring = IdentityUserRolestringEntityType.Create(this); - var identityUserTokenstring = IdentityUserTokenstringEntityType.Create(this); - - LatLongEntityType.CreateForeignKey1(latLong, order); - OrderEntityType.CreateForeignKey1(order, address); - PizzaEntityType.CreateForeignKey1(pizza, order); - PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); - PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); - PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); - IdentityRoleClaimstringEntityType.CreateForeignKey1(identityRoleClaimstring, identityRole); - IdentityUserClaimstringEntityType.CreateForeignKey1(identityUserClaimstring, pizzaStoreUser); - IdentityUserLoginstringEntityType.CreateForeignKey1(identityUserLoginstring, pizzaStoreUser); - IdentityUserRolestringEntityType.CreateForeignKey1(identityUserRolestring, identityRole); - IdentityUserRolestringEntityType.CreateForeignKey2(identityUserRolestring, pizzaStoreUser); - IdentityUserTokenstringEntityType.CreateForeignKey1(identityUserTokenstring, pizzaStoreUser); - - AddressEntityType.CreateAnnotations(address); - LatLongEntityType.CreateAnnotations(latLong); - NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); - OrderEntityType.CreateAnnotations(order); - PizzaEntityType.CreateAnnotations(pizza); - PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); - PizzaToppingEntityType.CreateAnnotations(pizzaTopping); - PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); - ToppingEntityType.CreateAnnotations(topping); - DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); - KeyEntityType.CreateAnnotations(key); - PersistedGrantEntityType.CreateAnnotations(persistedGrant); - IdentityRoleEntityType.CreateAnnotations(identityRole); - IdentityRoleClaimstringEntityType.CreateAnnotations(identityRoleClaimstring); - IdentityUserClaimstringEntityType.CreateAnnotations(identityUserClaimstring); - IdentityUserLoginstringEntityType.CreateAnnotations(identityUserLoginstring); - IdentityUserRolestringEntityType.CreateAnnotations(identityUserRolestring); - IdentityUserTokenstringEntityType.CreateAnnotations(identityUserTokenstring); - - AddAnnotation("ProductVersion", "7.0.0"); - } - } -} diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Program.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/Program.cs index b83debb4..e94b62b7 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Program.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddDbContext(options => options.UseSqlite("Data Source=pizza.db") - .UseModel(BlazingPizza.Server.Models.PizzaStoreContextModel.Instance)); + .UseModel(BlazingPizza.Server.CompiledModels.PizzaStoreContextModel.Instance)); builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/SeedData.cs b/save-points/04-refactor-state-management/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/SeedData.cs +++ b/save-points/04-refactor-state-management/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/05-checkout-with-validation/BlazingPizza.Server/BlazingPizza.Server.csproj index a1043cb6..e8687fc4 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/AddressEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/AddressEntityType.cs similarity index 76% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/AddressEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/AddressEntityType.cs index 82db81b6..f5908d82 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/AddressEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/AddressEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class AddressEntityType { @@ -23,7 +26,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var city = runtimeEntityType.AddProperty( "City", @@ -31,6 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + city.TypeMapping = SqliteStringTypeMapping.Default; var line1 = runtimeEntityType.AddProperty( "Line1", @@ -38,14 +58,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + line1.TypeMapping = SqliteStringTypeMapping.Default; var line2 = runtimeEntityType.AddProperty( "Line2", typeof(string), propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, maxLength: 100); + line2.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -53,6 +74,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + name.TypeMapping = SqliteStringTypeMapping.Default; var postalCode = runtimeEntityType.AddProperty( "PostalCode", @@ -60,6 +82,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 20); + postalCode.TypeMapping = SqliteStringTypeMapping.Default; var region = runtimeEntityType.AddProperty( "Region", @@ -67,6 +90,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 20); + region.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs similarity index 87% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs index 1dd4563b..6c5ca661 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class DeviceFlowCodesEntityType { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 200); + userCode.TypeMapping = SqliteStringTypeMapping.Default; var clientId = runtimeEntityType.AddProperty( "ClientId", @@ -32,12 +34,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; var creationTime = runtimeEntityType.AddProperty( "CreationTime", typeof(DateTime), propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", @@ -45,6 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", @@ -53,6 +59,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; var deviceCode = runtimeEntityType.AddProperty( "DeviceCode", @@ -60,12 +67,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + deviceCode.TypeMapping = SqliteStringTypeMapping.Default; var expiration = runtimeEntityType.AddProperty( "Expiration", typeof(DateTime?), propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; var sessionId = runtimeEntityType.AddProperty( "SessionId", @@ -74,6 +83,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; var subjectId = runtimeEntityType.AddProperty( "SubjectId", @@ -82,6 +92,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userCode }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs similarity index 76% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs index 8946b261..73cabada 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs @@ -3,14 +3,17 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityRoleClaimstringEntityType + internal partial class IdentityRoleClaimEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,7 +28,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var claimType = runtimeEntityType.AddProperty( "ClaimType", @@ -33,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; var claimValue = runtimeEntityType.AddProperty( "ClaimValue", @@ -40,12 +60,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; var roleId = runtimeEntityType.AddProperty( "RoleId", typeof(string), propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + roleId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs similarity index 90% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityRoleEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs index 2f1fec2b..3f46cdc5 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityRoleEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class IdentityRoleEntityType { @@ -24,6 +25,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var concurrencyStamp = runtimeEntityType.AddProperty( "ConcurrencyStamp", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -40,6 +43,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + name.TypeMapping = SqliteStringTypeMapping.Default; var normalizedName = runtimeEntityType.AddProperty( "NormalizedName", @@ -48,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedName.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs similarity index 76% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs index 55418a1e..5de58bf8 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs @@ -3,14 +3,17 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserClaimstringEntityType + internal partial class IdentityUserClaimEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,7 +28,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var claimType = runtimeEntityType.AddProperty( "ClaimType", @@ -33,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; var claimValue = runtimeEntityType.AddProperty( "ClaimValue", @@ -40,12 +60,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", typeof(string), propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs similarity index 90% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs index 3ca029bd..fb868abc 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserLoginstringEntityType + internal partial class IdentityUserLoginEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -26,6 +27,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; var providerKey = runtimeEntityType.AddProperty( "ProviderKey", @@ -34,6 +36,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + providerKey.TypeMapping = SqliteStringTypeMapping.Default; var providerDisplayName = runtimeEntityType.AddProperty( "ProviderDisplayName", @@ -41,12 +44,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + providerDisplayName.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", typeof(string), propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { loginProvider, providerKey }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs similarity index 92% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs index 70078d7a..f22fd836 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserRolestringEntityType + internal partial class IdentityUserRoleEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; var roleId = runtimeEntityType.AddProperty( "RoleId", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + roleId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userId, roleId }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs similarity index 90% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs index 93ba6d31..b4e36069 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserTokenstringEntityType + internal partial class IdentityUserTokenEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; var loginProvider = runtimeEntityType.AddProperty( "LoginProvider", @@ -33,6 +35,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -41,6 +44,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + name.TypeMapping = SqliteStringTypeMapping.Default; var value = runtimeEntityType.AddProperty( "Value", @@ -48,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + value.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userId, loginProvider, name }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/KeyEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/KeyEntityType.cs similarity index 61% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/KeyEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/KeyEntityType.cs index f6c6b4c7..8743240a 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/KeyEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/KeyEntityType.cs @@ -2,12 +2,15 @@ using System; using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class KeyEntityType { @@ -24,6 +27,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var algorithm = runtimeEntityType.AddProperty( "Algorithm", @@ -31,30 +35,66 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + algorithm.TypeMapping = SqliteStringTypeMapping.Default; var created = runtimeEntityType.AddProperty( "Created", typeof(DateTime), propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + created.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", typeof(string), propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + data.TypeMapping = SqliteStringTypeMapping.Default; var dataProtected = runtimeEntityType.AddProperty( "DataProtected", typeof(bool), propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + dataProtected.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var isX509Certificate = runtimeEntityType.AddProperty( "IsX509Certificate", typeof(bool), propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + isX509Certificate.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var use = runtimeEntityType.AddProperty( "Use", @@ -62,12 +102,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + use.TypeMapping = SqliteStringTypeMapping.Default; var version = runtimeEntityType.AddProperty( "Version", typeof(int), propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + version.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/LatLongEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs similarity index 56% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/LatLongEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs index 3fd254bd..657b8093 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/LatLongEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs @@ -2,12 +2,14 @@ using System; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class LatLongEntityType { @@ -21,19 +23,67 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas var orderId = runtimeEntityType.AddProperty( "OrderId", typeof(int), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var latitude = runtimeEntityType.AddProperty( "Latitude", typeof(double), propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + latitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); var longitude = runtimeEntityType.AddProperty( "Longitude", typeof(double), propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + longitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); var key = runtimeEntityType.AddKey( new[] { orderId }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs similarity index 68% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs index db236e4c..891722a1 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class NotificationSubscriptionEntityType { @@ -19,11 +22,26 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas var notificationSubscriptionId = runtimeEntityType.AddProperty( "NotificationSubscriptionId", - typeof(int), + typeof(int?), propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + notificationSubscriptionId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + keyComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + providerValueComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var auth = runtimeEntityType.AddProperty( "Auth", @@ -31,6 +49,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + auth.TypeMapping = SqliteStringTypeMapping.Default; var p256dh = runtimeEntityType.AddProperty( "P256dh", @@ -38,6 +57,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + p256dh.TypeMapping = SqliteStringTypeMapping.Default; var url = runtimeEntityType.AddProperty( "Url", @@ -45,6 +65,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + url.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", @@ -52,6 +73,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { notificationSubscriptionId }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/OrderEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/OrderEntityType.cs similarity index 63% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/OrderEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/OrderEntityType.cs index 9d9ec6fd..bf1e5171 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/OrderEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/OrderEntityType.cs @@ -1,12 +1,16 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class OrderEntityType { @@ -23,18 +27,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var createdTime = runtimeEntityType.AddProperty( "CreatedTime", typeof(DateTime), propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + createdTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var deliveryAddressId = runtimeEntityType.AddProperty( "DeliveryAddressId", - typeof(int?), - nullable: true); + typeof(int), + sentinel: 0); + deliveryAddressId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var userId = runtimeEntityType.AddProperty( "UserId", @@ -42,6 +79,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { orderId }); @@ -57,7 +95,9 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType); + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", runtimeForeignKey, diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/PersistedGrantEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs similarity index 87% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/PersistedGrantEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs index 842d53a5..c57731dd 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/PersistedGrantEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PersistedGrantEntityType { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 200); + key.TypeMapping = SqliteStringTypeMapping.Default; var clientId = runtimeEntityType.AddProperty( "ClientId", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; var consumedTime = runtimeEntityType.AddProperty( "ConsumedTime", @@ -39,12 +42,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + consumedTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var creationTime = runtimeEntityType.AddProperty( "CreationTime", typeof(DateTime), propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", @@ -52,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", @@ -60,6 +67,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; var expiration = runtimeEntityType.AddProperty( "Expiration", @@ -67,6 +75,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; var sessionId = runtimeEntityType.AddProperty( "SessionId", @@ -75,6 +84,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; var subjectId = runtimeEntityType.AddProperty( "SubjectId", @@ -83,6 +93,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; var type = runtimeEntityType.AddProperty( "Type", @@ -90,6 +101,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + type.TypeMapping = SqliteStringTypeMapping.Default; var key0 = runtimeEntityType.AddKey( new[] { key }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs similarity index 62% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs index 3a124e63..f8ac05e4 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaEntityType { @@ -25,25 +27,89 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var orderId = runtimeEntityType.AddProperty( "OrderId", typeof(int), propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var size = runtimeEntityType.AddProperty( "Size", typeof(int), propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + size.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var specialId = runtimeEntityType.AddProperty( "SpecialId", typeof(int), propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + specialId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs similarity index 70% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs index e86b0f50..693286c8 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaSpecialEntityType { @@ -23,34 +26,52 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var basePrice = runtimeEntityType.AddProperty( "BasePrice", typeof(decimal), propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + basePrice.TypeMapping = SqliteDecimalTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + description.TypeMapping = SqliteStringTypeMapping.Default; var imageUrl = runtimeEntityType.AddProperty( "ImageUrl", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + imageUrl.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreContextModel.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs similarity index 50% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreContextModel.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs index 8b516a68..b7e36125 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreContextModel.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs @@ -5,15 +5,34 @@ #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { [DbContext(typeof(PizzaStoreContext))] public partial class PizzaStoreContextModel : RuntimeModel { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + static PizzaStoreContextModel() { var model = new PizzaStoreContextModel(); - model.Initialize(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + model.Customize(); _instance = model; } diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs new file mode 100644 index 00000000..0f8d07cb --- /dev/null +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs @@ -0,0 +1,1619 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + public partial class PizzaStoreContextModel + { + partial void Initialize() + { + var address = AddressEntityType.Create(this); + var latLong = LatLongEntityType.Create(this); + var notificationSubscription = NotificationSubscriptionEntityType.Create(this); + var order = OrderEntityType.Create(this); + var pizza = PizzaEntityType.Create(this); + var pizzaSpecial = PizzaSpecialEntityType.Create(this); + var pizzaTopping = PizzaToppingEntityType.Create(this); + var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); + var topping = ToppingEntityType.Create(this); + var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); + var key = KeyEntityType.Create(this); + var persistedGrant = PersistedGrantEntityType.Create(this); + var identityRole = IdentityRoleEntityType.Create(this); + var identityRoleClaim = IdentityRoleClaimEntityType.Create(this); + var identityUserClaim = IdentityUserClaimEntityType.Create(this); + var identityUserLogin = IdentityUserLoginEntityType.Create(this); + var identityUserRole = IdentityUserRoleEntityType.Create(this); + var identityUserToken = IdentityUserTokenEntityType.Create(this); + + LatLongEntityType.CreateForeignKey1(latLong, order); + OrderEntityType.CreateForeignKey1(order, address); + PizzaEntityType.CreateForeignKey1(pizza, order); + PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); + PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); + PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); + IdentityRoleClaimEntityType.CreateForeignKey1(identityRoleClaim, identityRole); + IdentityUserClaimEntityType.CreateForeignKey1(identityUserClaim, pizzaStoreUser); + IdentityUserLoginEntityType.CreateForeignKey1(identityUserLogin, pizzaStoreUser); + IdentityUserRoleEntityType.CreateForeignKey1(identityUserRole, identityRole); + IdentityUserRoleEntityType.CreateForeignKey2(identityUserRole, pizzaStoreUser); + IdentityUserTokenEntityType.CreateForeignKey1(identityUserToken, pizzaStoreUser); + + AddressEntityType.CreateAnnotations(address); + LatLongEntityType.CreateAnnotations(latLong); + NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); + OrderEntityType.CreateAnnotations(order); + PizzaEntityType.CreateAnnotations(pizza); + PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); + PizzaToppingEntityType.CreateAnnotations(pizzaTopping); + PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); + ToppingEntityType.CreateAnnotations(topping); + DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); + KeyEntityType.CreateAnnotations(key); + PersistedGrantEntityType.CreateAnnotations(persistedGrant); + IdentityRoleEntityType.CreateAnnotations(identityRole); + IdentityRoleClaimEntityType.CreateAnnotations(identityRoleClaim); + IdentityUserClaimEntityType.CreateAnnotations(identityUserClaim); + IdentityUserLoginEntityType.CreateAnnotations(identityUserLogin); + IdentityUserRoleEntityType.CreateAnnotations(identityUserRole); + IdentityUserTokenEntityType.CreateAnnotations(identityUserToken); + + AddAnnotation("ProductVersion", "8.0.0"); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var address = FindEntityType("BlazingPizza.Address")!; + + var defaultTableMappings = new List>(); + address.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var blazingPizzaAddressTableBase = new TableBase("BlazingPizza.Address", null, relationalModel); + var cityColumnBase = new ColumnBase("City", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("City", cityColumnBase); + var idColumnBase = new ColumnBase("Id", "INTEGER", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Id", idColumnBase); + var line1ColumnBase = new ColumnBase("Line1", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line1", line1ColumnBase); + var line2ColumnBase = new ColumnBase("Line2", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line2", line2ColumnBase); + var nameColumnBase = new ColumnBase("Name", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Name", nameColumnBase); + var postalCodeColumnBase = new ColumnBase("PostalCode", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("PostalCode", postalCodeColumnBase); + var regionColumnBase = new ColumnBase("Region", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Region", regionColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Address", blazingPizzaAddressTableBase); + var blazingPizzaAddressMappingBase = new TableMappingBase(address, blazingPizzaAddressTableBase, true); + blazingPizzaAddressTableBase.AddTypeMapping(blazingPizzaAddressMappingBase, false); + defaultTableMappings.Add(blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, address.FindProperty("Id")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)cityColumnBase, address.FindProperty("City")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line1ColumnBase, address.FindProperty("Line1")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line2ColumnBase, address.FindProperty("Line2")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase, address.FindProperty("Name")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)postalCodeColumnBase, address.FindProperty("PostalCode")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)regionColumnBase, address.FindProperty("Region")!, blazingPizzaAddressMappingBase); + + var tableMappings = new List(); + address.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var addressTable = new Table("Address", null, relationalModel); + var idColumn = new Column("Id", "INTEGER", addressTable); + addressTable.Columns.Add("Id", idColumn); + var cityColumn = new Column("City", "TEXT", addressTable); + addressTable.Columns.Add("City", cityColumn); + var line1Column = new Column("Line1", "TEXT", addressTable); + addressTable.Columns.Add("Line1", line1Column); + var line2Column = new Column("Line2", "TEXT", addressTable); + addressTable.Columns.Add("Line2", line2Column); + var nameColumn = new Column("Name", "TEXT", addressTable); + addressTable.Columns.Add("Name", nameColumn); + var postalCodeColumn = new Column("PostalCode", "TEXT", addressTable); + addressTable.Columns.Add("PostalCode", postalCodeColumn); + var regionColumn = new Column("Region", "TEXT", addressTable); + addressTable.Columns.Add("Region", regionColumn); + var pK_Address = new UniqueConstraint("PK_Address", addressTable, new[] { idColumn }); + addressTable.PrimaryKey = pK_Address; + var pK_AddressUc = RelationalModel.GetKey(this, + "BlazingPizza.Address", + new[] { "Id" }); + pK_Address.MappedKeys.Add(pK_AddressUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AddressUc).Add(pK_Address); + addressTable.UniqueConstraints.Add("PK_Address", pK_Address); + relationalModel.Tables.Add(("Address", null), addressTable); + var addressTableMapping = new TableMapping(address, addressTable, true); + addressTable.AddTypeMapping(addressTableMapping, false); + tableMappings.Add(addressTableMapping); + RelationalModel.CreateColumnMapping(idColumn, address.FindProperty("Id")!, addressTableMapping); + RelationalModel.CreateColumnMapping(cityColumn, address.FindProperty("City")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line1Column, address.FindProperty("Line1")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line2Column, address.FindProperty("Line2")!, addressTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, address.FindProperty("Name")!, addressTableMapping); + RelationalModel.CreateColumnMapping(postalCodeColumn, address.FindProperty("PostalCode")!, addressTableMapping); + RelationalModel.CreateColumnMapping(regionColumn, address.FindProperty("Region")!, addressTableMapping); + + var latLong = FindEntityType("BlazingPizza.LatLong")!; + + var defaultTableMappings0 = new List>(); + latLong.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var blazingPizzaLatLongTableBase = new TableBase("BlazingPizza.LatLong", null, relationalModel); + var latitudeColumnBase = new ColumnBase("Latitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Latitude", latitudeColumnBase); + var longitudeColumnBase = new ColumnBase("Longitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Longitude", longitudeColumnBase); + var orderIdColumnBase = new ColumnBase("OrderId", "INTEGER", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("OrderId", orderIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.LatLong", blazingPizzaLatLongTableBase); + var blazingPizzaLatLongMappingBase = new TableMappingBase(latLong, blazingPizzaLatLongTableBase, true); + blazingPizzaLatLongTableBase.AddTypeMapping(blazingPizzaLatLongMappingBase, false); + defaultTableMappings0.Add(blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase, latLong.FindProperty("OrderId")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)latitudeColumnBase, latLong.FindProperty("Latitude")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)longitudeColumnBase, latLong.FindProperty("Longitude")!, blazingPizzaLatLongMappingBase); + + var tableMappings0 = new List(); + latLong.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var ordersTable = new Table("Orders", null, relationalModel); + var orderIdColumn = new Column("OrderId", "INTEGER", ordersTable); + ordersTable.Columns.Add("OrderId", orderIdColumn); + var createdTimeColumn = new Column("CreatedTime", "TEXT", ordersTable); + ordersTable.Columns.Add("CreatedTime", createdTimeColumn); + var deliveryAddressIdColumn = new Column("DeliveryAddressId", "INTEGER", ordersTable); + ordersTable.Columns.Add("DeliveryAddressId", deliveryAddressIdColumn); + var deliveryLocation_LatitudeColumn = new Column("DeliveryLocation_Latitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Latitude", deliveryLocation_LatitudeColumn); + var deliveryLocation_LongitudeColumn = new Column("DeliveryLocation_Longitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Longitude", deliveryLocation_LongitudeColumn); + var userIdColumn = new Column("UserId", "TEXT", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("UserId", userIdColumn); + var pK_Orders = new UniqueConstraint("PK_Orders", ordersTable, new[] { orderIdColumn }); + ordersTable.PrimaryKey = pK_Orders; + var pK_OrdersUc = RelationalModel.GetKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc).Add(pK_Orders); + var pK_OrdersUc0 = RelationalModel.GetKey(this, + "BlazingPizza.Order", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc0); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc0).Add(pK_Orders); + ordersTable.UniqueConstraints.Add("PK_Orders", pK_Orders); + var iX_Orders_DeliveryAddressId = new TableIndex( + "IX_Orders_DeliveryAddressId", ordersTable, new[] { deliveryAddressIdColumn }, false); + var iX_Orders_DeliveryAddressIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }); + iX_Orders_DeliveryAddressId.MappedIndexes.Add(iX_Orders_DeliveryAddressIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Orders_DeliveryAddressIdIx).Add(iX_Orders_DeliveryAddressId); + ordersTable.Indexes.Add("IX_Orders_DeliveryAddressId", iX_Orders_DeliveryAddressId); + relationalModel.Tables.Add(("Orders", null), ordersTable); + var ordersTableMapping = new TableMapping(latLong, ordersTable, true) + { + IsSharedTablePrincipal = false, + }; + ordersTable.AddTypeMapping(ordersTableMapping, true); + tableMappings0.Add(ordersTableMapping); + ordersTable.AddRowInternalForeignKey(latLong, RelationalModel.GetForeignKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" })); + RelationalModel.CreateColumnMapping(orderIdColumn, latLong.FindProperty("OrderId")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LatitudeColumn, latLong.FindProperty("Latitude")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LongitudeColumn, latLong.FindProperty("Longitude")!, ordersTableMapping); + + var notificationSubscription = FindEntityType("BlazingPizza.NotificationSubscription")!; + + var defaultTableMappings1 = new List>(); + notificationSubscription.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var blazingPizzaNotificationSubscriptionTableBase = new TableBase("BlazingPizza.NotificationSubscription", null, relationalModel); + var authColumnBase = new ColumnBase("Auth", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Auth", authColumnBase); + var notificationSubscriptionIdColumnBase = new ColumnBase("NotificationSubscriptionId", "INTEGER", blazingPizzaNotificationSubscriptionTableBase); + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumnBase); + var p256dhColumnBase = new ColumnBase("P256dh", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("P256dh", p256dhColumnBase); + var urlColumnBase = new ColumnBase("Url", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Url", urlColumnBase); + var userIdColumnBase = new ColumnBase("UserId", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("UserId", userIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.NotificationSubscription", blazingPizzaNotificationSubscriptionTableBase); + var blazingPizzaNotificationSubscriptionMappingBase = new TableMappingBase(notificationSubscription, blazingPizzaNotificationSubscriptionTableBase, true); + blazingPizzaNotificationSubscriptionTableBase.AddTypeMapping(blazingPizzaNotificationSubscriptionMappingBase, false); + defaultTableMappings1.Add(blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)notificationSubscriptionIdColumnBase, notificationSubscription.FindProperty("NotificationSubscriptionId")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)authColumnBase, notificationSubscription.FindProperty("Auth")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)p256dhColumnBase, notificationSubscription.FindProperty("P256dh")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)urlColumnBase, notificationSubscription.FindProperty("Url")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase, notificationSubscription.FindProperty("UserId")!, blazingPizzaNotificationSubscriptionMappingBase); + + var tableMappings1 = new List(); + notificationSubscription.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var notificationSubscriptionsTable = new Table("NotificationSubscriptions", null, relationalModel); + var notificationSubscriptionIdColumn = new Column("NotificationSubscriptionId", "INTEGER", notificationSubscriptionsTable); + notificationSubscriptionsTable.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumn); + var authColumn = new Column("Auth", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Auth", authColumn); + var p256dhColumn = new Column("P256dh", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("P256dh", p256dhColumn); + var urlColumn = new Column("Url", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Url", urlColumn); + var userIdColumn0 = new Column("UserId", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("UserId", userIdColumn0); + var pK_NotificationSubscriptions = new UniqueConstraint("PK_NotificationSubscriptions", notificationSubscriptionsTable, new[] { notificationSubscriptionIdColumn }); + notificationSubscriptionsTable.PrimaryKey = pK_NotificationSubscriptions; + var pK_NotificationSubscriptionsUc = RelationalModel.GetKey(this, + "BlazingPizza.NotificationSubscription", + new[] { "NotificationSubscriptionId" }); + pK_NotificationSubscriptions.MappedKeys.Add(pK_NotificationSubscriptionsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_NotificationSubscriptionsUc).Add(pK_NotificationSubscriptions); + notificationSubscriptionsTable.UniqueConstraints.Add("PK_NotificationSubscriptions", pK_NotificationSubscriptions); + relationalModel.Tables.Add(("NotificationSubscriptions", null), notificationSubscriptionsTable); + var notificationSubscriptionsTableMapping = new TableMapping(notificationSubscription, notificationSubscriptionsTable, true); + notificationSubscriptionsTable.AddTypeMapping(notificationSubscriptionsTableMapping, false); + tableMappings1.Add(notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(notificationSubscriptionIdColumn, notificationSubscription.FindProperty("NotificationSubscriptionId")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(authColumn, notificationSubscription.FindProperty("Auth")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(p256dhColumn, notificationSubscription.FindProperty("P256dh")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(urlColumn, notificationSubscription.FindProperty("Url")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn0, notificationSubscription.FindProperty("UserId")!, notificationSubscriptionsTableMapping); + + var order = FindEntityType("BlazingPizza.Order")!; + + var defaultTableMappings2 = new List>(); + order.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings2); + var blazingPizzaOrderTableBase = new TableBase("BlazingPizza.Order", null, relationalModel); + var createdTimeColumnBase = new ColumnBase("CreatedTime", "TEXT", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("CreatedTime", createdTimeColumnBase); + var deliveryAddressIdColumnBase = new ColumnBase("DeliveryAddressId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("DeliveryAddressId", deliveryAddressIdColumnBase); + var orderIdColumnBase0 = new ColumnBase("OrderId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("OrderId", orderIdColumnBase0); + var userIdColumnBase0 = new ColumnBase("UserId", "TEXT", blazingPizzaOrderTableBase) + { + IsNullable = true + }; + blazingPizzaOrderTableBase.Columns.Add("UserId", userIdColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.Order", blazingPizzaOrderTableBase); + var blazingPizzaOrderMappingBase = new TableMappingBase(order, blazingPizzaOrderTableBase, true); + blazingPizzaOrderTableBase.AddTypeMapping(blazingPizzaOrderMappingBase, false); + defaultTableMappings2.Add(blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase0, order.FindProperty("OrderId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdTimeColumnBase, order.FindProperty("CreatedTime")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deliveryAddressIdColumnBase, order.FindProperty("DeliveryAddressId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase0, order.FindProperty("UserId")!, blazingPizzaOrderMappingBase); + + var tableMappings2 = new List(); + order.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); + var ordersTableMapping0 = new TableMapping(order, ordersTable, true) + { + IsSharedTablePrincipal = true, + }; + ordersTable.AddTypeMapping(ordersTableMapping0, false); + tableMappings2.Add(ordersTableMapping0); + RelationalModel.CreateColumnMapping(orderIdColumn, order.FindProperty("OrderId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(createdTimeColumn, order.FindProperty("CreatedTime")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(deliveryAddressIdColumn, order.FindProperty("DeliveryAddressId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(userIdColumn, order.FindProperty("UserId")!, ordersTableMapping0); + + var pizza = FindEntityType("BlazingPizza.Pizza")!; + + var defaultTableMappings3 = new List>(); + pizza.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings3); + var blazingPizzaPizzaTableBase = new TableBase("BlazingPizza.Pizza", null, relationalModel); + var idColumnBase0 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Id", idColumnBase0); + var orderIdColumnBase1 = new ColumnBase("OrderId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("OrderId", orderIdColumnBase1); + var sizeColumnBase = new ColumnBase("Size", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Size", sizeColumnBase); + var specialIdColumnBase = new ColumnBase("SpecialId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("SpecialId", specialIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Pizza", blazingPizzaPizzaTableBase); + var blazingPizzaPizzaMappingBase = new TableMappingBase(pizza, blazingPizzaPizzaTableBase, true); + blazingPizzaPizzaTableBase.AddTypeMapping(blazingPizzaPizzaMappingBase, false); + defaultTableMappings3.Add(blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, pizza.FindProperty("Id")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase1, pizza.FindProperty("OrderId")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sizeColumnBase, pizza.FindProperty("Size")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)specialIdColumnBase, pizza.FindProperty("SpecialId")!, blazingPizzaPizzaMappingBase); + + var tableMappings3 = new List(); + pizza.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); + var pizzasTable = new Table("Pizzas", null, relationalModel); + var idColumn0 = new Column("Id", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Id", idColumn0); + var orderIdColumn0 = new Column("OrderId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("OrderId", orderIdColumn0); + var sizeColumn = new Column("Size", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Size", sizeColumn); + var specialIdColumn = new Column("SpecialId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("SpecialId", specialIdColumn); + var pK_Pizzas = new UniqueConstraint("PK_Pizzas", pizzasTable, new[] { idColumn0 }); + pizzasTable.PrimaryKey = pK_Pizzas; + var pK_PizzasUc = RelationalModel.GetKey(this, + "BlazingPizza.Pizza", + new[] { "Id" }); + pK_Pizzas.MappedKeys.Add(pK_PizzasUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzasUc).Add(pK_Pizzas); + pizzasTable.UniqueConstraints.Add("PK_Pizzas", pK_Pizzas); + var iX_Pizzas_OrderId = new TableIndex( + "IX_Pizzas_OrderId", pizzasTable, new[] { orderIdColumn0 }, false); + var iX_Pizzas_OrderIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }); + iX_Pizzas_OrderId.MappedIndexes.Add(iX_Pizzas_OrderIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_OrderIdIx).Add(iX_Pizzas_OrderId); + pizzasTable.Indexes.Add("IX_Pizzas_OrderId", iX_Pizzas_OrderId); + var iX_Pizzas_SpecialId = new TableIndex( + "IX_Pizzas_SpecialId", pizzasTable, new[] { specialIdColumn }, false); + var iX_Pizzas_SpecialIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }); + iX_Pizzas_SpecialId.MappedIndexes.Add(iX_Pizzas_SpecialIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_SpecialIdIx).Add(iX_Pizzas_SpecialId); + pizzasTable.Indexes.Add("IX_Pizzas_SpecialId", iX_Pizzas_SpecialId); + relationalModel.Tables.Add(("Pizzas", null), pizzasTable); + var pizzasTableMapping = new TableMapping(pizza, pizzasTable, true); + pizzasTable.AddTypeMapping(pizzasTableMapping, false); + tableMappings3.Add(pizzasTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, pizza.FindProperty("Id")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(orderIdColumn0, pizza.FindProperty("OrderId")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(sizeColumn, pizza.FindProperty("Size")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(specialIdColumn, pizza.FindProperty("SpecialId")!, pizzasTableMapping); + + var pizzaSpecial = FindEntityType("BlazingPizza.PizzaSpecial")!; + + var defaultTableMappings4 = new List>(); + pizzaSpecial.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); + var blazingPizzaPizzaSpecialTableBase = new TableBase("BlazingPizza.PizzaSpecial", null, relationalModel); + var basePriceColumnBase = new ColumnBase("BasePrice", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("BasePrice", basePriceColumnBase); + var descriptionColumnBase = new ColumnBase("Description", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Description", descriptionColumnBase); + var idColumnBase1 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Id", idColumnBase1); + var imageUrlColumnBase = new ColumnBase("ImageUrl", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("ImageUrl", imageUrlColumnBase); + var nameColumnBase0 = new ColumnBase("Name", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Name", nameColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaSpecial", blazingPizzaPizzaSpecialTableBase); + var blazingPizzaPizzaSpecialMappingBase = new TableMappingBase(pizzaSpecial, blazingPizzaPizzaSpecialTableBase, true); + blazingPizzaPizzaSpecialTableBase.AddTypeMapping(blazingPizzaPizzaSpecialMappingBase, false); + defaultTableMappings4.Add(blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, pizzaSpecial.FindProperty("Id")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)basePriceColumnBase, pizzaSpecial.FindProperty("BasePrice")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase, pizzaSpecial.FindProperty("Description")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)imageUrlColumnBase, pizzaSpecial.FindProperty("ImageUrl")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase0, pizzaSpecial.FindProperty("Name")!, blazingPizzaPizzaSpecialMappingBase); + + var tableMappings4 = new List(); + pizzaSpecial.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); + var specialsTable = new Table("Specials", null, relationalModel); + var idColumn1 = new Column("Id", "INTEGER", specialsTable); + specialsTable.Columns.Add("Id", idColumn1); + var basePriceColumn = new Column("BasePrice", "TEXT", specialsTable); + specialsTable.Columns.Add("BasePrice", basePriceColumn); + var descriptionColumn = new Column("Description", "TEXT", specialsTable); + specialsTable.Columns.Add("Description", descriptionColumn); + var imageUrlColumn = new Column("ImageUrl", "TEXT", specialsTable); + specialsTable.Columns.Add("ImageUrl", imageUrlColumn); + var nameColumn0 = new Column("Name", "TEXT", specialsTable); + specialsTable.Columns.Add("Name", nameColumn0); + var pK_Specials = new UniqueConstraint("PK_Specials", specialsTable, new[] { idColumn1 }); + specialsTable.PrimaryKey = pK_Specials; + var pK_SpecialsUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + pK_Specials.MappedKeys.Add(pK_SpecialsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_SpecialsUc).Add(pK_Specials); + specialsTable.UniqueConstraints.Add("PK_Specials", pK_Specials); + relationalModel.Tables.Add(("Specials", null), specialsTable); + var specialsTableMapping = new TableMapping(pizzaSpecial, specialsTable, true); + specialsTable.AddTypeMapping(specialsTableMapping, false); + tableMappings4.Add(specialsTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, pizzaSpecial.FindProperty("Id")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(basePriceColumn, pizzaSpecial.FindProperty("BasePrice")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn, pizzaSpecial.FindProperty("Description")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(imageUrlColumn, pizzaSpecial.FindProperty("ImageUrl")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn0, pizzaSpecial.FindProperty("Name")!, specialsTableMapping); + + var pizzaTopping = FindEntityType("BlazingPizza.PizzaTopping")!; + + var defaultTableMappings5 = new List>(); + pizzaTopping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings5); + var blazingPizzaPizzaToppingTableBase = new TableBase("BlazingPizza.PizzaTopping", null, relationalModel); + var pizzaIdColumnBase = new ColumnBase("PizzaId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("PizzaId", pizzaIdColumnBase); + var toppingIdColumnBase = new ColumnBase("ToppingId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("ToppingId", toppingIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaTopping", blazingPizzaPizzaToppingTableBase); + var blazingPizzaPizzaToppingMappingBase = new TableMappingBase(pizzaTopping, blazingPizzaPizzaToppingTableBase, true); + blazingPizzaPizzaToppingTableBase.AddTypeMapping(blazingPizzaPizzaToppingMappingBase, false); + defaultTableMappings5.Add(blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pizzaIdColumnBase, pizzaTopping.FindProperty("PizzaId")!, blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)toppingIdColumnBase, pizzaTopping.FindProperty("ToppingId")!, blazingPizzaPizzaToppingMappingBase); + + var tableMappings5 = new List(); + pizzaTopping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); + var pizzaToppingTable = new Table("PizzaTopping", null, relationalModel); + var pizzaIdColumn = new Column("PizzaId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("PizzaId", pizzaIdColumn); + var toppingIdColumn = new Column("ToppingId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("ToppingId", toppingIdColumn); + var pK_PizzaTopping = new UniqueConstraint("PK_PizzaTopping", pizzaToppingTable, new[] { pizzaIdColumn, toppingIdColumn }); + pizzaToppingTable.PrimaryKey = pK_PizzaTopping; + var pK_PizzaToppingUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId", "ToppingId" }); + pK_PizzaTopping.MappedKeys.Add(pK_PizzaToppingUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzaToppingUc).Add(pK_PizzaTopping); + pizzaToppingTable.UniqueConstraints.Add("PK_PizzaTopping", pK_PizzaTopping); + var iX_PizzaTopping_ToppingId = new TableIndex( + "IX_PizzaTopping_ToppingId", pizzaToppingTable, new[] { toppingIdColumn }, false); + var iX_PizzaTopping_ToppingIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }); + iX_PizzaTopping_ToppingId.MappedIndexes.Add(iX_PizzaTopping_ToppingIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PizzaTopping_ToppingIdIx).Add(iX_PizzaTopping_ToppingId); + pizzaToppingTable.Indexes.Add("IX_PizzaTopping_ToppingId", iX_PizzaTopping_ToppingId); + relationalModel.Tables.Add(("PizzaTopping", null), pizzaToppingTable); + var pizzaToppingTableMapping = new TableMapping(pizzaTopping, pizzaToppingTable, true); + pizzaToppingTable.AddTypeMapping(pizzaToppingTableMapping, false); + tableMappings5.Add(pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(pizzaIdColumn, pizzaTopping.FindProperty("PizzaId")!, pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(toppingIdColumn, pizzaTopping.FindProperty("ToppingId")!, pizzaToppingTableMapping); + + var pizzaStoreUser = FindEntityType("BlazingPizza.Server.PizzaStoreUser")!; + + var defaultTableMappings6 = new List>(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings6); + var blazingPizzaServerPizzaStoreUserTableBase = new TableBase("BlazingPizza.Server.PizzaStoreUser", null, relationalModel); + var accessFailedCountColumnBase = new ColumnBase("AccessFailedCount", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("AccessFailedCount", accessFailedCountColumnBase); + var concurrencyStampColumnBase = new ColumnBase("ConcurrencyStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase); + var emailColumnBase = new ColumnBase("Email", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Email", emailColumnBase); + var emailConfirmedColumnBase = new ColumnBase("EmailConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("EmailConfirmed", emailConfirmedColumnBase); + var idColumnBase2 = new ColumnBase("Id", "TEXT", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Id", idColumnBase2); + var lockoutEnabledColumnBase = new ColumnBase("LockoutEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnabled", lockoutEnabledColumnBase); + var lockoutEndColumnBase = new ColumnBase("LockoutEnd", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnd", lockoutEndColumnBase); + var normalizedEmailColumnBase = new ColumnBase("NormalizedEmail", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedEmail", normalizedEmailColumnBase); + var normalizedUserNameColumnBase = new ColumnBase("NormalizedUserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedUserName", normalizedUserNameColumnBase); + var passwordHashColumnBase = new ColumnBase("PasswordHash", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PasswordHash", passwordHashColumnBase); + var phoneNumberColumnBase = new ColumnBase("PhoneNumber", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumber", phoneNumberColumnBase); + var phoneNumberConfirmedColumnBase = new ColumnBase("PhoneNumberConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumnBase); + var securityStampColumnBase = new ColumnBase("SecurityStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("SecurityStamp", securityStampColumnBase); + var twoFactorEnabledColumnBase = new ColumnBase("TwoFactorEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumnBase); + var userNameColumnBase = new ColumnBase("UserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("UserName", userNameColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Server.PizzaStoreUser", blazingPizzaServerPizzaStoreUserTableBase); + var blazingPizzaServerPizzaStoreUserMappingBase = new TableMappingBase(pizzaStoreUser, blazingPizzaServerPizzaStoreUserTableBase, true); + blazingPizzaServerPizzaStoreUserTableBase.AddTypeMapping(blazingPizzaServerPizzaStoreUserMappingBase, false); + defaultTableMappings6.Add(blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, pizzaStoreUser.FindProperty("Id")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)accessFailedCountColumnBase, pizzaStoreUser.FindProperty("AccessFailedCount")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailColumnBase, pizzaStoreUser.FindProperty("Email")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailConfirmedColumnBase, pizzaStoreUser.FindProperty("EmailConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEnabledColumnBase, pizzaStoreUser.FindProperty("LockoutEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEndColumnBase, pizzaStoreUser.FindProperty("LockoutEnd")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedEmailColumnBase, pizzaStoreUser.FindProperty("NormalizedEmail")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedUserNameColumnBase, pizzaStoreUser.FindProperty("NormalizedUserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)passwordHashColumnBase, pizzaStoreUser.FindProperty("PasswordHash")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberColumnBase, pizzaStoreUser.FindProperty("PhoneNumber")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberConfirmedColumnBase, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)securityStampColumnBase, pizzaStoreUser.FindProperty("SecurityStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)twoFactorEnabledColumnBase, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userNameColumnBase, pizzaStoreUser.FindProperty("UserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + + var tableMappings6 = new List(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:TableMappings", tableMappings6); + var aspNetUsersTable = new Table("AspNetUsers", null, relationalModel); + var idColumn2 = new Column("Id", "TEXT", aspNetUsersTable); + aspNetUsersTable.Columns.Add("Id", idColumn2); + var accessFailedCountColumn = new Column("AccessFailedCount", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("AccessFailedCount", accessFailedCountColumn); + var concurrencyStampColumn = new Column("ConcurrencyStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn); + var emailColumn = new Column("Email", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("Email", emailColumn); + var emailConfirmedColumn = new Column("EmailConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("EmailConfirmed", emailConfirmedColumn); + var lockoutEnabledColumn = new Column("LockoutEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("LockoutEnabled", lockoutEnabledColumn); + var lockoutEndColumn = new Column("LockoutEnd", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("LockoutEnd", lockoutEndColumn); + var normalizedEmailColumn = new Column("NormalizedEmail", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedEmail", normalizedEmailColumn); + var normalizedUserNameColumn = new Column("NormalizedUserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedUserName", normalizedUserNameColumn); + var passwordHashColumn = new Column("PasswordHash", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PasswordHash", passwordHashColumn); + var phoneNumberColumn = new Column("PhoneNumber", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PhoneNumber", phoneNumberColumn); + var phoneNumberConfirmedColumn = new Column("PhoneNumberConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumn); + var securityStampColumn = new Column("SecurityStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("SecurityStamp", securityStampColumn); + var twoFactorEnabledColumn = new Column("TwoFactorEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumn); + var userNameColumn = new Column("UserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("UserName", userNameColumn); + var pK_AspNetUsers = new UniqueConstraint("PK_AspNetUsers", aspNetUsersTable, new[] { idColumn2 }); + aspNetUsersTable.PrimaryKey = pK_AspNetUsers; + var pK_AspNetUsersUc = RelationalModel.GetKey(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + pK_AspNetUsers.MappedKeys.Add(pK_AspNetUsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUsersUc).Add(pK_AspNetUsers); + aspNetUsersTable.UniqueConstraints.Add("PK_AspNetUsers", pK_AspNetUsers); + var emailIndex = new TableIndex( + "EmailIndex", aspNetUsersTable, new[] { normalizedEmailColumn }, false); + var emailIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedEmail" }); + emailIndex.MappedIndexes.Add(emailIndexIx); + RelationalModel.GetOrCreateTableIndexes(emailIndexIx).Add(emailIndex); + aspNetUsersTable.Indexes.Add("EmailIndex", emailIndex); + var userNameIndex = new TableIndex( + "UserNameIndex", aspNetUsersTable, new[] { normalizedUserNameColumn }, true); + var userNameIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedUserName" }); + userNameIndex.MappedIndexes.Add(userNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(userNameIndexIx).Add(userNameIndex); + aspNetUsersTable.Indexes.Add("UserNameIndex", userNameIndex); + relationalModel.Tables.Add(("AspNetUsers", null), aspNetUsersTable); + var aspNetUsersTableMapping = new TableMapping(pizzaStoreUser, aspNetUsersTable, true); + aspNetUsersTable.AddTypeMapping(aspNetUsersTableMapping, false); + tableMappings6.Add(aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(idColumn2, pizzaStoreUser.FindProperty("Id")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(accessFailedCountColumn, pizzaStoreUser.FindProperty("AccessFailedCount")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailColumn, pizzaStoreUser.FindProperty("Email")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailConfirmedColumn, pizzaStoreUser.FindProperty("EmailConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEnabledColumn, pizzaStoreUser.FindProperty("LockoutEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEndColumn, pizzaStoreUser.FindProperty("LockoutEnd")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedEmailColumn, pizzaStoreUser.FindProperty("NormalizedEmail")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedUserNameColumn, pizzaStoreUser.FindProperty("NormalizedUserName")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(passwordHashColumn, pizzaStoreUser.FindProperty("PasswordHash")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberColumn, pizzaStoreUser.FindProperty("PhoneNumber")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberConfirmedColumn, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(securityStampColumn, pizzaStoreUser.FindProperty("SecurityStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(twoFactorEnabledColumn, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(userNameColumn, pizzaStoreUser.FindProperty("UserName")!, aspNetUsersTableMapping); + + var topping = FindEntityType("BlazingPizza.Topping")!; + + var defaultTableMappings7 = new List>(); + topping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings7); + var blazingPizzaToppingTableBase = new TableBase("BlazingPizza.Topping", null, relationalModel); + var idColumnBase3 = new ColumnBase("Id", "INTEGER", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Id", idColumnBase3); + var nameColumnBase1 = new ColumnBase("Name", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Name", nameColumnBase1); + var priceColumnBase = new ColumnBase("Price", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Price", priceColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Topping", blazingPizzaToppingTableBase); + var blazingPizzaToppingMappingBase = new TableMappingBase(topping, blazingPizzaToppingTableBase, true); + blazingPizzaToppingTableBase.AddTypeMapping(blazingPizzaToppingMappingBase, false); + defaultTableMappings7.Add(blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase3, topping.FindProperty("Id")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase1, topping.FindProperty("Name")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)priceColumnBase, topping.FindProperty("Price")!, blazingPizzaToppingMappingBase); + + var tableMappings7 = new List(); + topping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings7); + var toppingsTable = new Table("Toppings", null, relationalModel); + var idColumn3 = new Column("Id", "INTEGER", toppingsTable); + toppingsTable.Columns.Add("Id", idColumn3); + var nameColumn1 = new Column("Name", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Name", nameColumn1); + var priceColumn = new Column("Price", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Price", priceColumn); + var pK_Toppings = new UniqueConstraint("PK_Toppings", toppingsTable, new[] { idColumn3 }); + toppingsTable.PrimaryKey = pK_Toppings; + var pK_ToppingsUc = RelationalModel.GetKey(this, + "BlazingPizza.Topping", + new[] { "Id" }); + pK_Toppings.MappedKeys.Add(pK_ToppingsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_ToppingsUc).Add(pK_Toppings); + toppingsTable.UniqueConstraints.Add("PK_Toppings", pK_Toppings); + relationalModel.Tables.Add(("Toppings", null), toppingsTable); + var toppingsTableMapping = new TableMapping(topping, toppingsTable, true); + toppingsTable.AddTypeMapping(toppingsTableMapping, false); + tableMappings7.Add(toppingsTableMapping); + RelationalModel.CreateColumnMapping(idColumn3, topping.FindProperty("Id")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn1, topping.FindProperty("Name")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(priceColumn, topping.FindProperty("Price")!, toppingsTableMapping); + + var deviceFlowCodes = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes")!; + + var defaultTableMappings8 = new List>(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings8); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", null, relationalModel); + var clientIdColumnBase = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("ClientId", clientIdColumnBase); + var creationTimeColumnBase = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("CreationTime", creationTimeColumnBase); + var dataColumnBase = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Data", dataColumnBase); + var descriptionColumnBase0 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Description", descriptionColumnBase0); + var deviceCodeColumnBase = new ColumnBase("DeviceCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("DeviceCode", deviceCodeColumnBase); + var expirationColumnBase = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Expiration", expirationColumnBase); + var sessionIdColumnBase = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SessionId", sessionIdColumnBase); + var subjectIdColumnBase = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SubjectId", subjectIdColumnBase); + var userCodeColumnBase = new ColumnBase("UserCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("UserCode", userCodeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase = new TableMappingBase(deviceFlowCodes, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase, false); + defaultTableMappings8.Add(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userCodeColumnBase, deviceFlowCodes.FindProperty("UserCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase, deviceFlowCodes.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase, deviceFlowCodes.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, deviceFlowCodes.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase0, deviceFlowCodes.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deviceCodeColumnBase, deviceFlowCodes.FindProperty("DeviceCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase, deviceFlowCodes.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase, deviceFlowCodes.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase, deviceFlowCodes.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + + var tableMappings8 = new List(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:TableMappings", tableMappings8); + var deviceCodesTable = new Table("DeviceCodes", null, relationalModel); + var userCodeColumn = new Column("UserCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("UserCode", userCodeColumn); + var clientIdColumn = new Column("ClientId", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("ClientId", clientIdColumn); + var creationTimeColumn = new Column("CreationTime", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("CreationTime", creationTimeColumn); + var dataColumn = new Column("Data", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Data", dataColumn); + var descriptionColumn0 = new Column("Description", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("Description", descriptionColumn0); + var deviceCodeColumn = new Column("DeviceCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("DeviceCode", deviceCodeColumn); + var expirationColumn = new Column("Expiration", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Expiration", expirationColumn); + var sessionIdColumn = new Column("SessionId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SessionId", sessionIdColumn); + var subjectIdColumn = new Column("SubjectId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SubjectId", subjectIdColumn); + var pK_DeviceCodes = new UniqueConstraint("PK_DeviceCodes", deviceCodesTable, new[] { userCodeColumn }); + deviceCodesTable.PrimaryKey = pK_DeviceCodes; + var pK_DeviceCodesUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "UserCode" }); + pK_DeviceCodes.MappedKeys.Add(pK_DeviceCodesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_DeviceCodesUc).Add(pK_DeviceCodes); + deviceCodesTable.UniqueConstraints.Add("PK_DeviceCodes", pK_DeviceCodes); + var iX_DeviceCodes_DeviceCode = new TableIndex( + "IX_DeviceCodes_DeviceCode", deviceCodesTable, new[] { deviceCodeColumn }, true); + var iX_DeviceCodes_DeviceCodeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "DeviceCode" }); + iX_DeviceCodes_DeviceCode.MappedIndexes.Add(iX_DeviceCodes_DeviceCodeIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_DeviceCodeIx).Add(iX_DeviceCodes_DeviceCode); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_DeviceCode", iX_DeviceCodes_DeviceCode); + var iX_DeviceCodes_Expiration = new TableIndex( + "IX_DeviceCodes_Expiration", deviceCodesTable, new[] { expirationColumn }, false); + var iX_DeviceCodes_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "Expiration" }); + iX_DeviceCodes_Expiration.MappedIndexes.Add(iX_DeviceCodes_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_ExpirationIx).Add(iX_DeviceCodes_Expiration); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_Expiration", iX_DeviceCodes_Expiration); + relationalModel.Tables.Add(("DeviceCodes", null), deviceCodesTable); + var deviceCodesTableMapping = new TableMapping(deviceFlowCodes, deviceCodesTable, true); + deviceCodesTable.AddTypeMapping(deviceCodesTableMapping, false); + tableMappings8.Add(deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(userCodeColumn, deviceFlowCodes.FindProperty("UserCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn, deviceFlowCodes.FindProperty("ClientId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn, deviceFlowCodes.FindProperty("CreationTime")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, deviceFlowCodes.FindProperty("Data")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn0, deviceFlowCodes.FindProperty("Description")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(deviceCodeColumn, deviceFlowCodes.FindProperty("DeviceCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn, deviceFlowCodes.FindProperty("Expiration")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn, deviceFlowCodes.FindProperty("SessionId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn, deviceFlowCodes.FindProperty("SubjectId")!, deviceCodesTableMapping); + + var key = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.Key")!; + + var defaultTableMappings9 = new List>(); + key.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings9); + var duendeIdentityServerEntityFrameworkEntitiesKeyTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.Key", null, relationalModel); + var algorithmColumnBase = new ColumnBase("Algorithm", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Algorithm", algorithmColumnBase); + var createdColumnBase = new ColumnBase("Created", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Created", createdColumnBase); + var dataColumnBase0 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Data", dataColumnBase0); + var dataProtectedColumnBase = new ColumnBase("DataProtected", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("DataProtected", dataProtectedColumnBase); + var idColumnBase4 = new ColumnBase("Id", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Id", idColumnBase4); + var isX509CertificateColumnBase = new ColumnBase("IsX509Certificate", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("IsX509Certificate", isX509CertificateColumnBase); + var useColumnBase = new ColumnBase("Use", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Use", useColumnBase); + var versionColumnBase = new ColumnBase("Version", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Version", versionColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.Key", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + var duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase = new TableMappingBase(key, duendeIdentityServerEntityFrameworkEntitiesKeyTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase, false); + defaultTableMappings9.Add(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase4, key.FindProperty("Id")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)algorithmColumnBase, key.FindProperty("Algorithm")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdColumnBase, key.FindProperty("Created")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase0, key.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataProtectedColumnBase, key.FindProperty("DataProtected")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)isX509CertificateColumnBase, key.FindProperty("IsX509Certificate")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)useColumnBase, key.FindProperty("Use")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)versionColumnBase, key.FindProperty("Version")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + + var tableMappings9 = new List(); + key.SetRuntimeAnnotation("Relational:TableMappings", tableMappings9); + var keysTable = new Table("Keys", null, relationalModel); + var idColumn4 = new Column("Id", "TEXT", keysTable); + keysTable.Columns.Add("Id", idColumn4); + var algorithmColumn = new Column("Algorithm", "TEXT", keysTable); + keysTable.Columns.Add("Algorithm", algorithmColumn); + var createdColumn = new Column("Created", "TEXT", keysTable); + keysTable.Columns.Add("Created", createdColumn); + var dataColumn0 = new Column("Data", "TEXT", keysTable); + keysTable.Columns.Add("Data", dataColumn0); + var dataProtectedColumn = new Column("DataProtected", "INTEGER", keysTable); + keysTable.Columns.Add("DataProtected", dataProtectedColumn); + var isX509CertificateColumn = new Column("IsX509Certificate", "INTEGER", keysTable); + keysTable.Columns.Add("IsX509Certificate", isX509CertificateColumn); + var useColumn = new Column("Use", "TEXT", keysTable) + { + IsNullable = true + }; + keysTable.Columns.Add("Use", useColumn); + var versionColumn = new Column("Version", "INTEGER", keysTable); + keysTable.Columns.Add("Version", versionColumn); + var pK_Keys = new UniqueConstraint("PK_Keys", keysTable, new[] { idColumn4 }); + keysTable.PrimaryKey = pK_Keys; + var pK_KeysUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Id" }); + pK_Keys.MappedKeys.Add(pK_KeysUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_KeysUc).Add(pK_Keys); + keysTable.UniqueConstraints.Add("PK_Keys", pK_Keys); + var iX_Keys_Use = new TableIndex( + "IX_Keys_Use", keysTable, new[] { useColumn }, false); + var iX_Keys_UseIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Use" }); + iX_Keys_Use.MappedIndexes.Add(iX_Keys_UseIx); + RelationalModel.GetOrCreateTableIndexes(iX_Keys_UseIx).Add(iX_Keys_Use); + keysTable.Indexes.Add("IX_Keys_Use", iX_Keys_Use); + relationalModel.Tables.Add(("Keys", null), keysTable); + var keysTableMapping = new TableMapping(key, keysTable, true); + keysTable.AddTypeMapping(keysTableMapping, false); + tableMappings9.Add(keysTableMapping); + RelationalModel.CreateColumnMapping(idColumn4, key.FindProperty("Id")!, keysTableMapping); + RelationalModel.CreateColumnMapping(algorithmColumn, key.FindProperty("Algorithm")!, keysTableMapping); + RelationalModel.CreateColumnMapping(createdColumn, key.FindProperty("Created")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataColumn0, key.FindProperty("Data")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataProtectedColumn, key.FindProperty("DataProtected")!, keysTableMapping); + RelationalModel.CreateColumnMapping(isX509CertificateColumn, key.FindProperty("IsX509Certificate")!, keysTableMapping); + RelationalModel.CreateColumnMapping(useColumn, key.FindProperty("Use")!, keysTableMapping); + RelationalModel.CreateColumnMapping(versionColumn, key.FindProperty("Version")!, keysTableMapping); + + var persistedGrant = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant")!; + + var defaultTableMappings10 = new List>(); + persistedGrant.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings10); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", null, relationalModel); + var clientIdColumnBase0 = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ClientId", clientIdColumnBase0); + var consumedTimeColumnBase = new ColumnBase("ConsumedTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ConsumedTime", consumedTimeColumnBase); + var creationTimeColumnBase0 = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("CreationTime", creationTimeColumnBase0); + var dataColumnBase1 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Data", dataColumnBase1); + var descriptionColumnBase1 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Description", descriptionColumnBase1); + var expirationColumnBase0 = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Expiration", expirationColumnBase0); + var keyColumnBase = new ColumnBase("Key", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Key", keyColumnBase); + var sessionIdColumnBase0 = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SessionId", sessionIdColumnBase0); + var subjectIdColumnBase0 = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SubjectId", subjectIdColumnBase0); + var typeColumnBase = new ColumnBase("Type", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Type", typeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase = new TableMappingBase(persistedGrant, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase, false); + defaultTableMappings10.Add(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)keyColumnBase, persistedGrant.FindProperty("Key")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase0, persistedGrant.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)consumedTimeColumnBase, persistedGrant.FindProperty("ConsumedTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase0, persistedGrant.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase1, persistedGrant.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase1, persistedGrant.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase0, persistedGrant.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase0, persistedGrant.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase0, persistedGrant.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)typeColumnBase, persistedGrant.FindProperty("Type")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + + var tableMappings10 = new List(); + persistedGrant.SetRuntimeAnnotation("Relational:TableMappings", tableMappings10); + var persistedGrantsTable = new Table("PersistedGrants", null, relationalModel); + var keyColumn = new Column("Key", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Key", keyColumn); + var clientIdColumn0 = new Column("ClientId", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("ClientId", clientIdColumn0); + var consumedTimeColumn = new Column("ConsumedTime", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("ConsumedTime", consumedTimeColumn); + var creationTimeColumn0 = new Column("CreationTime", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("CreationTime", creationTimeColumn0); + var dataColumn1 = new Column("Data", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Data", dataColumn1); + var descriptionColumn1 = new Column("Description", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Description", descriptionColumn1); + var expirationColumn0 = new Column("Expiration", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Expiration", expirationColumn0); + var sessionIdColumn0 = new Column("SessionId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SessionId", sessionIdColumn0); + var subjectIdColumn0 = new Column("SubjectId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SubjectId", subjectIdColumn0); + var typeColumn = new Column("Type", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Type", typeColumn); + var pK_PersistedGrants = new UniqueConstraint("PK_PersistedGrants", persistedGrantsTable, new[] { keyColumn }); + persistedGrantsTable.PrimaryKey = pK_PersistedGrants; + var pK_PersistedGrantsUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Key" }); + pK_PersistedGrants.MappedKeys.Add(pK_PersistedGrantsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PersistedGrantsUc).Add(pK_PersistedGrants); + persistedGrantsTable.UniqueConstraints.Add("PK_PersistedGrants", pK_PersistedGrants); + var iX_PersistedGrants_ConsumedTime = new TableIndex( + "IX_PersistedGrants_ConsumedTime", persistedGrantsTable, new[] { consumedTimeColumn }, false); + var iX_PersistedGrants_ConsumedTimeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "ConsumedTime" }); + iX_PersistedGrants_ConsumedTime.MappedIndexes.Add(iX_PersistedGrants_ConsumedTimeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ConsumedTimeIx).Add(iX_PersistedGrants_ConsumedTime); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_ConsumedTime", iX_PersistedGrants_ConsumedTime); + var iX_PersistedGrants_Expiration = new TableIndex( + "IX_PersistedGrants_Expiration", persistedGrantsTable, new[] { expirationColumn0 }, false); + var iX_PersistedGrants_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Expiration" }); + iX_PersistedGrants_Expiration.MappedIndexes.Add(iX_PersistedGrants_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ExpirationIx).Add(iX_PersistedGrants_Expiration); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_Expiration", iX_PersistedGrants_Expiration); + var iX_PersistedGrants_SubjectId_ClientId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_ClientId_Type", persistedGrantsTable, new[] { subjectIdColumn0, clientIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_ClientId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "ClientId", "Type" }); + iX_PersistedGrants_SubjectId_ClientId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_ClientId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_ClientId_TypeIx).Add(iX_PersistedGrants_SubjectId_ClientId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_ClientId_Type", iX_PersistedGrants_SubjectId_ClientId_Type); + var iX_PersistedGrants_SubjectId_SessionId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_SessionId_Type", persistedGrantsTable, new[] { subjectIdColumn0, sessionIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_SessionId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "SessionId", "Type" }); + iX_PersistedGrants_SubjectId_SessionId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_SessionId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_SessionId_TypeIx).Add(iX_PersistedGrants_SubjectId_SessionId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_SessionId_Type", iX_PersistedGrants_SubjectId_SessionId_Type); + relationalModel.Tables.Add(("PersistedGrants", null), persistedGrantsTable); + var persistedGrantsTableMapping = new TableMapping(persistedGrant, persistedGrantsTable, true); + persistedGrantsTable.AddTypeMapping(persistedGrantsTableMapping, false); + tableMappings10.Add(persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(keyColumn, persistedGrant.FindProperty("Key")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn0, persistedGrant.FindProperty("ClientId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(consumedTimeColumn, persistedGrant.FindProperty("ConsumedTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn0, persistedGrant.FindProperty("CreationTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(dataColumn1, persistedGrant.FindProperty("Data")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn1, persistedGrant.FindProperty("Description")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn0, persistedGrant.FindProperty("Expiration")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn0, persistedGrant.FindProperty("SessionId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn0, persistedGrant.FindProperty("SubjectId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(typeColumn, persistedGrant.FindProperty("Type")!, persistedGrantsTableMapping); + + var identityRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRole")!; + + var defaultTableMappings11 = new List>(); + identityRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings11); + var microsoftAspNetCoreIdentityIdentityRoleTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRole", null, relationalModel); + var concurrencyStampColumnBase0 = new ColumnBase("ConcurrencyStamp", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase0); + var idColumnBase5 = new ColumnBase("Id", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase); + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Id", idColumnBase5); + var nameColumnBase2 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Name", nameColumnBase2); + var normalizedNameColumnBase = new ColumnBase("NormalizedName", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("NormalizedName", normalizedNameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRole", microsoftAspNetCoreIdentityIdentityRoleTableBase); + var microsoftAspNetCoreIdentityIdentityRoleMappingBase = new TableMappingBase(identityRole, microsoftAspNetCoreIdentityIdentityRoleTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleMappingBase, false); + defaultTableMappings11.Add(microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase5, identityRole.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase0, identityRole.FindProperty("ConcurrencyStamp")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase2, identityRole.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedNameColumnBase, identityRole.FindProperty("NormalizedName")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + + var tableMappings11 = new List(); + identityRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings11); + var aspNetRolesTable = new Table("AspNetRoles", null, relationalModel); + var idColumn5 = new Column("Id", "TEXT", aspNetRolesTable); + aspNetRolesTable.Columns.Add("Id", idColumn5); + var concurrencyStampColumn0 = new Column("ConcurrencyStamp", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn0); + var nameColumn2 = new Column("Name", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("Name", nameColumn2); + var normalizedNameColumn = new Column("NormalizedName", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("NormalizedName", normalizedNameColumn); + var pK_AspNetRoles = new UniqueConstraint("PK_AspNetRoles", aspNetRolesTable, new[] { idColumn5 }); + aspNetRolesTable.PrimaryKey = pK_AspNetRoles; + var pK_AspNetRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + pK_AspNetRoles.MappedKeys.Add(pK_AspNetRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRolesUc).Add(pK_AspNetRoles); + aspNetRolesTable.UniqueConstraints.Add("PK_AspNetRoles", pK_AspNetRoles); + var roleNameIndex = new TableIndex( + "RoleNameIndex", aspNetRolesTable, new[] { normalizedNameColumn }, true); + var roleNameIndexIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "NormalizedName" }); + roleNameIndex.MappedIndexes.Add(roleNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(roleNameIndexIx).Add(roleNameIndex); + aspNetRolesTable.Indexes.Add("RoleNameIndex", roleNameIndex); + relationalModel.Tables.Add(("AspNetRoles", null), aspNetRolesTable); + var aspNetRolesTableMapping = new TableMapping(identityRole, aspNetRolesTable, true); + aspNetRolesTable.AddTypeMapping(aspNetRolesTableMapping, false); + tableMappings11.Add(aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(idColumn5, identityRole.FindProperty("Id")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn0, identityRole.FindProperty("ConcurrencyStamp")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(nameColumn2, identityRole.FindProperty("Name")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(normalizedNameColumn, identityRole.FindProperty("NormalizedName")!, aspNetRolesTableMapping); + + var identityRoleClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRoleClaim")!; + + var defaultTableMappings12 = new List>(); + identityRoleClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings12); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRoleClaim", null, relationalModel); + var claimTypeColumnBase = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase); + var claimValueColumnBase = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase); + var idColumnBase6 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("Id", idColumnBase6); + var roleIdColumnBase = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("RoleId", roleIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRoleClaim", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase = new TableMappingBase(identityRoleClaim, microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase, false); + defaultTableMappings12.Add(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase6, identityRoleClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase, identityRoleClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase, identityRoleClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase, identityRoleClaim.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + + var tableMappings12 = new List(); + identityRoleClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings12); + var aspNetRoleClaimsTable = new Table("AspNetRoleClaims", null, relationalModel); + var idColumn6 = new Column("Id", "INTEGER", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("Id", idColumn6); + var claimTypeColumn = new Column("ClaimType", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimType", claimTypeColumn); + var claimValueColumn = new Column("ClaimValue", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimValue", claimValueColumn); + var roleIdColumn = new Column("RoleId", "TEXT", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("RoleId", roleIdColumn); + var pK_AspNetRoleClaims = new UniqueConstraint("PK_AspNetRoleClaims", aspNetRoleClaimsTable, new[] { idColumn6 }); + aspNetRoleClaimsTable.PrimaryKey = pK_AspNetRoleClaims; + var pK_AspNetRoleClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "Id" }); + pK_AspNetRoleClaims.MappedKeys.Add(pK_AspNetRoleClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRoleClaimsUc).Add(pK_AspNetRoleClaims); + aspNetRoleClaimsTable.UniqueConstraints.Add("PK_AspNetRoleClaims", pK_AspNetRoleClaims); + var iX_AspNetRoleClaims_RoleId = new TableIndex( + "IX_AspNetRoleClaims_RoleId", aspNetRoleClaimsTable, new[] { roleIdColumn }, false); + var iX_AspNetRoleClaims_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }); + iX_AspNetRoleClaims_RoleId.MappedIndexes.Add(iX_AspNetRoleClaims_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetRoleClaims_RoleIdIx).Add(iX_AspNetRoleClaims_RoleId); + aspNetRoleClaimsTable.Indexes.Add("IX_AspNetRoleClaims_RoleId", iX_AspNetRoleClaims_RoleId); + relationalModel.Tables.Add(("AspNetRoleClaims", null), aspNetRoleClaimsTable); + var aspNetRoleClaimsTableMapping = new TableMapping(identityRoleClaim, aspNetRoleClaimsTable, true); + aspNetRoleClaimsTable.AddTypeMapping(aspNetRoleClaimsTableMapping, false); + tableMappings12.Add(aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn6, identityRoleClaim.FindProperty("Id")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn, identityRoleClaim.FindProperty("ClaimType")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn, identityRoleClaim.FindProperty("ClaimValue")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn, identityRoleClaim.FindProperty("RoleId")!, aspNetRoleClaimsTableMapping); + + var identityUserClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserClaim")!; + + var defaultTableMappings13 = new List>(); + identityUserClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings13); + var microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserClaim", null, relationalModel); + var claimTypeColumnBase0 = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase0); + var claimValueColumnBase0 = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase0); + var idColumnBase7 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("Id", idColumnBase7); + var userIdColumnBase1 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("UserId", userIdColumnBase1); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserClaim", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase = new TableMappingBase(identityUserClaim, microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase, false); + defaultTableMappings13.Add(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase7, identityUserClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase0, identityUserClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase0, identityUserClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase1, identityUserClaim.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + + var tableMappings13 = new List(); + identityUserClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings13); + var aspNetUserClaimsTable = new Table("AspNetUserClaims", null, relationalModel); + var idColumn7 = new Column("Id", "INTEGER", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("Id", idColumn7); + var claimTypeColumn0 = new Column("ClaimType", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimType", claimTypeColumn0); + var claimValueColumn0 = new Column("ClaimValue", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimValue", claimValueColumn0); + var userIdColumn1 = new Column("UserId", "TEXT", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("UserId", userIdColumn1); + var pK_AspNetUserClaims = new UniqueConstraint("PK_AspNetUserClaims", aspNetUserClaimsTable, new[] { idColumn7 }); + aspNetUserClaimsTable.PrimaryKey = pK_AspNetUserClaims; + var pK_AspNetUserClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "Id" }); + pK_AspNetUserClaims.MappedKeys.Add(pK_AspNetUserClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserClaimsUc).Add(pK_AspNetUserClaims); + aspNetUserClaimsTable.UniqueConstraints.Add("PK_AspNetUserClaims", pK_AspNetUserClaims); + var iX_AspNetUserClaims_UserId = new TableIndex( + "IX_AspNetUserClaims_UserId", aspNetUserClaimsTable, new[] { userIdColumn1 }, false); + var iX_AspNetUserClaims_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }); + iX_AspNetUserClaims_UserId.MappedIndexes.Add(iX_AspNetUserClaims_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserClaims_UserIdIx).Add(iX_AspNetUserClaims_UserId); + aspNetUserClaimsTable.Indexes.Add("IX_AspNetUserClaims_UserId", iX_AspNetUserClaims_UserId); + relationalModel.Tables.Add(("AspNetUserClaims", null), aspNetUserClaimsTable); + var aspNetUserClaimsTableMapping = new TableMapping(identityUserClaim, aspNetUserClaimsTable, true); + aspNetUserClaimsTable.AddTypeMapping(aspNetUserClaimsTableMapping, false); + tableMappings13.Add(aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn7, identityUserClaim.FindProperty("Id")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn0, identityUserClaim.FindProperty("ClaimType")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn0, identityUserClaim.FindProperty("ClaimValue")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn1, identityUserClaim.FindProperty("UserId")!, aspNetUserClaimsTableMapping); + + var identityUserLogin = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserLogin")!; + + var defaultTableMappings14 = new List>(); + identityUserLogin.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings14); + var microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserLogin", null, relationalModel); + var loginProviderColumnBase = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase); + var providerDisplayNameColumnBase = new ColumnBase("ProviderDisplayName", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderDisplayName", providerDisplayNameColumnBase); + var providerKeyColumnBase = new ColumnBase("ProviderKey", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderKey", providerKeyColumnBase); + var userIdColumnBase2 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("UserId", userIdColumnBase2); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserLogin", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase = new TableMappingBase(identityUserLogin, microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase, false); + defaultTableMappings14.Add(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase, identityUserLogin.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerKeyColumnBase, identityUserLogin.FindProperty("ProviderKey")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerDisplayNameColumnBase, identityUserLogin.FindProperty("ProviderDisplayName")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase2, identityUserLogin.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + + var tableMappings14 = new List(); + identityUserLogin.SetRuntimeAnnotation("Relational:TableMappings", tableMappings14); + var aspNetUserLoginsTable = new Table("AspNetUserLogins", null, relationalModel); + var loginProviderColumn = new Column("LoginProvider", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("LoginProvider", loginProviderColumn); + var providerKeyColumn = new Column("ProviderKey", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("ProviderKey", providerKeyColumn); + var providerDisplayNameColumn = new Column("ProviderDisplayName", "TEXT", aspNetUserLoginsTable) + { + IsNullable = true + }; + aspNetUserLoginsTable.Columns.Add("ProviderDisplayName", providerDisplayNameColumn); + var userIdColumn2 = new Column("UserId", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("UserId", userIdColumn2); + var pK_AspNetUserLogins = new UniqueConstraint("PK_AspNetUserLogins", aspNetUserLoginsTable, new[] { loginProviderColumn, providerKeyColumn }); + aspNetUserLoginsTable.PrimaryKey = pK_AspNetUserLogins; + var pK_AspNetUserLoginsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "LoginProvider", "ProviderKey" }); + pK_AspNetUserLogins.MappedKeys.Add(pK_AspNetUserLoginsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserLoginsUc).Add(pK_AspNetUserLogins); + aspNetUserLoginsTable.UniqueConstraints.Add("PK_AspNetUserLogins", pK_AspNetUserLogins); + var iX_AspNetUserLogins_UserId = new TableIndex( + "IX_AspNetUserLogins_UserId", aspNetUserLoginsTable, new[] { userIdColumn2 }, false); + var iX_AspNetUserLogins_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }); + iX_AspNetUserLogins_UserId.MappedIndexes.Add(iX_AspNetUserLogins_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserLogins_UserIdIx).Add(iX_AspNetUserLogins_UserId); + aspNetUserLoginsTable.Indexes.Add("IX_AspNetUserLogins_UserId", iX_AspNetUserLogins_UserId); + relationalModel.Tables.Add(("AspNetUserLogins", null), aspNetUserLoginsTable); + var aspNetUserLoginsTableMapping = new TableMapping(identityUserLogin, aspNetUserLoginsTable, true); + aspNetUserLoginsTable.AddTypeMapping(aspNetUserLoginsTableMapping, false); + tableMappings14.Add(aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn, identityUserLogin.FindProperty("LoginProvider")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerKeyColumn, identityUserLogin.FindProperty("ProviderKey")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerDisplayNameColumn, identityUserLogin.FindProperty("ProviderDisplayName")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn2, identityUserLogin.FindProperty("UserId")!, aspNetUserLoginsTableMapping); + + var identityUserRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserRole")!; + + var defaultTableMappings15 = new List>(); + identityUserRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings15); + var microsoftAspNetCoreIdentityIdentityUserRolestringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserRole", null, relationalModel); + var roleIdColumnBase0 = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("RoleId", roleIdColumnBase0); + var userIdColumnBase3 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("UserId", userIdColumnBase3); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserRole", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + var microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase = new TableMappingBase(identityUserRole, microsoftAspNetCoreIdentityIdentityUserRolestringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase, false); + defaultTableMappings15.Add(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase0, identityUserRole.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase3, identityUserRole.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + + var tableMappings15 = new List(); + identityUserRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings15); + var aspNetUserRolesTable = new Table("AspNetUserRoles", null, relationalModel); + var userIdColumn3 = new Column("UserId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("UserId", userIdColumn3); + var roleIdColumn0 = new Column("RoleId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("RoleId", roleIdColumn0); + var pK_AspNetUserRoles = new UniqueConstraint("PK_AspNetUserRoles", aspNetUserRolesTable, new[] { userIdColumn3, roleIdColumn0 }); + aspNetUserRolesTable.PrimaryKey = pK_AspNetUserRoles; + var pK_AspNetUserRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId", "RoleId" }); + pK_AspNetUserRoles.MappedKeys.Add(pK_AspNetUserRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserRolesUc).Add(pK_AspNetUserRoles); + aspNetUserRolesTable.UniqueConstraints.Add("PK_AspNetUserRoles", pK_AspNetUserRoles); + var iX_AspNetUserRoles_RoleId = new TableIndex( + "IX_AspNetUserRoles_RoleId", aspNetUserRolesTable, new[] { roleIdColumn0 }, false); + var iX_AspNetUserRoles_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }); + iX_AspNetUserRoles_RoleId.MappedIndexes.Add(iX_AspNetUserRoles_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserRoles_RoleIdIx).Add(iX_AspNetUserRoles_RoleId); + aspNetUserRolesTable.Indexes.Add("IX_AspNetUserRoles_RoleId", iX_AspNetUserRoles_RoleId); + relationalModel.Tables.Add(("AspNetUserRoles", null), aspNetUserRolesTable); + var aspNetUserRolesTableMapping = new TableMapping(identityUserRole, aspNetUserRolesTable, true); + aspNetUserRolesTable.AddTypeMapping(aspNetUserRolesTableMapping, false); + tableMappings15.Add(aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn0, identityUserRole.FindProperty("RoleId")!, aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn3, identityUserRole.FindProperty("UserId")!, aspNetUserRolesTableMapping); + + var identityUserToken = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserToken")!; + + var defaultTableMappings16 = new List>(); + identityUserToken.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings16); + var microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserToken", null, relationalModel); + var loginProviderColumnBase0 = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase0); + var nameColumnBase3 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Name", nameColumnBase3); + var userIdColumnBase4 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("UserId", userIdColumnBase4); + var valueColumnBase = new ColumnBase("Value", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Value", valueColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserToken", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase = new TableMappingBase(identityUserToken, microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase, false); + defaultTableMappings16.Add(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase0, identityUserToken.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase3, identityUserToken.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase4, identityUserToken.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueColumnBase, identityUserToken.FindProperty("Value")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + + var tableMappings16 = new List(); + identityUserToken.SetRuntimeAnnotation("Relational:TableMappings", tableMappings16); + var aspNetUserTokensTable = new Table("AspNetUserTokens", null, relationalModel); + var userIdColumn4 = new Column("UserId", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("UserId", userIdColumn4); + var loginProviderColumn0 = new Column("LoginProvider", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("LoginProvider", loginProviderColumn0); + var nameColumn3 = new Column("Name", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("Name", nameColumn3); + var valueColumn = new Column("Value", "TEXT", aspNetUserTokensTable) + { + IsNullable = true + }; + aspNetUserTokensTable.Columns.Add("Value", valueColumn); + var pK_AspNetUserTokens = new UniqueConstraint("PK_AspNetUserTokens", aspNetUserTokensTable, new[] { userIdColumn4, loginProviderColumn0, nameColumn3 }); + aspNetUserTokensTable.PrimaryKey = pK_AspNetUserTokens; + var pK_AspNetUserTokensUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId", "LoginProvider", "Name" }); + pK_AspNetUserTokens.MappedKeys.Add(pK_AspNetUserTokensUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserTokensUc).Add(pK_AspNetUserTokens); + aspNetUserTokensTable.UniqueConstraints.Add("PK_AspNetUserTokens", pK_AspNetUserTokens); + relationalModel.Tables.Add(("AspNetUserTokens", null), aspNetUserTokensTable); + var aspNetUserTokensTableMapping = new TableMapping(identityUserToken, aspNetUserTokensTable, true); + aspNetUserTokensTable.AddTypeMapping(aspNetUserTokensTableMapping, false); + tableMappings16.Add(aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn0, identityUserToken.FindProperty("LoginProvider")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(nameColumn3, identityUserToken.FindProperty("Name")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn4, identityUserToken.FindProperty("UserId")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(valueColumn, identityUserToken.FindProperty("Value")!, aspNetUserTokensTableMapping); + var fK_AspNetRoleClaims_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetRoleClaims_AspNetRoles_RoleId", aspNetRoleClaimsTable, aspNetRolesTable, + new[] { roleIdColumn }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetRoleClaims_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetRoleClaims_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk).Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRoleClaimsTable.ForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + var fK_AspNetUserClaims_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserClaims_AspNetUsers_UserId", aspNetUserClaimsTable, aspNetUsersTable, + new[] { userIdColumn1 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserClaims_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserClaims_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserClaims_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserClaims_AspNetUsers_UserIdFk).Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUserClaimsTable.ForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + var fK_AspNetUserLogins_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserLogins_AspNetUsers_UserId", aspNetUserLoginsTable, aspNetUsersTable, + new[] { userIdColumn2 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserLogins_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserLogins_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserLogins_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserLogins_AspNetUsers_UserIdFk).Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUserLoginsTable.ForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + var fK_AspNetUserRoles_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetRoles_RoleId", aspNetUserRolesTable, aspNetRolesTable, + new[] { roleIdColumn0 }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetRoles_RoleIdFk).Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + var fK_AspNetUserRoles_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetUsers_UserId", aspNetUserRolesTable, aspNetUsersTable, + new[] { userIdColumn3 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetUsers_UserIdFk).Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + var fK_AspNetUserTokens_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserTokens_AspNetUsers_UserId", aspNetUserTokensTable, aspNetUsersTable, + new[] { userIdColumn4 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserTokens_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserTokens_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserTokens_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserTokens_AspNetUsers_UserIdFk).Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUserTokensTable.ForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + var fK_Orders_Address_DeliveryAddressId = new ForeignKeyConstraint( + "FK_Orders_Address_DeliveryAddressId", ordersTable, addressTable, + new[] { deliveryAddressIdColumn }, + addressTable.FindUniqueConstraint("PK_Address")!, ReferentialAction.Cascade); + var fK_Orders_Address_DeliveryAddressIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }, + "BlazingPizza.Address", + new[] { "Id" }); + fK_Orders_Address_DeliveryAddressId.MappedForeignKeys.Add(fK_Orders_Address_DeliveryAddressIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Orders_Address_DeliveryAddressIdFk).Add(fK_Orders_Address_DeliveryAddressId); + ordersTable.ForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + addressTable.ReferencingForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + var fK_Pizzas_Orders_OrderId = new ForeignKeyConstraint( + "FK_Pizzas_Orders_OrderId", pizzasTable, ordersTable, + new[] { orderIdColumn0 }, + ordersTable.FindUniqueConstraint("PK_Orders")!, ReferentialAction.Cascade); + var fK_Pizzas_Orders_OrderIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" }); + fK_Pizzas_Orders_OrderId.MappedForeignKeys.Add(fK_Pizzas_Orders_OrderIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Orders_OrderIdFk).Add(fK_Pizzas_Orders_OrderId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + ordersTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + var fK_Pizzas_Specials_SpecialId = new ForeignKeyConstraint( + "FK_Pizzas_Specials_SpecialId", pizzasTable, specialsTable, + new[] { specialIdColumn }, + specialsTable.FindUniqueConstraint("PK_Specials")!, ReferentialAction.Cascade); + var fK_Pizzas_Specials_SpecialIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + fK_Pizzas_Specials_SpecialId.MappedForeignKeys.Add(fK_Pizzas_Specials_SpecialIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Specials_SpecialIdFk).Add(fK_Pizzas_Specials_SpecialId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + specialsTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + var fK_PizzaTopping_Pizzas_PizzaId = new ForeignKeyConstraint( + "FK_PizzaTopping_Pizzas_PizzaId", pizzaToppingTable, pizzasTable, + new[] { pizzaIdColumn }, + pizzasTable.FindUniqueConstraint("PK_Pizzas")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Pizzas_PizzaIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId" }, + "BlazingPizza.Pizza", + new[] { "Id" }); + fK_PizzaTopping_Pizzas_PizzaId.MappedForeignKeys.Add(fK_PizzaTopping_Pizzas_PizzaIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Pizzas_PizzaIdFk).Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzasTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + var fK_PizzaTopping_Toppings_ToppingId = new ForeignKeyConstraint( + "FK_PizzaTopping_Toppings_ToppingId", pizzaToppingTable, toppingsTable, + new[] { toppingIdColumn }, + toppingsTable.FindUniqueConstraint("PK_Toppings")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Toppings_ToppingIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }, + "BlazingPizza.Topping", + new[] { "Id" }); + fK_PizzaTopping_Toppings_ToppingId.MappedForeignKeys.Add(fK_PizzaTopping_Toppings_ToppingIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Toppings_ToppingIdFk).Add(fK_PizzaTopping_Toppings_ToppingId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + toppingsTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs similarity index 63% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs index 18b2d96d..7295425c 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs @@ -2,12 +2,15 @@ using System; using System.Reflection; using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaStoreUserEntityType { @@ -24,12 +27,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var accessFailedCount = runtimeEntityType.AddProperty( "AccessFailedCount", typeof(int), propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + accessFailedCount.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var concurrencyStamp = runtimeEntityType.AddProperty( "ConcurrencyStamp", @@ -38,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; var email = runtimeEntityType.AddProperty( "Email", @@ -46,18 +67,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + email.TypeMapping = SqliteStringTypeMapping.Default; var emailConfirmed = runtimeEntityType.AddProperty( "EmailConfirmed", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + emailConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var lockoutEnabled = runtimeEntityType.AddProperty( "LockoutEnabled", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + lockoutEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var lockoutEnd = runtimeEntityType.AddProperty( "LockoutEnd", @@ -65,6 +119,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + lockoutEnd.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default; var normalizedEmail = runtimeEntityType.AddProperty( "NormalizedEmail", @@ -73,6 +128,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedEmail.TypeMapping = SqliteStringTypeMapping.Default; var normalizedUserName = runtimeEntityType.AddProperty( "NormalizedUserName", @@ -81,6 +137,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedUserName.TypeMapping = SqliteStringTypeMapping.Default; var passwordHash = runtimeEntityType.AddProperty( "PasswordHash", @@ -88,6 +145,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + passwordHash.TypeMapping = SqliteStringTypeMapping.Default; var phoneNumber = runtimeEntityType.AddProperty( "PhoneNumber", @@ -95,12 +153,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + phoneNumber.TypeMapping = SqliteStringTypeMapping.Default; var phoneNumberConfirmed = runtimeEntityType.AddProperty( "PhoneNumberConfirmed", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + phoneNumberConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var securityStamp = runtimeEntityType.AddProperty( "SecurityStamp", @@ -108,12 +183,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + securityStamp.TypeMapping = SqliteStringTypeMapping.Default; var twoFactorEnabled = runtimeEntityType.AddProperty( "TwoFactorEnabled", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + twoFactorEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var userName = runtimeEntityType.AddProperty( "UserName", @@ -122,6 +214,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + userName.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaToppingEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs similarity index 72% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaToppingEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs index b97d2a24..803ab153 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/PizzaToppingEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaToppingEntityType { @@ -24,14 +26,46 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int), propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + pizzaId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var toppingId = runtimeEntityType.AddProperty( "ToppingId", typeof(int), propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + toppingId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { pizzaId, toppingId }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/ToppingEntityType.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs similarity index 68% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/ToppingEntityType.cs rename to save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs index 9295f9bf..d3a19507 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/ToppingEntityType.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class ToppingEntityType { @@ -23,20 +26,38 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var name = runtimeEntityType.AddProperty( "Name", typeof(string), propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; var price = runtimeEntityType.AddProperty( "Price", typeof(decimal), propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + price.TypeMapping = SqliteDecimalTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs deleted file mode 100644 index ba42d6b0..00000000 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - public partial class PizzaStoreContextModel - { - partial void Initialize() - { - var address = AddressEntityType.Create(this); - var latLong = LatLongEntityType.Create(this); - var notificationSubscription = NotificationSubscriptionEntityType.Create(this); - var order = OrderEntityType.Create(this); - var pizza = PizzaEntityType.Create(this); - var pizzaSpecial = PizzaSpecialEntityType.Create(this); - var pizzaTopping = PizzaToppingEntityType.Create(this); - var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); - var topping = ToppingEntityType.Create(this); - var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); - var key = KeyEntityType.Create(this); - var persistedGrant = PersistedGrantEntityType.Create(this); - var identityRole = IdentityRoleEntityType.Create(this); - var identityRoleClaimstring = IdentityRoleClaimstringEntityType.Create(this); - var identityUserClaimstring = IdentityUserClaimstringEntityType.Create(this); - var identityUserLoginstring = IdentityUserLoginstringEntityType.Create(this); - var identityUserRolestring = IdentityUserRolestringEntityType.Create(this); - var identityUserTokenstring = IdentityUserTokenstringEntityType.Create(this); - - LatLongEntityType.CreateForeignKey1(latLong, order); - OrderEntityType.CreateForeignKey1(order, address); - PizzaEntityType.CreateForeignKey1(pizza, order); - PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); - PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); - PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); - IdentityRoleClaimstringEntityType.CreateForeignKey1(identityRoleClaimstring, identityRole); - IdentityUserClaimstringEntityType.CreateForeignKey1(identityUserClaimstring, pizzaStoreUser); - IdentityUserLoginstringEntityType.CreateForeignKey1(identityUserLoginstring, pizzaStoreUser); - IdentityUserRolestringEntityType.CreateForeignKey1(identityUserRolestring, identityRole); - IdentityUserRolestringEntityType.CreateForeignKey2(identityUserRolestring, pizzaStoreUser); - IdentityUserTokenstringEntityType.CreateForeignKey1(identityUserTokenstring, pizzaStoreUser); - - AddressEntityType.CreateAnnotations(address); - LatLongEntityType.CreateAnnotations(latLong); - NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); - OrderEntityType.CreateAnnotations(order); - PizzaEntityType.CreateAnnotations(pizza); - PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); - PizzaToppingEntityType.CreateAnnotations(pizzaTopping); - PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); - ToppingEntityType.CreateAnnotations(topping); - DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); - KeyEntityType.CreateAnnotations(key); - PersistedGrantEntityType.CreateAnnotations(persistedGrant); - IdentityRoleEntityType.CreateAnnotations(identityRole); - IdentityRoleClaimstringEntityType.CreateAnnotations(identityRoleClaimstring); - IdentityUserClaimstringEntityType.CreateAnnotations(identityUserClaimstring); - IdentityUserLoginstringEntityType.CreateAnnotations(identityUserLoginstring); - IdentityUserRolestringEntityType.CreateAnnotations(identityUserRolestring); - IdentityUserTokenstringEntityType.CreateAnnotations(identityUserTokenstring); - - AddAnnotation("ProductVersion", "7.0.0"); - } - } -} diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Program.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/Program.cs index b83debb4..bda3460a 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Program.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddDbContext(options => options.UseSqlite("Data Source=pizza.db") - .UseModel(BlazingPizza.Server.Models.PizzaStoreContextModel.Instance)); + .UseModel(BlazingPizza.Server.ComponentModels.PizzaStoreContextModel.Instance)); builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/SeedData.cs b/save-points/05-checkout-with-validation/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/SeedData.cs +++ b/save-points/05-checkout-with-validation/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/06-authentication-and-authorization/BlazingPizza.Server/BlazingPizza.Server.csproj index a1043cb6..e8687fc4 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/AddressEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/AddressEntityType.cs similarity index 76% rename from save-points/05-checkout-with-validation/BlazingPizza.Server/Models/AddressEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/AddressEntityType.cs index 82db81b6..f5908d82 100644 --- a/save-points/05-checkout-with-validation/BlazingPizza.Server/Models/AddressEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/AddressEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class AddressEntityType { @@ -23,7 +26,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var city = runtimeEntityType.AddProperty( "City", @@ -31,6 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + city.TypeMapping = SqliteStringTypeMapping.Default; var line1 = runtimeEntityType.AddProperty( "Line1", @@ -38,14 +58,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + line1.TypeMapping = SqliteStringTypeMapping.Default; var line2 = runtimeEntityType.AddProperty( "Line2", typeof(string), propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, maxLength: 100); + line2.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -53,6 +74,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + name.TypeMapping = SqliteStringTypeMapping.Default; var postalCode = runtimeEntityType.AddProperty( "PostalCode", @@ -60,6 +82,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 20); + postalCode.TypeMapping = SqliteStringTypeMapping.Default; var region = runtimeEntityType.AddProperty( "Region", @@ -67,6 +90,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 20); + region.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs similarity index 87% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs index 1dd4563b..6c5ca661 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class DeviceFlowCodesEntityType { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 200); + userCode.TypeMapping = SqliteStringTypeMapping.Default; var clientId = runtimeEntityType.AddProperty( "ClientId", @@ -32,12 +34,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; var creationTime = runtimeEntityType.AddProperty( "CreationTime", typeof(DateTime), propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", @@ -45,6 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", @@ -53,6 +59,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; var deviceCode = runtimeEntityType.AddProperty( "DeviceCode", @@ -60,12 +67,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + deviceCode.TypeMapping = SqliteStringTypeMapping.Default; var expiration = runtimeEntityType.AddProperty( "Expiration", typeof(DateTime?), propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; var sessionId = runtimeEntityType.AddProperty( "SessionId", @@ -74,6 +83,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; var subjectId = runtimeEntityType.AddProperty( "SubjectId", @@ -82,6 +92,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userCode }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs similarity index 76% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs index 8946b261..73cabada 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs @@ -3,14 +3,17 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityRoleClaimstringEntityType + internal partial class IdentityRoleClaimEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,7 +28,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var claimType = runtimeEntityType.AddProperty( "ClaimType", @@ -33,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; var claimValue = runtimeEntityType.AddProperty( "ClaimValue", @@ -40,12 +60,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; var roleId = runtimeEntityType.AddProperty( "RoleId", typeof(string), propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + roleId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs similarity index 90% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityRoleEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs index 2f1fec2b..3f46cdc5 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityRoleEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class IdentityRoleEntityType { @@ -24,6 +25,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var concurrencyStamp = runtimeEntityType.AddProperty( "ConcurrencyStamp", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -40,6 +43,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + name.TypeMapping = SqliteStringTypeMapping.Default; var normalizedName = runtimeEntityType.AddProperty( "NormalizedName", @@ -48,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedName.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs similarity index 76% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs index 55418a1e..5de58bf8 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs @@ -3,14 +3,17 @@ using System.Reflection; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserClaimstringEntityType + internal partial class IdentityUserClaimEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,7 +28,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var claimType = runtimeEntityType.AddProperty( "ClaimType", @@ -33,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; var claimValue = runtimeEntityType.AddProperty( "ClaimValue", @@ -40,12 +60,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", typeof(string), propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs similarity index 90% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs index 3ca029bd..fb868abc 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserLoginstringEntityType + internal partial class IdentityUserLoginEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -26,6 +27,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; var providerKey = runtimeEntityType.AddProperty( "ProviderKey", @@ -34,6 +36,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + providerKey.TypeMapping = SqliteStringTypeMapping.Default; var providerDisplayName = runtimeEntityType.AddProperty( "ProviderDisplayName", @@ -41,12 +44,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + providerDisplayName.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", typeof(string), propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { loginProvider, providerKey }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs similarity index 92% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs index 70078d7a..f22fd836 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserRolestringEntityType + internal partial class IdentityUserRoleEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; var roleId = runtimeEntityType.AddProperty( "RoleId", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + roleId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userId, roleId }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs similarity index 90% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs index 93ba6d31..b4e36069 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs @@ -4,13 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { - internal partial class IdentityUserTokenstringEntityType + internal partial class IdentityUserTokenEntityType { public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; var loginProvider = runtimeEntityType.AddProperty( "LoginProvider", @@ -33,6 +35,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -41,6 +44,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 128); + name.TypeMapping = SqliteStringTypeMapping.Default; var value = runtimeEntityType.AddProperty( "Value", @@ -48,6 +52,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + value.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { userId, loginProvider, name }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/KeyEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/KeyEntityType.cs similarity index 61% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/KeyEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/KeyEntityType.cs index f6c6b4c7..8743240a 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/KeyEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/KeyEntityType.cs @@ -2,12 +2,15 @@ using System; using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class KeyEntityType { @@ -24,6 +27,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var algorithm = runtimeEntityType.AddProperty( "Algorithm", @@ -31,30 +35,66 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + algorithm.TypeMapping = SqliteStringTypeMapping.Default; var created = runtimeEntityType.AddProperty( "Created", typeof(DateTime), propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + created.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", typeof(string), propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + data.TypeMapping = SqliteStringTypeMapping.Default; var dataProtected = runtimeEntityType.AddProperty( "DataProtected", typeof(bool), propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + dataProtected.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var isX509Certificate = runtimeEntityType.AddProperty( "IsX509Certificate", typeof(bool), propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + isX509Certificate.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var use = runtimeEntityType.AddProperty( "Use", @@ -62,12 +102,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + use.TypeMapping = SqliteStringTypeMapping.Default; var version = runtimeEntityType.AddProperty( "Version", typeof(int), propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + version.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/LatLongEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs similarity index 56% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/LatLongEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs index 3fd254bd..657b8093 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/LatLongEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs @@ -2,12 +2,14 @@ using System; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class LatLongEntityType { @@ -21,19 +23,67 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas var orderId = runtimeEntityType.AddProperty( "OrderId", typeof(int), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var latitude = runtimeEntityType.AddProperty( "Latitude", typeof(double), propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + latitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); var longitude = runtimeEntityType.AddProperty( "Longitude", typeof(double), propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + longitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); var key = runtimeEntityType.AddKey( new[] { orderId }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs similarity index 68% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs index db236e4c..891722a1 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class NotificationSubscriptionEntityType { @@ -19,11 +22,26 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas var notificationSubscriptionId = runtimeEntityType.AddProperty( "NotificationSubscriptionId", - typeof(int), + typeof(int?), propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + notificationSubscriptionId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + keyComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + providerValueComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var auth = runtimeEntityType.AddProperty( "Auth", @@ -31,6 +49,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + auth.TypeMapping = SqliteStringTypeMapping.Default; var p256dh = runtimeEntityType.AddProperty( "P256dh", @@ -38,6 +57,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + p256dh.TypeMapping = SqliteStringTypeMapping.Default; var url = runtimeEntityType.AddProperty( "Url", @@ -45,6 +65,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + url.TypeMapping = SqliteStringTypeMapping.Default; var userId = runtimeEntityType.AddProperty( "UserId", @@ -52,6 +73,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { notificationSubscriptionId }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/OrderEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/OrderEntityType.cs similarity index 63% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/OrderEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/OrderEntityType.cs index 9d9ec6fd..bf1e5171 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/OrderEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/OrderEntityType.cs @@ -1,12 +1,16 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class OrderEntityType { @@ -23,18 +27,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var createdTime = runtimeEntityType.AddProperty( "CreatedTime", typeof(DateTime), propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + createdTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var deliveryAddressId = runtimeEntityType.AddProperty( "DeliveryAddressId", - typeof(int?), - nullable: true); + typeof(int), + sentinel: 0); + deliveryAddressId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var userId = runtimeEntityType.AddProperty( "UserId", @@ -42,6 +79,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { orderId }); @@ -57,7 +95,9 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType); + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", runtimeForeignKey, diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PersistedGrantEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs similarity index 87% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/PersistedGrantEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs index 842d53a5..c57731dd 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PersistedGrantEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs @@ -3,11 +3,12 @@ using System.Reflection; using Duende.IdentityServer.EntityFramework.Entities; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PersistedGrantEntityType { @@ -25,6 +26,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 200); + key.TypeMapping = SqliteStringTypeMapping.Default; var clientId = runtimeEntityType.AddProperty( "ClientId", @@ -32,6 +34,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; var consumedTime = runtimeEntityType.AddProperty( "ConsumedTime", @@ -39,12 +42,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + consumedTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var creationTime = runtimeEntityType.AddProperty( "CreationTime", typeof(DateTime), propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var data = runtimeEntityType.AddProperty( "Data", @@ -52,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", @@ -60,6 +67,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; var expiration = runtimeEntityType.AddProperty( "Expiration", @@ -67,6 +75,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; var sessionId = runtimeEntityType.AddProperty( "SessionId", @@ -75,6 +84,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; var subjectId = runtimeEntityType.AddProperty( "SubjectId", @@ -83,6 +93,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; var type = runtimeEntityType.AddProperty( "Type", @@ -90,6 +101,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + type.TypeMapping = SqliteStringTypeMapping.Default; var key0 = runtimeEntityType.AddKey( new[] { key }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs similarity index 62% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs index 3a124e63..f8ac05e4 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaEntityType { @@ -25,25 +27,89 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var orderId = runtimeEntityType.AddProperty( "OrderId", typeof(int), propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var size = runtimeEntityType.AddProperty( "Size", typeof(int), propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + size.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var specialId = runtimeEntityType.AddProperty( "SpecialId", typeof(int), propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + specialId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs similarity index 70% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs index e86b0f50..693286c8 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaSpecialEntityType { @@ -23,34 +26,52 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var basePrice = runtimeEntityType.AddProperty( "BasePrice", typeof(decimal), propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + basePrice.TypeMapping = SqliteDecimalTypeMapping.Default; var description = runtimeEntityType.AddProperty( "Description", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + description.TypeMapping = SqliteStringTypeMapping.Default; var imageUrl = runtimeEntityType.AddProperty( "ImageUrl", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + imageUrl.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", typeof(string), propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreContextModel.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs similarity index 50% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreContextModel.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs index 8b516a68..b7e36125 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreContextModel.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs @@ -5,15 +5,34 @@ #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { [DbContext(typeof(PizzaStoreContext))] public partial class PizzaStoreContextModel : RuntimeModel { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + static PizzaStoreContextModel() { var model = new PizzaStoreContextModel(); - model.Initialize(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + model.Customize(); _instance = model; } diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs new file mode 100644 index 00000000..0f8d07cb --- /dev/null +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs @@ -0,0 +1,1619 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + public partial class PizzaStoreContextModel + { + partial void Initialize() + { + var address = AddressEntityType.Create(this); + var latLong = LatLongEntityType.Create(this); + var notificationSubscription = NotificationSubscriptionEntityType.Create(this); + var order = OrderEntityType.Create(this); + var pizza = PizzaEntityType.Create(this); + var pizzaSpecial = PizzaSpecialEntityType.Create(this); + var pizzaTopping = PizzaToppingEntityType.Create(this); + var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); + var topping = ToppingEntityType.Create(this); + var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); + var key = KeyEntityType.Create(this); + var persistedGrant = PersistedGrantEntityType.Create(this); + var identityRole = IdentityRoleEntityType.Create(this); + var identityRoleClaim = IdentityRoleClaimEntityType.Create(this); + var identityUserClaim = IdentityUserClaimEntityType.Create(this); + var identityUserLogin = IdentityUserLoginEntityType.Create(this); + var identityUserRole = IdentityUserRoleEntityType.Create(this); + var identityUserToken = IdentityUserTokenEntityType.Create(this); + + LatLongEntityType.CreateForeignKey1(latLong, order); + OrderEntityType.CreateForeignKey1(order, address); + PizzaEntityType.CreateForeignKey1(pizza, order); + PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); + PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); + PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); + IdentityRoleClaimEntityType.CreateForeignKey1(identityRoleClaim, identityRole); + IdentityUserClaimEntityType.CreateForeignKey1(identityUserClaim, pizzaStoreUser); + IdentityUserLoginEntityType.CreateForeignKey1(identityUserLogin, pizzaStoreUser); + IdentityUserRoleEntityType.CreateForeignKey1(identityUserRole, identityRole); + IdentityUserRoleEntityType.CreateForeignKey2(identityUserRole, pizzaStoreUser); + IdentityUserTokenEntityType.CreateForeignKey1(identityUserToken, pizzaStoreUser); + + AddressEntityType.CreateAnnotations(address); + LatLongEntityType.CreateAnnotations(latLong); + NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); + OrderEntityType.CreateAnnotations(order); + PizzaEntityType.CreateAnnotations(pizza); + PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); + PizzaToppingEntityType.CreateAnnotations(pizzaTopping); + PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); + ToppingEntityType.CreateAnnotations(topping); + DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); + KeyEntityType.CreateAnnotations(key); + PersistedGrantEntityType.CreateAnnotations(persistedGrant); + IdentityRoleEntityType.CreateAnnotations(identityRole); + IdentityRoleClaimEntityType.CreateAnnotations(identityRoleClaim); + IdentityUserClaimEntityType.CreateAnnotations(identityUserClaim); + IdentityUserLoginEntityType.CreateAnnotations(identityUserLogin); + IdentityUserRoleEntityType.CreateAnnotations(identityUserRole); + IdentityUserTokenEntityType.CreateAnnotations(identityUserToken); + + AddAnnotation("ProductVersion", "8.0.0"); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var address = FindEntityType("BlazingPizza.Address")!; + + var defaultTableMappings = new List>(); + address.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var blazingPizzaAddressTableBase = new TableBase("BlazingPizza.Address", null, relationalModel); + var cityColumnBase = new ColumnBase("City", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("City", cityColumnBase); + var idColumnBase = new ColumnBase("Id", "INTEGER", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Id", idColumnBase); + var line1ColumnBase = new ColumnBase("Line1", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line1", line1ColumnBase); + var line2ColumnBase = new ColumnBase("Line2", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line2", line2ColumnBase); + var nameColumnBase = new ColumnBase("Name", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Name", nameColumnBase); + var postalCodeColumnBase = new ColumnBase("PostalCode", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("PostalCode", postalCodeColumnBase); + var regionColumnBase = new ColumnBase("Region", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Region", regionColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Address", blazingPizzaAddressTableBase); + var blazingPizzaAddressMappingBase = new TableMappingBase(address, blazingPizzaAddressTableBase, true); + blazingPizzaAddressTableBase.AddTypeMapping(blazingPizzaAddressMappingBase, false); + defaultTableMappings.Add(blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, address.FindProperty("Id")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)cityColumnBase, address.FindProperty("City")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line1ColumnBase, address.FindProperty("Line1")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line2ColumnBase, address.FindProperty("Line2")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase, address.FindProperty("Name")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)postalCodeColumnBase, address.FindProperty("PostalCode")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)regionColumnBase, address.FindProperty("Region")!, blazingPizzaAddressMappingBase); + + var tableMappings = new List(); + address.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var addressTable = new Table("Address", null, relationalModel); + var idColumn = new Column("Id", "INTEGER", addressTable); + addressTable.Columns.Add("Id", idColumn); + var cityColumn = new Column("City", "TEXT", addressTable); + addressTable.Columns.Add("City", cityColumn); + var line1Column = new Column("Line1", "TEXT", addressTable); + addressTable.Columns.Add("Line1", line1Column); + var line2Column = new Column("Line2", "TEXT", addressTable); + addressTable.Columns.Add("Line2", line2Column); + var nameColumn = new Column("Name", "TEXT", addressTable); + addressTable.Columns.Add("Name", nameColumn); + var postalCodeColumn = new Column("PostalCode", "TEXT", addressTable); + addressTable.Columns.Add("PostalCode", postalCodeColumn); + var regionColumn = new Column("Region", "TEXT", addressTable); + addressTable.Columns.Add("Region", regionColumn); + var pK_Address = new UniqueConstraint("PK_Address", addressTable, new[] { idColumn }); + addressTable.PrimaryKey = pK_Address; + var pK_AddressUc = RelationalModel.GetKey(this, + "BlazingPizza.Address", + new[] { "Id" }); + pK_Address.MappedKeys.Add(pK_AddressUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AddressUc).Add(pK_Address); + addressTable.UniqueConstraints.Add("PK_Address", pK_Address); + relationalModel.Tables.Add(("Address", null), addressTable); + var addressTableMapping = new TableMapping(address, addressTable, true); + addressTable.AddTypeMapping(addressTableMapping, false); + tableMappings.Add(addressTableMapping); + RelationalModel.CreateColumnMapping(idColumn, address.FindProperty("Id")!, addressTableMapping); + RelationalModel.CreateColumnMapping(cityColumn, address.FindProperty("City")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line1Column, address.FindProperty("Line1")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line2Column, address.FindProperty("Line2")!, addressTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, address.FindProperty("Name")!, addressTableMapping); + RelationalModel.CreateColumnMapping(postalCodeColumn, address.FindProperty("PostalCode")!, addressTableMapping); + RelationalModel.CreateColumnMapping(regionColumn, address.FindProperty("Region")!, addressTableMapping); + + var latLong = FindEntityType("BlazingPizza.LatLong")!; + + var defaultTableMappings0 = new List>(); + latLong.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var blazingPizzaLatLongTableBase = new TableBase("BlazingPizza.LatLong", null, relationalModel); + var latitudeColumnBase = new ColumnBase("Latitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Latitude", latitudeColumnBase); + var longitudeColumnBase = new ColumnBase("Longitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Longitude", longitudeColumnBase); + var orderIdColumnBase = new ColumnBase("OrderId", "INTEGER", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("OrderId", orderIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.LatLong", blazingPizzaLatLongTableBase); + var blazingPizzaLatLongMappingBase = new TableMappingBase(latLong, blazingPizzaLatLongTableBase, true); + blazingPizzaLatLongTableBase.AddTypeMapping(blazingPizzaLatLongMappingBase, false); + defaultTableMappings0.Add(blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase, latLong.FindProperty("OrderId")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)latitudeColumnBase, latLong.FindProperty("Latitude")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)longitudeColumnBase, latLong.FindProperty("Longitude")!, blazingPizzaLatLongMappingBase); + + var tableMappings0 = new List(); + latLong.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var ordersTable = new Table("Orders", null, relationalModel); + var orderIdColumn = new Column("OrderId", "INTEGER", ordersTable); + ordersTable.Columns.Add("OrderId", orderIdColumn); + var createdTimeColumn = new Column("CreatedTime", "TEXT", ordersTable); + ordersTable.Columns.Add("CreatedTime", createdTimeColumn); + var deliveryAddressIdColumn = new Column("DeliveryAddressId", "INTEGER", ordersTable); + ordersTable.Columns.Add("DeliveryAddressId", deliveryAddressIdColumn); + var deliveryLocation_LatitudeColumn = new Column("DeliveryLocation_Latitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Latitude", deliveryLocation_LatitudeColumn); + var deliveryLocation_LongitudeColumn = new Column("DeliveryLocation_Longitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Longitude", deliveryLocation_LongitudeColumn); + var userIdColumn = new Column("UserId", "TEXT", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("UserId", userIdColumn); + var pK_Orders = new UniqueConstraint("PK_Orders", ordersTable, new[] { orderIdColumn }); + ordersTable.PrimaryKey = pK_Orders; + var pK_OrdersUc = RelationalModel.GetKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc).Add(pK_Orders); + var pK_OrdersUc0 = RelationalModel.GetKey(this, + "BlazingPizza.Order", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc0); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc0).Add(pK_Orders); + ordersTable.UniqueConstraints.Add("PK_Orders", pK_Orders); + var iX_Orders_DeliveryAddressId = new TableIndex( + "IX_Orders_DeliveryAddressId", ordersTable, new[] { deliveryAddressIdColumn }, false); + var iX_Orders_DeliveryAddressIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }); + iX_Orders_DeliveryAddressId.MappedIndexes.Add(iX_Orders_DeliveryAddressIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Orders_DeliveryAddressIdIx).Add(iX_Orders_DeliveryAddressId); + ordersTable.Indexes.Add("IX_Orders_DeliveryAddressId", iX_Orders_DeliveryAddressId); + relationalModel.Tables.Add(("Orders", null), ordersTable); + var ordersTableMapping = new TableMapping(latLong, ordersTable, true) + { + IsSharedTablePrincipal = false, + }; + ordersTable.AddTypeMapping(ordersTableMapping, true); + tableMappings0.Add(ordersTableMapping); + ordersTable.AddRowInternalForeignKey(latLong, RelationalModel.GetForeignKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" })); + RelationalModel.CreateColumnMapping(orderIdColumn, latLong.FindProperty("OrderId")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LatitudeColumn, latLong.FindProperty("Latitude")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LongitudeColumn, latLong.FindProperty("Longitude")!, ordersTableMapping); + + var notificationSubscription = FindEntityType("BlazingPizza.NotificationSubscription")!; + + var defaultTableMappings1 = new List>(); + notificationSubscription.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var blazingPizzaNotificationSubscriptionTableBase = new TableBase("BlazingPizza.NotificationSubscription", null, relationalModel); + var authColumnBase = new ColumnBase("Auth", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Auth", authColumnBase); + var notificationSubscriptionIdColumnBase = new ColumnBase("NotificationSubscriptionId", "INTEGER", blazingPizzaNotificationSubscriptionTableBase); + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumnBase); + var p256dhColumnBase = new ColumnBase("P256dh", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("P256dh", p256dhColumnBase); + var urlColumnBase = new ColumnBase("Url", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Url", urlColumnBase); + var userIdColumnBase = new ColumnBase("UserId", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("UserId", userIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.NotificationSubscription", blazingPizzaNotificationSubscriptionTableBase); + var blazingPizzaNotificationSubscriptionMappingBase = new TableMappingBase(notificationSubscription, blazingPizzaNotificationSubscriptionTableBase, true); + blazingPizzaNotificationSubscriptionTableBase.AddTypeMapping(blazingPizzaNotificationSubscriptionMappingBase, false); + defaultTableMappings1.Add(blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)notificationSubscriptionIdColumnBase, notificationSubscription.FindProperty("NotificationSubscriptionId")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)authColumnBase, notificationSubscription.FindProperty("Auth")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)p256dhColumnBase, notificationSubscription.FindProperty("P256dh")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)urlColumnBase, notificationSubscription.FindProperty("Url")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase, notificationSubscription.FindProperty("UserId")!, blazingPizzaNotificationSubscriptionMappingBase); + + var tableMappings1 = new List(); + notificationSubscription.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var notificationSubscriptionsTable = new Table("NotificationSubscriptions", null, relationalModel); + var notificationSubscriptionIdColumn = new Column("NotificationSubscriptionId", "INTEGER", notificationSubscriptionsTable); + notificationSubscriptionsTable.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumn); + var authColumn = new Column("Auth", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Auth", authColumn); + var p256dhColumn = new Column("P256dh", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("P256dh", p256dhColumn); + var urlColumn = new Column("Url", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Url", urlColumn); + var userIdColumn0 = new Column("UserId", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("UserId", userIdColumn0); + var pK_NotificationSubscriptions = new UniqueConstraint("PK_NotificationSubscriptions", notificationSubscriptionsTable, new[] { notificationSubscriptionIdColumn }); + notificationSubscriptionsTable.PrimaryKey = pK_NotificationSubscriptions; + var pK_NotificationSubscriptionsUc = RelationalModel.GetKey(this, + "BlazingPizza.NotificationSubscription", + new[] { "NotificationSubscriptionId" }); + pK_NotificationSubscriptions.MappedKeys.Add(pK_NotificationSubscriptionsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_NotificationSubscriptionsUc).Add(pK_NotificationSubscriptions); + notificationSubscriptionsTable.UniqueConstraints.Add("PK_NotificationSubscriptions", pK_NotificationSubscriptions); + relationalModel.Tables.Add(("NotificationSubscriptions", null), notificationSubscriptionsTable); + var notificationSubscriptionsTableMapping = new TableMapping(notificationSubscription, notificationSubscriptionsTable, true); + notificationSubscriptionsTable.AddTypeMapping(notificationSubscriptionsTableMapping, false); + tableMappings1.Add(notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(notificationSubscriptionIdColumn, notificationSubscription.FindProperty("NotificationSubscriptionId")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(authColumn, notificationSubscription.FindProperty("Auth")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(p256dhColumn, notificationSubscription.FindProperty("P256dh")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(urlColumn, notificationSubscription.FindProperty("Url")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn0, notificationSubscription.FindProperty("UserId")!, notificationSubscriptionsTableMapping); + + var order = FindEntityType("BlazingPizza.Order")!; + + var defaultTableMappings2 = new List>(); + order.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings2); + var blazingPizzaOrderTableBase = new TableBase("BlazingPizza.Order", null, relationalModel); + var createdTimeColumnBase = new ColumnBase("CreatedTime", "TEXT", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("CreatedTime", createdTimeColumnBase); + var deliveryAddressIdColumnBase = new ColumnBase("DeliveryAddressId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("DeliveryAddressId", deliveryAddressIdColumnBase); + var orderIdColumnBase0 = new ColumnBase("OrderId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("OrderId", orderIdColumnBase0); + var userIdColumnBase0 = new ColumnBase("UserId", "TEXT", blazingPizzaOrderTableBase) + { + IsNullable = true + }; + blazingPizzaOrderTableBase.Columns.Add("UserId", userIdColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.Order", blazingPizzaOrderTableBase); + var blazingPizzaOrderMappingBase = new TableMappingBase(order, blazingPizzaOrderTableBase, true); + blazingPizzaOrderTableBase.AddTypeMapping(blazingPizzaOrderMappingBase, false); + defaultTableMappings2.Add(blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase0, order.FindProperty("OrderId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdTimeColumnBase, order.FindProperty("CreatedTime")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deliveryAddressIdColumnBase, order.FindProperty("DeliveryAddressId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase0, order.FindProperty("UserId")!, blazingPizzaOrderMappingBase); + + var tableMappings2 = new List(); + order.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); + var ordersTableMapping0 = new TableMapping(order, ordersTable, true) + { + IsSharedTablePrincipal = true, + }; + ordersTable.AddTypeMapping(ordersTableMapping0, false); + tableMappings2.Add(ordersTableMapping0); + RelationalModel.CreateColumnMapping(orderIdColumn, order.FindProperty("OrderId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(createdTimeColumn, order.FindProperty("CreatedTime")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(deliveryAddressIdColumn, order.FindProperty("DeliveryAddressId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(userIdColumn, order.FindProperty("UserId")!, ordersTableMapping0); + + var pizza = FindEntityType("BlazingPizza.Pizza")!; + + var defaultTableMappings3 = new List>(); + pizza.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings3); + var blazingPizzaPizzaTableBase = new TableBase("BlazingPizza.Pizza", null, relationalModel); + var idColumnBase0 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Id", idColumnBase0); + var orderIdColumnBase1 = new ColumnBase("OrderId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("OrderId", orderIdColumnBase1); + var sizeColumnBase = new ColumnBase("Size", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Size", sizeColumnBase); + var specialIdColumnBase = new ColumnBase("SpecialId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("SpecialId", specialIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Pizza", blazingPizzaPizzaTableBase); + var blazingPizzaPizzaMappingBase = new TableMappingBase(pizza, blazingPizzaPizzaTableBase, true); + blazingPizzaPizzaTableBase.AddTypeMapping(blazingPizzaPizzaMappingBase, false); + defaultTableMappings3.Add(blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, pizza.FindProperty("Id")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase1, pizza.FindProperty("OrderId")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sizeColumnBase, pizza.FindProperty("Size")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)specialIdColumnBase, pizza.FindProperty("SpecialId")!, blazingPizzaPizzaMappingBase); + + var tableMappings3 = new List(); + pizza.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); + var pizzasTable = new Table("Pizzas", null, relationalModel); + var idColumn0 = new Column("Id", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Id", idColumn0); + var orderIdColumn0 = new Column("OrderId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("OrderId", orderIdColumn0); + var sizeColumn = new Column("Size", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Size", sizeColumn); + var specialIdColumn = new Column("SpecialId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("SpecialId", specialIdColumn); + var pK_Pizzas = new UniqueConstraint("PK_Pizzas", pizzasTable, new[] { idColumn0 }); + pizzasTable.PrimaryKey = pK_Pizzas; + var pK_PizzasUc = RelationalModel.GetKey(this, + "BlazingPizza.Pizza", + new[] { "Id" }); + pK_Pizzas.MappedKeys.Add(pK_PizzasUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzasUc).Add(pK_Pizzas); + pizzasTable.UniqueConstraints.Add("PK_Pizzas", pK_Pizzas); + var iX_Pizzas_OrderId = new TableIndex( + "IX_Pizzas_OrderId", pizzasTable, new[] { orderIdColumn0 }, false); + var iX_Pizzas_OrderIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }); + iX_Pizzas_OrderId.MappedIndexes.Add(iX_Pizzas_OrderIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_OrderIdIx).Add(iX_Pizzas_OrderId); + pizzasTable.Indexes.Add("IX_Pizzas_OrderId", iX_Pizzas_OrderId); + var iX_Pizzas_SpecialId = new TableIndex( + "IX_Pizzas_SpecialId", pizzasTable, new[] { specialIdColumn }, false); + var iX_Pizzas_SpecialIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }); + iX_Pizzas_SpecialId.MappedIndexes.Add(iX_Pizzas_SpecialIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_SpecialIdIx).Add(iX_Pizzas_SpecialId); + pizzasTable.Indexes.Add("IX_Pizzas_SpecialId", iX_Pizzas_SpecialId); + relationalModel.Tables.Add(("Pizzas", null), pizzasTable); + var pizzasTableMapping = new TableMapping(pizza, pizzasTable, true); + pizzasTable.AddTypeMapping(pizzasTableMapping, false); + tableMappings3.Add(pizzasTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, pizza.FindProperty("Id")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(orderIdColumn0, pizza.FindProperty("OrderId")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(sizeColumn, pizza.FindProperty("Size")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(specialIdColumn, pizza.FindProperty("SpecialId")!, pizzasTableMapping); + + var pizzaSpecial = FindEntityType("BlazingPizza.PizzaSpecial")!; + + var defaultTableMappings4 = new List>(); + pizzaSpecial.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); + var blazingPizzaPizzaSpecialTableBase = new TableBase("BlazingPizza.PizzaSpecial", null, relationalModel); + var basePriceColumnBase = new ColumnBase("BasePrice", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("BasePrice", basePriceColumnBase); + var descriptionColumnBase = new ColumnBase("Description", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Description", descriptionColumnBase); + var idColumnBase1 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Id", idColumnBase1); + var imageUrlColumnBase = new ColumnBase("ImageUrl", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("ImageUrl", imageUrlColumnBase); + var nameColumnBase0 = new ColumnBase("Name", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Name", nameColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaSpecial", blazingPizzaPizzaSpecialTableBase); + var blazingPizzaPizzaSpecialMappingBase = new TableMappingBase(pizzaSpecial, blazingPizzaPizzaSpecialTableBase, true); + blazingPizzaPizzaSpecialTableBase.AddTypeMapping(blazingPizzaPizzaSpecialMappingBase, false); + defaultTableMappings4.Add(blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, pizzaSpecial.FindProperty("Id")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)basePriceColumnBase, pizzaSpecial.FindProperty("BasePrice")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase, pizzaSpecial.FindProperty("Description")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)imageUrlColumnBase, pizzaSpecial.FindProperty("ImageUrl")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase0, pizzaSpecial.FindProperty("Name")!, blazingPizzaPizzaSpecialMappingBase); + + var tableMappings4 = new List(); + pizzaSpecial.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); + var specialsTable = new Table("Specials", null, relationalModel); + var idColumn1 = new Column("Id", "INTEGER", specialsTable); + specialsTable.Columns.Add("Id", idColumn1); + var basePriceColumn = new Column("BasePrice", "TEXT", specialsTable); + specialsTable.Columns.Add("BasePrice", basePriceColumn); + var descriptionColumn = new Column("Description", "TEXT", specialsTable); + specialsTable.Columns.Add("Description", descriptionColumn); + var imageUrlColumn = new Column("ImageUrl", "TEXT", specialsTable); + specialsTable.Columns.Add("ImageUrl", imageUrlColumn); + var nameColumn0 = new Column("Name", "TEXT", specialsTable); + specialsTable.Columns.Add("Name", nameColumn0); + var pK_Specials = new UniqueConstraint("PK_Specials", specialsTable, new[] { idColumn1 }); + specialsTable.PrimaryKey = pK_Specials; + var pK_SpecialsUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + pK_Specials.MappedKeys.Add(pK_SpecialsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_SpecialsUc).Add(pK_Specials); + specialsTable.UniqueConstraints.Add("PK_Specials", pK_Specials); + relationalModel.Tables.Add(("Specials", null), specialsTable); + var specialsTableMapping = new TableMapping(pizzaSpecial, specialsTable, true); + specialsTable.AddTypeMapping(specialsTableMapping, false); + tableMappings4.Add(specialsTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, pizzaSpecial.FindProperty("Id")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(basePriceColumn, pizzaSpecial.FindProperty("BasePrice")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn, pizzaSpecial.FindProperty("Description")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(imageUrlColumn, pizzaSpecial.FindProperty("ImageUrl")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn0, pizzaSpecial.FindProperty("Name")!, specialsTableMapping); + + var pizzaTopping = FindEntityType("BlazingPizza.PizzaTopping")!; + + var defaultTableMappings5 = new List>(); + pizzaTopping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings5); + var blazingPizzaPizzaToppingTableBase = new TableBase("BlazingPizza.PizzaTopping", null, relationalModel); + var pizzaIdColumnBase = new ColumnBase("PizzaId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("PizzaId", pizzaIdColumnBase); + var toppingIdColumnBase = new ColumnBase("ToppingId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("ToppingId", toppingIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaTopping", blazingPizzaPizzaToppingTableBase); + var blazingPizzaPizzaToppingMappingBase = new TableMappingBase(pizzaTopping, blazingPizzaPizzaToppingTableBase, true); + blazingPizzaPizzaToppingTableBase.AddTypeMapping(blazingPizzaPizzaToppingMappingBase, false); + defaultTableMappings5.Add(blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pizzaIdColumnBase, pizzaTopping.FindProperty("PizzaId")!, blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)toppingIdColumnBase, pizzaTopping.FindProperty("ToppingId")!, blazingPizzaPizzaToppingMappingBase); + + var tableMappings5 = new List(); + pizzaTopping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); + var pizzaToppingTable = new Table("PizzaTopping", null, relationalModel); + var pizzaIdColumn = new Column("PizzaId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("PizzaId", pizzaIdColumn); + var toppingIdColumn = new Column("ToppingId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("ToppingId", toppingIdColumn); + var pK_PizzaTopping = new UniqueConstraint("PK_PizzaTopping", pizzaToppingTable, new[] { pizzaIdColumn, toppingIdColumn }); + pizzaToppingTable.PrimaryKey = pK_PizzaTopping; + var pK_PizzaToppingUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId", "ToppingId" }); + pK_PizzaTopping.MappedKeys.Add(pK_PizzaToppingUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzaToppingUc).Add(pK_PizzaTopping); + pizzaToppingTable.UniqueConstraints.Add("PK_PizzaTopping", pK_PizzaTopping); + var iX_PizzaTopping_ToppingId = new TableIndex( + "IX_PizzaTopping_ToppingId", pizzaToppingTable, new[] { toppingIdColumn }, false); + var iX_PizzaTopping_ToppingIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }); + iX_PizzaTopping_ToppingId.MappedIndexes.Add(iX_PizzaTopping_ToppingIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PizzaTopping_ToppingIdIx).Add(iX_PizzaTopping_ToppingId); + pizzaToppingTable.Indexes.Add("IX_PizzaTopping_ToppingId", iX_PizzaTopping_ToppingId); + relationalModel.Tables.Add(("PizzaTopping", null), pizzaToppingTable); + var pizzaToppingTableMapping = new TableMapping(pizzaTopping, pizzaToppingTable, true); + pizzaToppingTable.AddTypeMapping(pizzaToppingTableMapping, false); + tableMappings5.Add(pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(pizzaIdColumn, pizzaTopping.FindProperty("PizzaId")!, pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(toppingIdColumn, pizzaTopping.FindProperty("ToppingId")!, pizzaToppingTableMapping); + + var pizzaStoreUser = FindEntityType("BlazingPizza.Server.PizzaStoreUser")!; + + var defaultTableMappings6 = new List>(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings6); + var blazingPizzaServerPizzaStoreUserTableBase = new TableBase("BlazingPizza.Server.PizzaStoreUser", null, relationalModel); + var accessFailedCountColumnBase = new ColumnBase("AccessFailedCount", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("AccessFailedCount", accessFailedCountColumnBase); + var concurrencyStampColumnBase = new ColumnBase("ConcurrencyStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase); + var emailColumnBase = new ColumnBase("Email", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Email", emailColumnBase); + var emailConfirmedColumnBase = new ColumnBase("EmailConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("EmailConfirmed", emailConfirmedColumnBase); + var idColumnBase2 = new ColumnBase("Id", "TEXT", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Id", idColumnBase2); + var lockoutEnabledColumnBase = new ColumnBase("LockoutEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnabled", lockoutEnabledColumnBase); + var lockoutEndColumnBase = new ColumnBase("LockoutEnd", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnd", lockoutEndColumnBase); + var normalizedEmailColumnBase = new ColumnBase("NormalizedEmail", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedEmail", normalizedEmailColumnBase); + var normalizedUserNameColumnBase = new ColumnBase("NormalizedUserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedUserName", normalizedUserNameColumnBase); + var passwordHashColumnBase = new ColumnBase("PasswordHash", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PasswordHash", passwordHashColumnBase); + var phoneNumberColumnBase = new ColumnBase("PhoneNumber", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumber", phoneNumberColumnBase); + var phoneNumberConfirmedColumnBase = new ColumnBase("PhoneNumberConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumnBase); + var securityStampColumnBase = new ColumnBase("SecurityStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("SecurityStamp", securityStampColumnBase); + var twoFactorEnabledColumnBase = new ColumnBase("TwoFactorEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumnBase); + var userNameColumnBase = new ColumnBase("UserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("UserName", userNameColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Server.PizzaStoreUser", blazingPizzaServerPizzaStoreUserTableBase); + var blazingPizzaServerPizzaStoreUserMappingBase = new TableMappingBase(pizzaStoreUser, blazingPizzaServerPizzaStoreUserTableBase, true); + blazingPizzaServerPizzaStoreUserTableBase.AddTypeMapping(blazingPizzaServerPizzaStoreUserMappingBase, false); + defaultTableMappings6.Add(blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, pizzaStoreUser.FindProperty("Id")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)accessFailedCountColumnBase, pizzaStoreUser.FindProperty("AccessFailedCount")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailColumnBase, pizzaStoreUser.FindProperty("Email")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailConfirmedColumnBase, pizzaStoreUser.FindProperty("EmailConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEnabledColumnBase, pizzaStoreUser.FindProperty("LockoutEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEndColumnBase, pizzaStoreUser.FindProperty("LockoutEnd")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedEmailColumnBase, pizzaStoreUser.FindProperty("NormalizedEmail")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedUserNameColumnBase, pizzaStoreUser.FindProperty("NormalizedUserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)passwordHashColumnBase, pizzaStoreUser.FindProperty("PasswordHash")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberColumnBase, pizzaStoreUser.FindProperty("PhoneNumber")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberConfirmedColumnBase, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)securityStampColumnBase, pizzaStoreUser.FindProperty("SecurityStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)twoFactorEnabledColumnBase, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userNameColumnBase, pizzaStoreUser.FindProperty("UserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + + var tableMappings6 = new List(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:TableMappings", tableMappings6); + var aspNetUsersTable = new Table("AspNetUsers", null, relationalModel); + var idColumn2 = new Column("Id", "TEXT", aspNetUsersTable); + aspNetUsersTable.Columns.Add("Id", idColumn2); + var accessFailedCountColumn = new Column("AccessFailedCount", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("AccessFailedCount", accessFailedCountColumn); + var concurrencyStampColumn = new Column("ConcurrencyStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn); + var emailColumn = new Column("Email", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("Email", emailColumn); + var emailConfirmedColumn = new Column("EmailConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("EmailConfirmed", emailConfirmedColumn); + var lockoutEnabledColumn = new Column("LockoutEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("LockoutEnabled", lockoutEnabledColumn); + var lockoutEndColumn = new Column("LockoutEnd", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("LockoutEnd", lockoutEndColumn); + var normalizedEmailColumn = new Column("NormalizedEmail", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedEmail", normalizedEmailColumn); + var normalizedUserNameColumn = new Column("NormalizedUserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedUserName", normalizedUserNameColumn); + var passwordHashColumn = new Column("PasswordHash", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PasswordHash", passwordHashColumn); + var phoneNumberColumn = new Column("PhoneNumber", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PhoneNumber", phoneNumberColumn); + var phoneNumberConfirmedColumn = new Column("PhoneNumberConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumn); + var securityStampColumn = new Column("SecurityStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("SecurityStamp", securityStampColumn); + var twoFactorEnabledColumn = new Column("TwoFactorEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumn); + var userNameColumn = new Column("UserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("UserName", userNameColumn); + var pK_AspNetUsers = new UniqueConstraint("PK_AspNetUsers", aspNetUsersTable, new[] { idColumn2 }); + aspNetUsersTable.PrimaryKey = pK_AspNetUsers; + var pK_AspNetUsersUc = RelationalModel.GetKey(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + pK_AspNetUsers.MappedKeys.Add(pK_AspNetUsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUsersUc).Add(pK_AspNetUsers); + aspNetUsersTable.UniqueConstraints.Add("PK_AspNetUsers", pK_AspNetUsers); + var emailIndex = new TableIndex( + "EmailIndex", aspNetUsersTable, new[] { normalizedEmailColumn }, false); + var emailIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedEmail" }); + emailIndex.MappedIndexes.Add(emailIndexIx); + RelationalModel.GetOrCreateTableIndexes(emailIndexIx).Add(emailIndex); + aspNetUsersTable.Indexes.Add("EmailIndex", emailIndex); + var userNameIndex = new TableIndex( + "UserNameIndex", aspNetUsersTable, new[] { normalizedUserNameColumn }, true); + var userNameIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedUserName" }); + userNameIndex.MappedIndexes.Add(userNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(userNameIndexIx).Add(userNameIndex); + aspNetUsersTable.Indexes.Add("UserNameIndex", userNameIndex); + relationalModel.Tables.Add(("AspNetUsers", null), aspNetUsersTable); + var aspNetUsersTableMapping = new TableMapping(pizzaStoreUser, aspNetUsersTable, true); + aspNetUsersTable.AddTypeMapping(aspNetUsersTableMapping, false); + tableMappings6.Add(aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(idColumn2, pizzaStoreUser.FindProperty("Id")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(accessFailedCountColumn, pizzaStoreUser.FindProperty("AccessFailedCount")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailColumn, pizzaStoreUser.FindProperty("Email")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailConfirmedColumn, pizzaStoreUser.FindProperty("EmailConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEnabledColumn, pizzaStoreUser.FindProperty("LockoutEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEndColumn, pizzaStoreUser.FindProperty("LockoutEnd")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedEmailColumn, pizzaStoreUser.FindProperty("NormalizedEmail")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedUserNameColumn, pizzaStoreUser.FindProperty("NormalizedUserName")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(passwordHashColumn, pizzaStoreUser.FindProperty("PasswordHash")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberColumn, pizzaStoreUser.FindProperty("PhoneNumber")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberConfirmedColumn, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(securityStampColumn, pizzaStoreUser.FindProperty("SecurityStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(twoFactorEnabledColumn, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(userNameColumn, pizzaStoreUser.FindProperty("UserName")!, aspNetUsersTableMapping); + + var topping = FindEntityType("BlazingPizza.Topping")!; + + var defaultTableMappings7 = new List>(); + topping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings7); + var blazingPizzaToppingTableBase = new TableBase("BlazingPizza.Topping", null, relationalModel); + var idColumnBase3 = new ColumnBase("Id", "INTEGER", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Id", idColumnBase3); + var nameColumnBase1 = new ColumnBase("Name", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Name", nameColumnBase1); + var priceColumnBase = new ColumnBase("Price", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Price", priceColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Topping", blazingPizzaToppingTableBase); + var blazingPizzaToppingMappingBase = new TableMappingBase(topping, blazingPizzaToppingTableBase, true); + blazingPizzaToppingTableBase.AddTypeMapping(blazingPizzaToppingMappingBase, false); + defaultTableMappings7.Add(blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase3, topping.FindProperty("Id")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase1, topping.FindProperty("Name")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)priceColumnBase, topping.FindProperty("Price")!, blazingPizzaToppingMappingBase); + + var tableMappings7 = new List(); + topping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings7); + var toppingsTable = new Table("Toppings", null, relationalModel); + var idColumn3 = new Column("Id", "INTEGER", toppingsTable); + toppingsTable.Columns.Add("Id", idColumn3); + var nameColumn1 = new Column("Name", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Name", nameColumn1); + var priceColumn = new Column("Price", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Price", priceColumn); + var pK_Toppings = new UniqueConstraint("PK_Toppings", toppingsTable, new[] { idColumn3 }); + toppingsTable.PrimaryKey = pK_Toppings; + var pK_ToppingsUc = RelationalModel.GetKey(this, + "BlazingPizza.Topping", + new[] { "Id" }); + pK_Toppings.MappedKeys.Add(pK_ToppingsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_ToppingsUc).Add(pK_Toppings); + toppingsTable.UniqueConstraints.Add("PK_Toppings", pK_Toppings); + relationalModel.Tables.Add(("Toppings", null), toppingsTable); + var toppingsTableMapping = new TableMapping(topping, toppingsTable, true); + toppingsTable.AddTypeMapping(toppingsTableMapping, false); + tableMappings7.Add(toppingsTableMapping); + RelationalModel.CreateColumnMapping(idColumn3, topping.FindProperty("Id")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn1, topping.FindProperty("Name")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(priceColumn, topping.FindProperty("Price")!, toppingsTableMapping); + + var deviceFlowCodes = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes")!; + + var defaultTableMappings8 = new List>(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings8); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", null, relationalModel); + var clientIdColumnBase = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("ClientId", clientIdColumnBase); + var creationTimeColumnBase = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("CreationTime", creationTimeColumnBase); + var dataColumnBase = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Data", dataColumnBase); + var descriptionColumnBase0 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Description", descriptionColumnBase0); + var deviceCodeColumnBase = new ColumnBase("DeviceCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("DeviceCode", deviceCodeColumnBase); + var expirationColumnBase = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Expiration", expirationColumnBase); + var sessionIdColumnBase = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SessionId", sessionIdColumnBase); + var subjectIdColumnBase = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SubjectId", subjectIdColumnBase); + var userCodeColumnBase = new ColumnBase("UserCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("UserCode", userCodeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase = new TableMappingBase(deviceFlowCodes, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase, false); + defaultTableMappings8.Add(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userCodeColumnBase, deviceFlowCodes.FindProperty("UserCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase, deviceFlowCodes.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase, deviceFlowCodes.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, deviceFlowCodes.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase0, deviceFlowCodes.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deviceCodeColumnBase, deviceFlowCodes.FindProperty("DeviceCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase, deviceFlowCodes.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase, deviceFlowCodes.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase, deviceFlowCodes.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + + var tableMappings8 = new List(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:TableMappings", tableMappings8); + var deviceCodesTable = new Table("DeviceCodes", null, relationalModel); + var userCodeColumn = new Column("UserCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("UserCode", userCodeColumn); + var clientIdColumn = new Column("ClientId", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("ClientId", clientIdColumn); + var creationTimeColumn = new Column("CreationTime", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("CreationTime", creationTimeColumn); + var dataColumn = new Column("Data", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Data", dataColumn); + var descriptionColumn0 = new Column("Description", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("Description", descriptionColumn0); + var deviceCodeColumn = new Column("DeviceCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("DeviceCode", deviceCodeColumn); + var expirationColumn = new Column("Expiration", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Expiration", expirationColumn); + var sessionIdColumn = new Column("SessionId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SessionId", sessionIdColumn); + var subjectIdColumn = new Column("SubjectId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SubjectId", subjectIdColumn); + var pK_DeviceCodes = new UniqueConstraint("PK_DeviceCodes", deviceCodesTable, new[] { userCodeColumn }); + deviceCodesTable.PrimaryKey = pK_DeviceCodes; + var pK_DeviceCodesUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "UserCode" }); + pK_DeviceCodes.MappedKeys.Add(pK_DeviceCodesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_DeviceCodesUc).Add(pK_DeviceCodes); + deviceCodesTable.UniqueConstraints.Add("PK_DeviceCodes", pK_DeviceCodes); + var iX_DeviceCodes_DeviceCode = new TableIndex( + "IX_DeviceCodes_DeviceCode", deviceCodesTable, new[] { deviceCodeColumn }, true); + var iX_DeviceCodes_DeviceCodeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "DeviceCode" }); + iX_DeviceCodes_DeviceCode.MappedIndexes.Add(iX_DeviceCodes_DeviceCodeIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_DeviceCodeIx).Add(iX_DeviceCodes_DeviceCode); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_DeviceCode", iX_DeviceCodes_DeviceCode); + var iX_DeviceCodes_Expiration = new TableIndex( + "IX_DeviceCodes_Expiration", deviceCodesTable, new[] { expirationColumn }, false); + var iX_DeviceCodes_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "Expiration" }); + iX_DeviceCodes_Expiration.MappedIndexes.Add(iX_DeviceCodes_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_ExpirationIx).Add(iX_DeviceCodes_Expiration); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_Expiration", iX_DeviceCodes_Expiration); + relationalModel.Tables.Add(("DeviceCodes", null), deviceCodesTable); + var deviceCodesTableMapping = new TableMapping(deviceFlowCodes, deviceCodesTable, true); + deviceCodesTable.AddTypeMapping(deviceCodesTableMapping, false); + tableMappings8.Add(deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(userCodeColumn, deviceFlowCodes.FindProperty("UserCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn, deviceFlowCodes.FindProperty("ClientId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn, deviceFlowCodes.FindProperty("CreationTime")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, deviceFlowCodes.FindProperty("Data")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn0, deviceFlowCodes.FindProperty("Description")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(deviceCodeColumn, deviceFlowCodes.FindProperty("DeviceCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn, deviceFlowCodes.FindProperty("Expiration")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn, deviceFlowCodes.FindProperty("SessionId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn, deviceFlowCodes.FindProperty("SubjectId")!, deviceCodesTableMapping); + + var key = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.Key")!; + + var defaultTableMappings9 = new List>(); + key.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings9); + var duendeIdentityServerEntityFrameworkEntitiesKeyTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.Key", null, relationalModel); + var algorithmColumnBase = new ColumnBase("Algorithm", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Algorithm", algorithmColumnBase); + var createdColumnBase = new ColumnBase("Created", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Created", createdColumnBase); + var dataColumnBase0 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Data", dataColumnBase0); + var dataProtectedColumnBase = new ColumnBase("DataProtected", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("DataProtected", dataProtectedColumnBase); + var idColumnBase4 = new ColumnBase("Id", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Id", idColumnBase4); + var isX509CertificateColumnBase = new ColumnBase("IsX509Certificate", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("IsX509Certificate", isX509CertificateColumnBase); + var useColumnBase = new ColumnBase("Use", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Use", useColumnBase); + var versionColumnBase = new ColumnBase("Version", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Version", versionColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.Key", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + var duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase = new TableMappingBase(key, duendeIdentityServerEntityFrameworkEntitiesKeyTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase, false); + defaultTableMappings9.Add(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase4, key.FindProperty("Id")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)algorithmColumnBase, key.FindProperty("Algorithm")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdColumnBase, key.FindProperty("Created")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase0, key.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataProtectedColumnBase, key.FindProperty("DataProtected")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)isX509CertificateColumnBase, key.FindProperty("IsX509Certificate")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)useColumnBase, key.FindProperty("Use")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)versionColumnBase, key.FindProperty("Version")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + + var tableMappings9 = new List(); + key.SetRuntimeAnnotation("Relational:TableMappings", tableMappings9); + var keysTable = new Table("Keys", null, relationalModel); + var idColumn4 = new Column("Id", "TEXT", keysTable); + keysTable.Columns.Add("Id", idColumn4); + var algorithmColumn = new Column("Algorithm", "TEXT", keysTable); + keysTable.Columns.Add("Algorithm", algorithmColumn); + var createdColumn = new Column("Created", "TEXT", keysTable); + keysTable.Columns.Add("Created", createdColumn); + var dataColumn0 = new Column("Data", "TEXT", keysTable); + keysTable.Columns.Add("Data", dataColumn0); + var dataProtectedColumn = new Column("DataProtected", "INTEGER", keysTable); + keysTable.Columns.Add("DataProtected", dataProtectedColumn); + var isX509CertificateColumn = new Column("IsX509Certificate", "INTEGER", keysTable); + keysTable.Columns.Add("IsX509Certificate", isX509CertificateColumn); + var useColumn = new Column("Use", "TEXT", keysTable) + { + IsNullable = true + }; + keysTable.Columns.Add("Use", useColumn); + var versionColumn = new Column("Version", "INTEGER", keysTable); + keysTable.Columns.Add("Version", versionColumn); + var pK_Keys = new UniqueConstraint("PK_Keys", keysTable, new[] { idColumn4 }); + keysTable.PrimaryKey = pK_Keys; + var pK_KeysUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Id" }); + pK_Keys.MappedKeys.Add(pK_KeysUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_KeysUc).Add(pK_Keys); + keysTable.UniqueConstraints.Add("PK_Keys", pK_Keys); + var iX_Keys_Use = new TableIndex( + "IX_Keys_Use", keysTable, new[] { useColumn }, false); + var iX_Keys_UseIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Use" }); + iX_Keys_Use.MappedIndexes.Add(iX_Keys_UseIx); + RelationalModel.GetOrCreateTableIndexes(iX_Keys_UseIx).Add(iX_Keys_Use); + keysTable.Indexes.Add("IX_Keys_Use", iX_Keys_Use); + relationalModel.Tables.Add(("Keys", null), keysTable); + var keysTableMapping = new TableMapping(key, keysTable, true); + keysTable.AddTypeMapping(keysTableMapping, false); + tableMappings9.Add(keysTableMapping); + RelationalModel.CreateColumnMapping(idColumn4, key.FindProperty("Id")!, keysTableMapping); + RelationalModel.CreateColumnMapping(algorithmColumn, key.FindProperty("Algorithm")!, keysTableMapping); + RelationalModel.CreateColumnMapping(createdColumn, key.FindProperty("Created")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataColumn0, key.FindProperty("Data")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataProtectedColumn, key.FindProperty("DataProtected")!, keysTableMapping); + RelationalModel.CreateColumnMapping(isX509CertificateColumn, key.FindProperty("IsX509Certificate")!, keysTableMapping); + RelationalModel.CreateColumnMapping(useColumn, key.FindProperty("Use")!, keysTableMapping); + RelationalModel.CreateColumnMapping(versionColumn, key.FindProperty("Version")!, keysTableMapping); + + var persistedGrant = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant")!; + + var defaultTableMappings10 = new List>(); + persistedGrant.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings10); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", null, relationalModel); + var clientIdColumnBase0 = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ClientId", clientIdColumnBase0); + var consumedTimeColumnBase = new ColumnBase("ConsumedTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ConsumedTime", consumedTimeColumnBase); + var creationTimeColumnBase0 = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("CreationTime", creationTimeColumnBase0); + var dataColumnBase1 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Data", dataColumnBase1); + var descriptionColumnBase1 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Description", descriptionColumnBase1); + var expirationColumnBase0 = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Expiration", expirationColumnBase0); + var keyColumnBase = new ColumnBase("Key", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Key", keyColumnBase); + var sessionIdColumnBase0 = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SessionId", sessionIdColumnBase0); + var subjectIdColumnBase0 = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SubjectId", subjectIdColumnBase0); + var typeColumnBase = new ColumnBase("Type", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Type", typeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase = new TableMappingBase(persistedGrant, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase, false); + defaultTableMappings10.Add(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)keyColumnBase, persistedGrant.FindProperty("Key")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase0, persistedGrant.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)consumedTimeColumnBase, persistedGrant.FindProperty("ConsumedTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase0, persistedGrant.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase1, persistedGrant.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase1, persistedGrant.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase0, persistedGrant.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase0, persistedGrant.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase0, persistedGrant.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)typeColumnBase, persistedGrant.FindProperty("Type")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + + var tableMappings10 = new List(); + persistedGrant.SetRuntimeAnnotation("Relational:TableMappings", tableMappings10); + var persistedGrantsTable = new Table("PersistedGrants", null, relationalModel); + var keyColumn = new Column("Key", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Key", keyColumn); + var clientIdColumn0 = new Column("ClientId", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("ClientId", clientIdColumn0); + var consumedTimeColumn = new Column("ConsumedTime", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("ConsumedTime", consumedTimeColumn); + var creationTimeColumn0 = new Column("CreationTime", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("CreationTime", creationTimeColumn0); + var dataColumn1 = new Column("Data", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Data", dataColumn1); + var descriptionColumn1 = new Column("Description", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Description", descriptionColumn1); + var expirationColumn0 = new Column("Expiration", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Expiration", expirationColumn0); + var sessionIdColumn0 = new Column("SessionId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SessionId", sessionIdColumn0); + var subjectIdColumn0 = new Column("SubjectId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SubjectId", subjectIdColumn0); + var typeColumn = new Column("Type", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Type", typeColumn); + var pK_PersistedGrants = new UniqueConstraint("PK_PersistedGrants", persistedGrantsTable, new[] { keyColumn }); + persistedGrantsTable.PrimaryKey = pK_PersistedGrants; + var pK_PersistedGrantsUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Key" }); + pK_PersistedGrants.MappedKeys.Add(pK_PersistedGrantsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PersistedGrantsUc).Add(pK_PersistedGrants); + persistedGrantsTable.UniqueConstraints.Add("PK_PersistedGrants", pK_PersistedGrants); + var iX_PersistedGrants_ConsumedTime = new TableIndex( + "IX_PersistedGrants_ConsumedTime", persistedGrantsTable, new[] { consumedTimeColumn }, false); + var iX_PersistedGrants_ConsumedTimeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "ConsumedTime" }); + iX_PersistedGrants_ConsumedTime.MappedIndexes.Add(iX_PersistedGrants_ConsumedTimeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ConsumedTimeIx).Add(iX_PersistedGrants_ConsumedTime); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_ConsumedTime", iX_PersistedGrants_ConsumedTime); + var iX_PersistedGrants_Expiration = new TableIndex( + "IX_PersistedGrants_Expiration", persistedGrantsTable, new[] { expirationColumn0 }, false); + var iX_PersistedGrants_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Expiration" }); + iX_PersistedGrants_Expiration.MappedIndexes.Add(iX_PersistedGrants_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ExpirationIx).Add(iX_PersistedGrants_Expiration); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_Expiration", iX_PersistedGrants_Expiration); + var iX_PersistedGrants_SubjectId_ClientId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_ClientId_Type", persistedGrantsTable, new[] { subjectIdColumn0, clientIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_ClientId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "ClientId", "Type" }); + iX_PersistedGrants_SubjectId_ClientId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_ClientId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_ClientId_TypeIx).Add(iX_PersistedGrants_SubjectId_ClientId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_ClientId_Type", iX_PersistedGrants_SubjectId_ClientId_Type); + var iX_PersistedGrants_SubjectId_SessionId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_SessionId_Type", persistedGrantsTable, new[] { subjectIdColumn0, sessionIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_SessionId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "SessionId", "Type" }); + iX_PersistedGrants_SubjectId_SessionId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_SessionId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_SessionId_TypeIx).Add(iX_PersistedGrants_SubjectId_SessionId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_SessionId_Type", iX_PersistedGrants_SubjectId_SessionId_Type); + relationalModel.Tables.Add(("PersistedGrants", null), persistedGrantsTable); + var persistedGrantsTableMapping = new TableMapping(persistedGrant, persistedGrantsTable, true); + persistedGrantsTable.AddTypeMapping(persistedGrantsTableMapping, false); + tableMappings10.Add(persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(keyColumn, persistedGrant.FindProperty("Key")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn0, persistedGrant.FindProperty("ClientId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(consumedTimeColumn, persistedGrant.FindProperty("ConsumedTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn0, persistedGrant.FindProperty("CreationTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(dataColumn1, persistedGrant.FindProperty("Data")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn1, persistedGrant.FindProperty("Description")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn0, persistedGrant.FindProperty("Expiration")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn0, persistedGrant.FindProperty("SessionId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn0, persistedGrant.FindProperty("SubjectId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(typeColumn, persistedGrant.FindProperty("Type")!, persistedGrantsTableMapping); + + var identityRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRole")!; + + var defaultTableMappings11 = new List>(); + identityRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings11); + var microsoftAspNetCoreIdentityIdentityRoleTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRole", null, relationalModel); + var concurrencyStampColumnBase0 = new ColumnBase("ConcurrencyStamp", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase0); + var idColumnBase5 = new ColumnBase("Id", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase); + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Id", idColumnBase5); + var nameColumnBase2 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Name", nameColumnBase2); + var normalizedNameColumnBase = new ColumnBase("NormalizedName", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("NormalizedName", normalizedNameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRole", microsoftAspNetCoreIdentityIdentityRoleTableBase); + var microsoftAspNetCoreIdentityIdentityRoleMappingBase = new TableMappingBase(identityRole, microsoftAspNetCoreIdentityIdentityRoleTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleMappingBase, false); + defaultTableMappings11.Add(microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase5, identityRole.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase0, identityRole.FindProperty("ConcurrencyStamp")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase2, identityRole.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedNameColumnBase, identityRole.FindProperty("NormalizedName")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + + var tableMappings11 = new List(); + identityRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings11); + var aspNetRolesTable = new Table("AspNetRoles", null, relationalModel); + var idColumn5 = new Column("Id", "TEXT", aspNetRolesTable); + aspNetRolesTable.Columns.Add("Id", idColumn5); + var concurrencyStampColumn0 = new Column("ConcurrencyStamp", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn0); + var nameColumn2 = new Column("Name", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("Name", nameColumn2); + var normalizedNameColumn = new Column("NormalizedName", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("NormalizedName", normalizedNameColumn); + var pK_AspNetRoles = new UniqueConstraint("PK_AspNetRoles", aspNetRolesTable, new[] { idColumn5 }); + aspNetRolesTable.PrimaryKey = pK_AspNetRoles; + var pK_AspNetRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + pK_AspNetRoles.MappedKeys.Add(pK_AspNetRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRolesUc).Add(pK_AspNetRoles); + aspNetRolesTable.UniqueConstraints.Add("PK_AspNetRoles", pK_AspNetRoles); + var roleNameIndex = new TableIndex( + "RoleNameIndex", aspNetRolesTable, new[] { normalizedNameColumn }, true); + var roleNameIndexIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "NormalizedName" }); + roleNameIndex.MappedIndexes.Add(roleNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(roleNameIndexIx).Add(roleNameIndex); + aspNetRolesTable.Indexes.Add("RoleNameIndex", roleNameIndex); + relationalModel.Tables.Add(("AspNetRoles", null), aspNetRolesTable); + var aspNetRolesTableMapping = new TableMapping(identityRole, aspNetRolesTable, true); + aspNetRolesTable.AddTypeMapping(aspNetRolesTableMapping, false); + tableMappings11.Add(aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(idColumn5, identityRole.FindProperty("Id")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn0, identityRole.FindProperty("ConcurrencyStamp")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(nameColumn2, identityRole.FindProperty("Name")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(normalizedNameColumn, identityRole.FindProperty("NormalizedName")!, aspNetRolesTableMapping); + + var identityRoleClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRoleClaim")!; + + var defaultTableMappings12 = new List>(); + identityRoleClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings12); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRoleClaim", null, relationalModel); + var claimTypeColumnBase = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase); + var claimValueColumnBase = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase); + var idColumnBase6 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("Id", idColumnBase6); + var roleIdColumnBase = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("RoleId", roleIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRoleClaim", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase = new TableMappingBase(identityRoleClaim, microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase, false); + defaultTableMappings12.Add(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase6, identityRoleClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase, identityRoleClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase, identityRoleClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase, identityRoleClaim.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + + var tableMappings12 = new List(); + identityRoleClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings12); + var aspNetRoleClaimsTable = new Table("AspNetRoleClaims", null, relationalModel); + var idColumn6 = new Column("Id", "INTEGER", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("Id", idColumn6); + var claimTypeColumn = new Column("ClaimType", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimType", claimTypeColumn); + var claimValueColumn = new Column("ClaimValue", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimValue", claimValueColumn); + var roleIdColumn = new Column("RoleId", "TEXT", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("RoleId", roleIdColumn); + var pK_AspNetRoleClaims = new UniqueConstraint("PK_AspNetRoleClaims", aspNetRoleClaimsTable, new[] { idColumn6 }); + aspNetRoleClaimsTable.PrimaryKey = pK_AspNetRoleClaims; + var pK_AspNetRoleClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "Id" }); + pK_AspNetRoleClaims.MappedKeys.Add(pK_AspNetRoleClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRoleClaimsUc).Add(pK_AspNetRoleClaims); + aspNetRoleClaimsTable.UniqueConstraints.Add("PK_AspNetRoleClaims", pK_AspNetRoleClaims); + var iX_AspNetRoleClaims_RoleId = new TableIndex( + "IX_AspNetRoleClaims_RoleId", aspNetRoleClaimsTable, new[] { roleIdColumn }, false); + var iX_AspNetRoleClaims_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }); + iX_AspNetRoleClaims_RoleId.MappedIndexes.Add(iX_AspNetRoleClaims_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetRoleClaims_RoleIdIx).Add(iX_AspNetRoleClaims_RoleId); + aspNetRoleClaimsTable.Indexes.Add("IX_AspNetRoleClaims_RoleId", iX_AspNetRoleClaims_RoleId); + relationalModel.Tables.Add(("AspNetRoleClaims", null), aspNetRoleClaimsTable); + var aspNetRoleClaimsTableMapping = new TableMapping(identityRoleClaim, aspNetRoleClaimsTable, true); + aspNetRoleClaimsTable.AddTypeMapping(aspNetRoleClaimsTableMapping, false); + tableMappings12.Add(aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn6, identityRoleClaim.FindProperty("Id")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn, identityRoleClaim.FindProperty("ClaimType")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn, identityRoleClaim.FindProperty("ClaimValue")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn, identityRoleClaim.FindProperty("RoleId")!, aspNetRoleClaimsTableMapping); + + var identityUserClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserClaim")!; + + var defaultTableMappings13 = new List>(); + identityUserClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings13); + var microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserClaim", null, relationalModel); + var claimTypeColumnBase0 = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase0); + var claimValueColumnBase0 = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase0); + var idColumnBase7 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("Id", idColumnBase7); + var userIdColumnBase1 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("UserId", userIdColumnBase1); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserClaim", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase = new TableMappingBase(identityUserClaim, microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase, false); + defaultTableMappings13.Add(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase7, identityUserClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase0, identityUserClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase0, identityUserClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase1, identityUserClaim.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + + var tableMappings13 = new List(); + identityUserClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings13); + var aspNetUserClaimsTable = new Table("AspNetUserClaims", null, relationalModel); + var idColumn7 = new Column("Id", "INTEGER", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("Id", idColumn7); + var claimTypeColumn0 = new Column("ClaimType", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimType", claimTypeColumn0); + var claimValueColumn0 = new Column("ClaimValue", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimValue", claimValueColumn0); + var userIdColumn1 = new Column("UserId", "TEXT", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("UserId", userIdColumn1); + var pK_AspNetUserClaims = new UniqueConstraint("PK_AspNetUserClaims", aspNetUserClaimsTable, new[] { idColumn7 }); + aspNetUserClaimsTable.PrimaryKey = pK_AspNetUserClaims; + var pK_AspNetUserClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "Id" }); + pK_AspNetUserClaims.MappedKeys.Add(pK_AspNetUserClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserClaimsUc).Add(pK_AspNetUserClaims); + aspNetUserClaimsTable.UniqueConstraints.Add("PK_AspNetUserClaims", pK_AspNetUserClaims); + var iX_AspNetUserClaims_UserId = new TableIndex( + "IX_AspNetUserClaims_UserId", aspNetUserClaimsTable, new[] { userIdColumn1 }, false); + var iX_AspNetUserClaims_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }); + iX_AspNetUserClaims_UserId.MappedIndexes.Add(iX_AspNetUserClaims_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserClaims_UserIdIx).Add(iX_AspNetUserClaims_UserId); + aspNetUserClaimsTable.Indexes.Add("IX_AspNetUserClaims_UserId", iX_AspNetUserClaims_UserId); + relationalModel.Tables.Add(("AspNetUserClaims", null), aspNetUserClaimsTable); + var aspNetUserClaimsTableMapping = new TableMapping(identityUserClaim, aspNetUserClaimsTable, true); + aspNetUserClaimsTable.AddTypeMapping(aspNetUserClaimsTableMapping, false); + tableMappings13.Add(aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn7, identityUserClaim.FindProperty("Id")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn0, identityUserClaim.FindProperty("ClaimType")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn0, identityUserClaim.FindProperty("ClaimValue")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn1, identityUserClaim.FindProperty("UserId")!, aspNetUserClaimsTableMapping); + + var identityUserLogin = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserLogin")!; + + var defaultTableMappings14 = new List>(); + identityUserLogin.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings14); + var microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserLogin", null, relationalModel); + var loginProviderColumnBase = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase); + var providerDisplayNameColumnBase = new ColumnBase("ProviderDisplayName", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderDisplayName", providerDisplayNameColumnBase); + var providerKeyColumnBase = new ColumnBase("ProviderKey", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderKey", providerKeyColumnBase); + var userIdColumnBase2 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("UserId", userIdColumnBase2); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserLogin", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase = new TableMappingBase(identityUserLogin, microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase, false); + defaultTableMappings14.Add(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase, identityUserLogin.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerKeyColumnBase, identityUserLogin.FindProperty("ProviderKey")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerDisplayNameColumnBase, identityUserLogin.FindProperty("ProviderDisplayName")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase2, identityUserLogin.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + + var tableMappings14 = new List(); + identityUserLogin.SetRuntimeAnnotation("Relational:TableMappings", tableMappings14); + var aspNetUserLoginsTable = new Table("AspNetUserLogins", null, relationalModel); + var loginProviderColumn = new Column("LoginProvider", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("LoginProvider", loginProviderColumn); + var providerKeyColumn = new Column("ProviderKey", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("ProviderKey", providerKeyColumn); + var providerDisplayNameColumn = new Column("ProviderDisplayName", "TEXT", aspNetUserLoginsTable) + { + IsNullable = true + }; + aspNetUserLoginsTable.Columns.Add("ProviderDisplayName", providerDisplayNameColumn); + var userIdColumn2 = new Column("UserId", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("UserId", userIdColumn2); + var pK_AspNetUserLogins = new UniqueConstraint("PK_AspNetUserLogins", aspNetUserLoginsTable, new[] { loginProviderColumn, providerKeyColumn }); + aspNetUserLoginsTable.PrimaryKey = pK_AspNetUserLogins; + var pK_AspNetUserLoginsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "LoginProvider", "ProviderKey" }); + pK_AspNetUserLogins.MappedKeys.Add(pK_AspNetUserLoginsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserLoginsUc).Add(pK_AspNetUserLogins); + aspNetUserLoginsTable.UniqueConstraints.Add("PK_AspNetUserLogins", pK_AspNetUserLogins); + var iX_AspNetUserLogins_UserId = new TableIndex( + "IX_AspNetUserLogins_UserId", aspNetUserLoginsTable, new[] { userIdColumn2 }, false); + var iX_AspNetUserLogins_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }); + iX_AspNetUserLogins_UserId.MappedIndexes.Add(iX_AspNetUserLogins_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserLogins_UserIdIx).Add(iX_AspNetUserLogins_UserId); + aspNetUserLoginsTable.Indexes.Add("IX_AspNetUserLogins_UserId", iX_AspNetUserLogins_UserId); + relationalModel.Tables.Add(("AspNetUserLogins", null), aspNetUserLoginsTable); + var aspNetUserLoginsTableMapping = new TableMapping(identityUserLogin, aspNetUserLoginsTable, true); + aspNetUserLoginsTable.AddTypeMapping(aspNetUserLoginsTableMapping, false); + tableMappings14.Add(aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn, identityUserLogin.FindProperty("LoginProvider")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerKeyColumn, identityUserLogin.FindProperty("ProviderKey")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerDisplayNameColumn, identityUserLogin.FindProperty("ProviderDisplayName")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn2, identityUserLogin.FindProperty("UserId")!, aspNetUserLoginsTableMapping); + + var identityUserRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserRole")!; + + var defaultTableMappings15 = new List>(); + identityUserRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings15); + var microsoftAspNetCoreIdentityIdentityUserRolestringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserRole", null, relationalModel); + var roleIdColumnBase0 = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("RoleId", roleIdColumnBase0); + var userIdColumnBase3 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("UserId", userIdColumnBase3); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserRole", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + var microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase = new TableMappingBase(identityUserRole, microsoftAspNetCoreIdentityIdentityUserRolestringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase, false); + defaultTableMappings15.Add(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase0, identityUserRole.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase3, identityUserRole.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + + var tableMappings15 = new List(); + identityUserRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings15); + var aspNetUserRolesTable = new Table("AspNetUserRoles", null, relationalModel); + var userIdColumn3 = new Column("UserId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("UserId", userIdColumn3); + var roleIdColumn0 = new Column("RoleId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("RoleId", roleIdColumn0); + var pK_AspNetUserRoles = new UniqueConstraint("PK_AspNetUserRoles", aspNetUserRolesTable, new[] { userIdColumn3, roleIdColumn0 }); + aspNetUserRolesTable.PrimaryKey = pK_AspNetUserRoles; + var pK_AspNetUserRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId", "RoleId" }); + pK_AspNetUserRoles.MappedKeys.Add(pK_AspNetUserRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserRolesUc).Add(pK_AspNetUserRoles); + aspNetUserRolesTable.UniqueConstraints.Add("PK_AspNetUserRoles", pK_AspNetUserRoles); + var iX_AspNetUserRoles_RoleId = new TableIndex( + "IX_AspNetUserRoles_RoleId", aspNetUserRolesTable, new[] { roleIdColumn0 }, false); + var iX_AspNetUserRoles_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }); + iX_AspNetUserRoles_RoleId.MappedIndexes.Add(iX_AspNetUserRoles_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserRoles_RoleIdIx).Add(iX_AspNetUserRoles_RoleId); + aspNetUserRolesTable.Indexes.Add("IX_AspNetUserRoles_RoleId", iX_AspNetUserRoles_RoleId); + relationalModel.Tables.Add(("AspNetUserRoles", null), aspNetUserRolesTable); + var aspNetUserRolesTableMapping = new TableMapping(identityUserRole, aspNetUserRolesTable, true); + aspNetUserRolesTable.AddTypeMapping(aspNetUserRolesTableMapping, false); + tableMappings15.Add(aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn0, identityUserRole.FindProperty("RoleId")!, aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn3, identityUserRole.FindProperty("UserId")!, aspNetUserRolesTableMapping); + + var identityUserToken = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserToken")!; + + var defaultTableMappings16 = new List>(); + identityUserToken.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings16); + var microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserToken", null, relationalModel); + var loginProviderColumnBase0 = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase0); + var nameColumnBase3 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Name", nameColumnBase3); + var userIdColumnBase4 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("UserId", userIdColumnBase4); + var valueColumnBase = new ColumnBase("Value", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Value", valueColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserToken", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase = new TableMappingBase(identityUserToken, microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase, false); + defaultTableMappings16.Add(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase0, identityUserToken.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase3, identityUserToken.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase4, identityUserToken.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueColumnBase, identityUserToken.FindProperty("Value")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + + var tableMappings16 = new List(); + identityUserToken.SetRuntimeAnnotation("Relational:TableMappings", tableMappings16); + var aspNetUserTokensTable = new Table("AspNetUserTokens", null, relationalModel); + var userIdColumn4 = new Column("UserId", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("UserId", userIdColumn4); + var loginProviderColumn0 = new Column("LoginProvider", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("LoginProvider", loginProviderColumn0); + var nameColumn3 = new Column("Name", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("Name", nameColumn3); + var valueColumn = new Column("Value", "TEXT", aspNetUserTokensTable) + { + IsNullable = true + }; + aspNetUserTokensTable.Columns.Add("Value", valueColumn); + var pK_AspNetUserTokens = new UniqueConstraint("PK_AspNetUserTokens", aspNetUserTokensTable, new[] { userIdColumn4, loginProviderColumn0, nameColumn3 }); + aspNetUserTokensTable.PrimaryKey = pK_AspNetUserTokens; + var pK_AspNetUserTokensUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId", "LoginProvider", "Name" }); + pK_AspNetUserTokens.MappedKeys.Add(pK_AspNetUserTokensUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserTokensUc).Add(pK_AspNetUserTokens); + aspNetUserTokensTable.UniqueConstraints.Add("PK_AspNetUserTokens", pK_AspNetUserTokens); + relationalModel.Tables.Add(("AspNetUserTokens", null), aspNetUserTokensTable); + var aspNetUserTokensTableMapping = new TableMapping(identityUserToken, aspNetUserTokensTable, true); + aspNetUserTokensTable.AddTypeMapping(aspNetUserTokensTableMapping, false); + tableMappings16.Add(aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn0, identityUserToken.FindProperty("LoginProvider")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(nameColumn3, identityUserToken.FindProperty("Name")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn4, identityUserToken.FindProperty("UserId")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(valueColumn, identityUserToken.FindProperty("Value")!, aspNetUserTokensTableMapping); + var fK_AspNetRoleClaims_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetRoleClaims_AspNetRoles_RoleId", aspNetRoleClaimsTable, aspNetRolesTable, + new[] { roleIdColumn }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetRoleClaims_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetRoleClaims_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk).Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRoleClaimsTable.ForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + var fK_AspNetUserClaims_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserClaims_AspNetUsers_UserId", aspNetUserClaimsTable, aspNetUsersTable, + new[] { userIdColumn1 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserClaims_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserClaims_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserClaims_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserClaims_AspNetUsers_UserIdFk).Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUserClaimsTable.ForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + var fK_AspNetUserLogins_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserLogins_AspNetUsers_UserId", aspNetUserLoginsTable, aspNetUsersTable, + new[] { userIdColumn2 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserLogins_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserLogins_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserLogins_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserLogins_AspNetUsers_UserIdFk).Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUserLoginsTable.ForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + var fK_AspNetUserRoles_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetRoles_RoleId", aspNetUserRolesTable, aspNetRolesTable, + new[] { roleIdColumn0 }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetRoles_RoleIdFk).Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + var fK_AspNetUserRoles_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetUsers_UserId", aspNetUserRolesTable, aspNetUsersTable, + new[] { userIdColumn3 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetUsers_UserIdFk).Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + var fK_AspNetUserTokens_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserTokens_AspNetUsers_UserId", aspNetUserTokensTable, aspNetUsersTable, + new[] { userIdColumn4 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserTokens_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserTokens_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserTokens_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserTokens_AspNetUsers_UserIdFk).Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUserTokensTable.ForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + var fK_Orders_Address_DeliveryAddressId = new ForeignKeyConstraint( + "FK_Orders_Address_DeliveryAddressId", ordersTable, addressTable, + new[] { deliveryAddressIdColumn }, + addressTable.FindUniqueConstraint("PK_Address")!, ReferentialAction.Cascade); + var fK_Orders_Address_DeliveryAddressIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }, + "BlazingPizza.Address", + new[] { "Id" }); + fK_Orders_Address_DeliveryAddressId.MappedForeignKeys.Add(fK_Orders_Address_DeliveryAddressIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Orders_Address_DeliveryAddressIdFk).Add(fK_Orders_Address_DeliveryAddressId); + ordersTable.ForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + addressTable.ReferencingForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + var fK_Pizzas_Orders_OrderId = new ForeignKeyConstraint( + "FK_Pizzas_Orders_OrderId", pizzasTable, ordersTable, + new[] { orderIdColumn0 }, + ordersTable.FindUniqueConstraint("PK_Orders")!, ReferentialAction.Cascade); + var fK_Pizzas_Orders_OrderIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" }); + fK_Pizzas_Orders_OrderId.MappedForeignKeys.Add(fK_Pizzas_Orders_OrderIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Orders_OrderIdFk).Add(fK_Pizzas_Orders_OrderId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + ordersTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + var fK_Pizzas_Specials_SpecialId = new ForeignKeyConstraint( + "FK_Pizzas_Specials_SpecialId", pizzasTable, specialsTable, + new[] { specialIdColumn }, + specialsTable.FindUniqueConstraint("PK_Specials")!, ReferentialAction.Cascade); + var fK_Pizzas_Specials_SpecialIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + fK_Pizzas_Specials_SpecialId.MappedForeignKeys.Add(fK_Pizzas_Specials_SpecialIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Specials_SpecialIdFk).Add(fK_Pizzas_Specials_SpecialId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + specialsTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + var fK_PizzaTopping_Pizzas_PizzaId = new ForeignKeyConstraint( + "FK_PizzaTopping_Pizzas_PizzaId", pizzaToppingTable, pizzasTable, + new[] { pizzaIdColumn }, + pizzasTable.FindUniqueConstraint("PK_Pizzas")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Pizzas_PizzaIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId" }, + "BlazingPizza.Pizza", + new[] { "Id" }); + fK_PizzaTopping_Pizzas_PizzaId.MappedForeignKeys.Add(fK_PizzaTopping_Pizzas_PizzaIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Pizzas_PizzaIdFk).Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzasTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + var fK_PizzaTopping_Toppings_ToppingId = new ForeignKeyConstraint( + "FK_PizzaTopping_Toppings_ToppingId", pizzaToppingTable, toppingsTable, + new[] { toppingIdColumn }, + toppingsTable.FindUniqueConstraint("PK_Toppings")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Toppings_ToppingIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }, + "BlazingPizza.Topping", + new[] { "Id" }); + fK_PizzaTopping_Toppings_ToppingId.MappedForeignKeys.Add(fK_PizzaTopping_Toppings_ToppingIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Toppings_ToppingIdFk).Add(fK_PizzaTopping_Toppings_ToppingId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + toppingsTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs similarity index 63% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs index 18b2d96d..7295425c 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs @@ -2,12 +2,15 @@ using System; using System.Reflection; using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaStoreUserEntityType { @@ -24,12 +27,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; var accessFailedCount = runtimeEntityType.AddProperty( "AccessFailedCount", typeof(int), propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + accessFailedCount.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var concurrencyStamp = runtimeEntityType.AddProperty( "ConcurrencyStamp", @@ -38,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; var email = runtimeEntityType.AddProperty( "Email", @@ -46,18 +67,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + email.TypeMapping = SqliteStringTypeMapping.Default; var emailConfirmed = runtimeEntityType.AddProperty( "EmailConfirmed", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + emailConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var lockoutEnabled = runtimeEntityType.AddProperty( "LockoutEnabled", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + lockoutEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var lockoutEnd = runtimeEntityType.AddProperty( "LockoutEnd", @@ -65,6 +119,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + lockoutEnd.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default; var normalizedEmail = runtimeEntityType.AddProperty( "NormalizedEmail", @@ -73,6 +128,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedEmail.TypeMapping = SqliteStringTypeMapping.Default; var normalizedUserName = runtimeEntityType.AddProperty( "NormalizedUserName", @@ -81,6 +137,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + normalizedUserName.TypeMapping = SqliteStringTypeMapping.Default; var passwordHash = runtimeEntityType.AddProperty( "PasswordHash", @@ -88,6 +145,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + passwordHash.TypeMapping = SqliteStringTypeMapping.Default; var phoneNumber = runtimeEntityType.AddProperty( "PhoneNumber", @@ -95,12 +153,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + phoneNumber.TypeMapping = SqliteStringTypeMapping.Default; var phoneNumberConfirmed = runtimeEntityType.AddProperty( "PhoneNumberConfirmed", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + phoneNumberConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var securityStamp = runtimeEntityType.AddProperty( "SecurityStamp", @@ -108,12 +183,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + securityStamp.TypeMapping = SqliteStringTypeMapping.Default; var twoFactorEnabled = runtimeEntityType.AddProperty( "TwoFactorEnabled", typeof(bool), propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + twoFactorEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var userName = runtimeEntityType.AddProperty( "UserName", @@ -122,6 +214,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, maxLength: 256); + userName.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaToppingEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs similarity index 72% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaToppingEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs index b97d2a24..803ab153 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaToppingEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class PizzaToppingEntityType { @@ -24,14 +26,46 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int), propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + pizzaId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var toppingId = runtimeEntityType.AddProperty( "ToppingId", typeof(int), propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + toppingId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var key = runtimeEntityType.AddKey( new[] { pizzaId, toppingId }); diff --git a/save-points/03-show-order-status/BlazingPizza.Server/Models/ToppingEntityType.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs similarity index 68% rename from save-points/03-show-order-status/BlazingPizza.Server/Models/ToppingEntityType.cs rename to save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs index 9295f9bf..d3a19507 100644 --- a/save-points/03-show-order-status/BlazingPizza.Server/Models/ToppingEntityType.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class ToppingEntityType { @@ -23,20 +26,38 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var name = runtimeEntityType.AddProperty( "Name", typeof(string), propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; var price = runtimeEntityType.AddProperty( "Price", typeof(decimal), propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + price.TypeMapping = SqliteDecimalTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs deleted file mode 100644 index ba42d6b0..00000000 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - public partial class PizzaStoreContextModel - { - partial void Initialize() - { - var address = AddressEntityType.Create(this); - var latLong = LatLongEntityType.Create(this); - var notificationSubscription = NotificationSubscriptionEntityType.Create(this); - var order = OrderEntityType.Create(this); - var pizza = PizzaEntityType.Create(this); - var pizzaSpecial = PizzaSpecialEntityType.Create(this); - var pizzaTopping = PizzaToppingEntityType.Create(this); - var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); - var topping = ToppingEntityType.Create(this); - var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); - var key = KeyEntityType.Create(this); - var persistedGrant = PersistedGrantEntityType.Create(this); - var identityRole = IdentityRoleEntityType.Create(this); - var identityRoleClaimstring = IdentityRoleClaimstringEntityType.Create(this); - var identityUserClaimstring = IdentityUserClaimstringEntityType.Create(this); - var identityUserLoginstring = IdentityUserLoginstringEntityType.Create(this); - var identityUserRolestring = IdentityUserRolestringEntityType.Create(this); - var identityUserTokenstring = IdentityUserTokenstringEntityType.Create(this); - - LatLongEntityType.CreateForeignKey1(latLong, order); - OrderEntityType.CreateForeignKey1(order, address); - PizzaEntityType.CreateForeignKey1(pizza, order); - PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); - PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); - PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); - IdentityRoleClaimstringEntityType.CreateForeignKey1(identityRoleClaimstring, identityRole); - IdentityUserClaimstringEntityType.CreateForeignKey1(identityUserClaimstring, pizzaStoreUser); - IdentityUserLoginstringEntityType.CreateForeignKey1(identityUserLoginstring, pizzaStoreUser); - IdentityUserRolestringEntityType.CreateForeignKey1(identityUserRolestring, identityRole); - IdentityUserRolestringEntityType.CreateForeignKey2(identityUserRolestring, pizzaStoreUser); - IdentityUserTokenstringEntityType.CreateForeignKey1(identityUserTokenstring, pizzaStoreUser); - - AddressEntityType.CreateAnnotations(address); - LatLongEntityType.CreateAnnotations(latLong); - NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); - OrderEntityType.CreateAnnotations(order); - PizzaEntityType.CreateAnnotations(pizza); - PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); - PizzaToppingEntityType.CreateAnnotations(pizzaTopping); - PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); - ToppingEntityType.CreateAnnotations(topping); - DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); - KeyEntityType.CreateAnnotations(key); - PersistedGrantEntityType.CreateAnnotations(persistedGrant); - IdentityRoleEntityType.CreateAnnotations(identityRole); - IdentityRoleClaimstringEntityType.CreateAnnotations(identityRoleClaimstring); - IdentityUserClaimstringEntityType.CreateAnnotations(identityUserClaimstring); - IdentityUserLoginstringEntityType.CreateAnnotations(identityUserLoginstring); - IdentityUserRolestringEntityType.CreateAnnotations(identityUserRolestring); - IdentityUserTokenstringEntityType.CreateAnnotations(identityUserTokenstring); - - AddAnnotation("ProductVersion", "7.0.0"); - } - } -} diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Program.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/Program.cs index b83debb4..9db9e7ea 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Program.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddDbContext(options => options.UseSqlite("Data Source=pizza.db") - .UseModel(BlazingPizza.Server.Models.PizzaStoreContextModel.Instance)); + .UseModel(BlazingPizza.Server.CompiledModels.PizzaStoreContextModel.Instance)); builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/SeedData.cs b/save-points/06-authentication-and-authorization/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/SeedData.cs +++ b/save-points/06-authentication-and-authorization/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/07-javascript-interop/BlazingPizza.Server/BlazingPizza.Server.csproj index b028c771..3b9de83d 100644 --- a/save-points/07-javascript-interop/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/07-javascript-interop/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/BlazingPizza.Server.sln b/save-points/07-javascript-interop/BlazingPizza.Server/BlazingPizza.Server.sln new file mode 100644 index 00000000..a75e6bd4 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/BlazingPizza.Server.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazingPizza.Server", "BlazingPizza.Server.csproj", "{26739F66-24A4-4172-8C55-F993E88E2191}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {26739F66-24A4-4172-8C55-F993E88E2191}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26739F66-24A4-4172-8C55-F993E88E2191}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26739F66-24A4-4172-8C55-F993E88E2191}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26739F66-24A4-4172-8C55-F993E88E2191}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D438A36C-4656-44CC-B5C1-7BAA8D1283A0} + EndGlobalSection +EndGlobal diff --git a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/AddressEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/AddressEntityType.cs similarity index 76% rename from save-points/04-refactor-state-management/BlazingPizza.Server/Models/AddressEntityType.cs rename to save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/AddressEntityType.cs index 82db81b6..f5908d82 100644 --- a/save-points/04-refactor-state-management/BlazingPizza.Server/Models/AddressEntityType.cs +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/AddressEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class AddressEntityType { @@ -23,7 +26,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var city = runtimeEntityType.AddProperty( "City", @@ -31,6 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + city.TypeMapping = SqliteStringTypeMapping.Default; var line1 = runtimeEntityType.AddProperty( "Line1", @@ -38,14 +58,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + line1.TypeMapping = SqliteStringTypeMapping.Default; var line2 = runtimeEntityType.AddProperty( "Line2", typeof(string), propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, maxLength: 100); + line2.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -53,6 +74,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + name.TypeMapping = SqliteStringTypeMapping.Default; var postalCode = runtimeEntityType.AddProperty( "PostalCode", @@ -60,6 +82,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 20); + postalCode.TypeMapping = SqliteStringTypeMapping.Default; var region = runtimeEntityType.AddProperty( "Region", @@ -67,6 +90,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 20); + region.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs new file mode 100644 index 00000000..6c5ca661 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs @@ -0,0 +1,125 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class DeviceFlowCodesEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + typeof(DeviceFlowCodes), + baseEntityType); + + var userCode = runtimeEntityType.AddProperty( + "UserCode", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 200); + userCode.TypeMapping = SqliteStringTypeMapping.Default; + + var clientId = runtimeEntityType.AddProperty( + "ClientId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; + + var creationTime = runtimeEntityType.AddProperty( + "CreationTime", + typeof(DateTime), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var deviceCode = runtimeEntityType.AddProperty( + "DeviceCode", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + deviceCode.TypeMapping = SqliteStringTypeMapping.Default; + + var expiration = runtimeEntityType.AddProperty( + "Expiration", + typeof(DateTime?), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var sessionId = runtimeEntityType.AddProperty( + "SessionId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; + + var subjectId = runtimeEntityType.AddProperty( + "SubjectId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userCode }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { deviceCode }, + unique: true); + + var index0 = runtimeEntityType.AddIndex( + new[] { expiration }); + + return runtimeEntityType; + } + + 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", "DeviceCodes"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs new file mode 100644 index 00000000..73cabada --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs @@ -0,0 +1,107 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityRoleClaimEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + typeof(IdentityRoleClaim), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var claimType = runtimeEntityType.AddProperty( + "ClaimType", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; + + var claimValue = runtimeEntityType.AddProperty( + "ClaimValue", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; + + var roleId = runtimeEntityType.AddProperty( + "RoleId", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + roleId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { roleId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetRoleClaims"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs new file mode 100644 index 00000000..3f46cdc5 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityRoleEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityRole", + typeof(IdentityRole), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var concurrencyStamp = runtimeEntityType.AddProperty( + "ConcurrencyStamp", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var normalizedName = runtimeEntityType.AddProperty( + "NormalizedName", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedName.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { normalizedName }, + unique: true); + index.AddAnnotation("Relational:Name", "RoleNameIndex"); + + return runtimeEntityType; + } + + 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", "AspNetRoles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs new file mode 100644 index 00000000..5de58bf8 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs @@ -0,0 +1,107 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserClaimEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + typeof(IdentityUserClaim), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var claimType = runtimeEntityType.AddProperty( + "ClaimType", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; + + var claimValue = runtimeEntityType.AddProperty( + "ClaimValue", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { userId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserClaims"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs new file mode 100644 index 00000000..fb868abc --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs @@ -0,0 +1,91 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserLoginEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + typeof(IdentityUserLogin), + baseEntityType); + + var loginProvider = runtimeEntityType.AddProperty( + "LoginProvider", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; + + var providerKey = runtimeEntityType.AddProperty( + "ProviderKey", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + providerKey.TypeMapping = SqliteStringTypeMapping.Default; + + var providerDisplayName = runtimeEntityType.AddProperty( + "ProviderDisplayName", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + providerDisplayName.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { loginProvider, providerKey }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { userId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserLogins"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs new file mode 100644 index 00000000..f22fd836 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs @@ -0,0 +1,85 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserRoleEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserRole", + typeof(IdentityUserRole), + baseEntityType); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var roleId = runtimeEntityType.AddProperty( + "RoleId", + typeof(string), + propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + roleId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userId, roleId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { roleId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, + 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("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserRoles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs new file mode 100644 index 00000000..b4e36069 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs @@ -0,0 +1,89 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserTokenEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserToken", + typeof(IdentityUserToken), + baseEntityType); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var loginProvider = runtimeEntityType.AddProperty( + "LoginProvider", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var value = runtimeEntityType.AddProperty( + "Value", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + value.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userId, loginProvider, name }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserTokens"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/KeyEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/KeyEntityType.cs new file mode 100644 index 00000000..8743240a --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/KeyEntityType.cs @@ -0,0 +1,153 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class KeyEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.Key", + typeof(Key), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var algorithm = runtimeEntityType.AddProperty( + "Algorithm", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + algorithm.TypeMapping = SqliteStringTypeMapping.Default; + + var created = runtimeEntityType.AddProperty( + "Created", + typeof(DateTime), + propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + created.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var dataProtected = runtimeEntityType.AddProperty( + "DataProtected", + typeof(bool), + propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + dataProtected.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var isX509Certificate = runtimeEntityType.AddProperty( + "IsX509Certificate", + typeof(bool), + propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + isX509Certificate.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var use = runtimeEntityType.AddProperty( + "Use", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + use.TypeMapping = SqliteStringTypeMapping.Default; + + var version = runtimeEntityType.AddProperty( + "Version", + typeof(int), + propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + version.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { use }); + + return runtimeEntityType; + } + + 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", "Keys"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs new file mode 100644 index 00000000..657b8093 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs @@ -0,0 +1,130 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class LatLongEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.LatLong", + typeof(LatLong), + baseEntityType); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var latitude = runtimeEntityType.AddProperty( + "Latitude", + typeof(double), + propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + latitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); + + var longitude = runtimeEntityType.AddProperty( + "Longitude", + typeof(double), + propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + longitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); + + var key = runtimeEntityType.AddKey( + new[] { orderId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true, + ownership: true); + + var deliveryLocation = principalEntityType.AddNavigation("DeliveryLocation", + runtimeForeignKey, + onDependent: false, + typeof(LatLong), + propertyInfo: typeof(Order).GetProperty("DeliveryLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + eagerLoaded: 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", "Orders"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs new file mode 100644 index 00000000..891722a1 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs @@ -0,0 +1,99 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class NotificationSubscriptionEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.NotificationSubscription", + typeof(NotificationSubscription), + baseEntityType); + + var notificationSubscriptionId = runtimeEntityType.AddProperty( + "NotificationSubscriptionId", + typeof(int?), + propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw); + notificationSubscriptionId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + keyComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + providerValueComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var auth = runtimeEntityType.AddProperty( + "Auth", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + auth.TypeMapping = SqliteStringTypeMapping.Default; + + var p256dh = runtimeEntityType.AddProperty( + "P256dh", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + p256dh.TypeMapping = SqliteStringTypeMapping.Default; + + var url = runtimeEntityType.AddProperty( + "Url", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + url.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { notificationSubscriptionId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "NotificationSubscriptions"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/OrderEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/OrderEntityType.cs new file mode 100644 index 00000000..bf1e5171 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/OrderEntityType.cs @@ -0,0 +1,126 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class OrderEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Order", + typeof(Order), + baseEntityType); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var createdTime = runtimeEntityType.AddProperty( + "CreatedTime", + typeof(DateTime), + propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + createdTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var deliveryAddressId = runtimeEntityType.AddProperty( + "DeliveryAddressId", + typeof(int), + sentinel: 0); + deliveryAddressId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { orderId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { deliveryAddressId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", + runtimeForeignKey, + onDependent: true, + typeof(Address), + propertyInfo: typeof(Order).GetProperty("DeliveryAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("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", "Orders"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs new file mode 100644 index 00000000..c57731dd --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs @@ -0,0 +1,139 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PersistedGrantEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + typeof(PersistedGrant), + baseEntityType); + + var key = runtimeEntityType.AddProperty( + "Key", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Key", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 200); + key.TypeMapping = SqliteStringTypeMapping.Default; + + var clientId = runtimeEntityType.AddProperty( + "ClientId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; + + var consumedTime = runtimeEntityType.AddProperty( + "ConsumedTime", + typeof(DateTime?), + propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + consumedTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var creationTime = runtimeEntityType.AddProperty( + "CreationTime", + typeof(DateTime), + propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var expiration = runtimeEntityType.AddProperty( + "Expiration", + typeof(DateTime?), + propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var sessionId = runtimeEntityType.AddProperty( + "SessionId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; + + var subjectId = runtimeEntityType.AddProperty( + "SubjectId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; + + var type = runtimeEntityType.AddProperty( + "Type", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + type.TypeMapping = SqliteStringTypeMapping.Default; + + var key0 = runtimeEntityType.AddKey( + new[] { key }); + runtimeEntityType.SetPrimaryKey(key0); + + var index = runtimeEntityType.AddIndex( + new[] { consumedTime }); + + var index0 = runtimeEntityType.AddIndex( + new[] { expiration }); + + var index1 = runtimeEntityType.AddIndex( + new[] { subjectId, clientId, type }); + + var index2 = runtimeEntityType.AddIndex( + new[] { subjectId, sessionId, type }); + + return runtimeEntityType; + } + + 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", "PersistedGrants"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs new file mode 100644 index 00000000..f8ac05e4 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs @@ -0,0 +1,177 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Pizza", + typeof(Pizza), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var size = runtimeEntityType.AddProperty( + "Size", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + size.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var specialId = runtimeEntityType.AddProperty( + "SpecialId", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + specialId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { orderId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { specialId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var pizzas = principalEntityType.AddNavigation("Pizzas", + runtimeForeignKey, + onDependent: false, + typeof(List), + propertyInfo: typeof(Order).GetProperty("Pizzas", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SpecialId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var special = declaringEntityType.AddNavigation("Special", + runtimeForeignKey, + onDependent: true, + typeof(PizzaSpecial), + propertyInfo: typeof(Pizza).GetProperty("Special", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("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", "Pizzas"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs new file mode 100644 index 00000000..693286c8 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs @@ -0,0 +1,97 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaSpecialEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.PizzaSpecial", + typeof(PizzaSpecial), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var basePrice = runtimeEntityType.AddProperty( + "BasePrice", + typeof(decimal), + propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + basePrice.TypeMapping = SqliteDecimalTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var imageUrl = runtimeEntityType.AddProperty( + "ImageUrl", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + imageUrl.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Specials"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs new file mode 100644 index 00000000..b7e36125 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs @@ -0,0 +1,47 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + [DbContext(typeof(PizzaStoreContext))] + public partial class PizzaStoreContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static PizzaStoreContextModel() + { + var model = new PizzaStoreContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = model; + } + + private static PizzaStoreContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs new file mode 100644 index 00000000..0f8d07cb --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs @@ -0,0 +1,1619 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + public partial class PizzaStoreContextModel + { + partial void Initialize() + { + var address = AddressEntityType.Create(this); + var latLong = LatLongEntityType.Create(this); + var notificationSubscription = NotificationSubscriptionEntityType.Create(this); + var order = OrderEntityType.Create(this); + var pizza = PizzaEntityType.Create(this); + var pizzaSpecial = PizzaSpecialEntityType.Create(this); + var pizzaTopping = PizzaToppingEntityType.Create(this); + var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); + var topping = ToppingEntityType.Create(this); + var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); + var key = KeyEntityType.Create(this); + var persistedGrant = PersistedGrantEntityType.Create(this); + var identityRole = IdentityRoleEntityType.Create(this); + var identityRoleClaim = IdentityRoleClaimEntityType.Create(this); + var identityUserClaim = IdentityUserClaimEntityType.Create(this); + var identityUserLogin = IdentityUserLoginEntityType.Create(this); + var identityUserRole = IdentityUserRoleEntityType.Create(this); + var identityUserToken = IdentityUserTokenEntityType.Create(this); + + LatLongEntityType.CreateForeignKey1(latLong, order); + OrderEntityType.CreateForeignKey1(order, address); + PizzaEntityType.CreateForeignKey1(pizza, order); + PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); + PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); + PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); + IdentityRoleClaimEntityType.CreateForeignKey1(identityRoleClaim, identityRole); + IdentityUserClaimEntityType.CreateForeignKey1(identityUserClaim, pizzaStoreUser); + IdentityUserLoginEntityType.CreateForeignKey1(identityUserLogin, pizzaStoreUser); + IdentityUserRoleEntityType.CreateForeignKey1(identityUserRole, identityRole); + IdentityUserRoleEntityType.CreateForeignKey2(identityUserRole, pizzaStoreUser); + IdentityUserTokenEntityType.CreateForeignKey1(identityUserToken, pizzaStoreUser); + + AddressEntityType.CreateAnnotations(address); + LatLongEntityType.CreateAnnotations(latLong); + NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); + OrderEntityType.CreateAnnotations(order); + PizzaEntityType.CreateAnnotations(pizza); + PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); + PizzaToppingEntityType.CreateAnnotations(pizzaTopping); + PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); + ToppingEntityType.CreateAnnotations(topping); + DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); + KeyEntityType.CreateAnnotations(key); + PersistedGrantEntityType.CreateAnnotations(persistedGrant); + IdentityRoleEntityType.CreateAnnotations(identityRole); + IdentityRoleClaimEntityType.CreateAnnotations(identityRoleClaim); + IdentityUserClaimEntityType.CreateAnnotations(identityUserClaim); + IdentityUserLoginEntityType.CreateAnnotations(identityUserLogin); + IdentityUserRoleEntityType.CreateAnnotations(identityUserRole); + IdentityUserTokenEntityType.CreateAnnotations(identityUserToken); + + AddAnnotation("ProductVersion", "8.0.0"); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var address = FindEntityType("BlazingPizza.Address")!; + + var defaultTableMappings = new List>(); + address.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var blazingPizzaAddressTableBase = new TableBase("BlazingPizza.Address", null, relationalModel); + var cityColumnBase = new ColumnBase("City", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("City", cityColumnBase); + var idColumnBase = new ColumnBase("Id", "INTEGER", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Id", idColumnBase); + var line1ColumnBase = new ColumnBase("Line1", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line1", line1ColumnBase); + var line2ColumnBase = new ColumnBase("Line2", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line2", line2ColumnBase); + var nameColumnBase = new ColumnBase("Name", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Name", nameColumnBase); + var postalCodeColumnBase = new ColumnBase("PostalCode", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("PostalCode", postalCodeColumnBase); + var regionColumnBase = new ColumnBase("Region", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Region", regionColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Address", blazingPizzaAddressTableBase); + var blazingPizzaAddressMappingBase = new TableMappingBase(address, blazingPizzaAddressTableBase, true); + blazingPizzaAddressTableBase.AddTypeMapping(blazingPizzaAddressMappingBase, false); + defaultTableMappings.Add(blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, address.FindProperty("Id")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)cityColumnBase, address.FindProperty("City")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line1ColumnBase, address.FindProperty("Line1")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line2ColumnBase, address.FindProperty("Line2")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase, address.FindProperty("Name")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)postalCodeColumnBase, address.FindProperty("PostalCode")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)regionColumnBase, address.FindProperty("Region")!, blazingPizzaAddressMappingBase); + + var tableMappings = new List(); + address.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var addressTable = new Table("Address", null, relationalModel); + var idColumn = new Column("Id", "INTEGER", addressTable); + addressTable.Columns.Add("Id", idColumn); + var cityColumn = new Column("City", "TEXT", addressTable); + addressTable.Columns.Add("City", cityColumn); + var line1Column = new Column("Line1", "TEXT", addressTable); + addressTable.Columns.Add("Line1", line1Column); + var line2Column = new Column("Line2", "TEXT", addressTable); + addressTable.Columns.Add("Line2", line2Column); + var nameColumn = new Column("Name", "TEXT", addressTable); + addressTable.Columns.Add("Name", nameColumn); + var postalCodeColumn = new Column("PostalCode", "TEXT", addressTable); + addressTable.Columns.Add("PostalCode", postalCodeColumn); + var regionColumn = new Column("Region", "TEXT", addressTable); + addressTable.Columns.Add("Region", regionColumn); + var pK_Address = new UniqueConstraint("PK_Address", addressTable, new[] { idColumn }); + addressTable.PrimaryKey = pK_Address; + var pK_AddressUc = RelationalModel.GetKey(this, + "BlazingPizza.Address", + new[] { "Id" }); + pK_Address.MappedKeys.Add(pK_AddressUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AddressUc).Add(pK_Address); + addressTable.UniqueConstraints.Add("PK_Address", pK_Address); + relationalModel.Tables.Add(("Address", null), addressTable); + var addressTableMapping = new TableMapping(address, addressTable, true); + addressTable.AddTypeMapping(addressTableMapping, false); + tableMappings.Add(addressTableMapping); + RelationalModel.CreateColumnMapping(idColumn, address.FindProperty("Id")!, addressTableMapping); + RelationalModel.CreateColumnMapping(cityColumn, address.FindProperty("City")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line1Column, address.FindProperty("Line1")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line2Column, address.FindProperty("Line2")!, addressTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, address.FindProperty("Name")!, addressTableMapping); + RelationalModel.CreateColumnMapping(postalCodeColumn, address.FindProperty("PostalCode")!, addressTableMapping); + RelationalModel.CreateColumnMapping(regionColumn, address.FindProperty("Region")!, addressTableMapping); + + var latLong = FindEntityType("BlazingPizza.LatLong")!; + + var defaultTableMappings0 = new List>(); + latLong.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var blazingPizzaLatLongTableBase = new TableBase("BlazingPizza.LatLong", null, relationalModel); + var latitudeColumnBase = new ColumnBase("Latitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Latitude", latitudeColumnBase); + var longitudeColumnBase = new ColumnBase("Longitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Longitude", longitudeColumnBase); + var orderIdColumnBase = new ColumnBase("OrderId", "INTEGER", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("OrderId", orderIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.LatLong", blazingPizzaLatLongTableBase); + var blazingPizzaLatLongMappingBase = new TableMappingBase(latLong, blazingPizzaLatLongTableBase, true); + blazingPizzaLatLongTableBase.AddTypeMapping(blazingPizzaLatLongMappingBase, false); + defaultTableMappings0.Add(blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase, latLong.FindProperty("OrderId")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)latitudeColumnBase, latLong.FindProperty("Latitude")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)longitudeColumnBase, latLong.FindProperty("Longitude")!, blazingPizzaLatLongMappingBase); + + var tableMappings0 = new List(); + latLong.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var ordersTable = new Table("Orders", null, relationalModel); + var orderIdColumn = new Column("OrderId", "INTEGER", ordersTable); + ordersTable.Columns.Add("OrderId", orderIdColumn); + var createdTimeColumn = new Column("CreatedTime", "TEXT", ordersTable); + ordersTable.Columns.Add("CreatedTime", createdTimeColumn); + var deliveryAddressIdColumn = new Column("DeliveryAddressId", "INTEGER", ordersTable); + ordersTable.Columns.Add("DeliveryAddressId", deliveryAddressIdColumn); + var deliveryLocation_LatitudeColumn = new Column("DeliveryLocation_Latitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Latitude", deliveryLocation_LatitudeColumn); + var deliveryLocation_LongitudeColumn = new Column("DeliveryLocation_Longitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Longitude", deliveryLocation_LongitudeColumn); + var userIdColumn = new Column("UserId", "TEXT", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("UserId", userIdColumn); + var pK_Orders = new UniqueConstraint("PK_Orders", ordersTable, new[] { orderIdColumn }); + ordersTable.PrimaryKey = pK_Orders; + var pK_OrdersUc = RelationalModel.GetKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc).Add(pK_Orders); + var pK_OrdersUc0 = RelationalModel.GetKey(this, + "BlazingPizza.Order", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc0); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc0).Add(pK_Orders); + ordersTable.UniqueConstraints.Add("PK_Orders", pK_Orders); + var iX_Orders_DeliveryAddressId = new TableIndex( + "IX_Orders_DeliveryAddressId", ordersTable, new[] { deliveryAddressIdColumn }, false); + var iX_Orders_DeliveryAddressIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }); + iX_Orders_DeliveryAddressId.MappedIndexes.Add(iX_Orders_DeliveryAddressIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Orders_DeliveryAddressIdIx).Add(iX_Orders_DeliveryAddressId); + ordersTable.Indexes.Add("IX_Orders_DeliveryAddressId", iX_Orders_DeliveryAddressId); + relationalModel.Tables.Add(("Orders", null), ordersTable); + var ordersTableMapping = new TableMapping(latLong, ordersTable, true) + { + IsSharedTablePrincipal = false, + }; + ordersTable.AddTypeMapping(ordersTableMapping, true); + tableMappings0.Add(ordersTableMapping); + ordersTable.AddRowInternalForeignKey(latLong, RelationalModel.GetForeignKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" })); + RelationalModel.CreateColumnMapping(orderIdColumn, latLong.FindProperty("OrderId")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LatitudeColumn, latLong.FindProperty("Latitude")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LongitudeColumn, latLong.FindProperty("Longitude")!, ordersTableMapping); + + var notificationSubscription = FindEntityType("BlazingPizza.NotificationSubscription")!; + + var defaultTableMappings1 = new List>(); + notificationSubscription.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var blazingPizzaNotificationSubscriptionTableBase = new TableBase("BlazingPizza.NotificationSubscription", null, relationalModel); + var authColumnBase = new ColumnBase("Auth", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Auth", authColumnBase); + var notificationSubscriptionIdColumnBase = new ColumnBase("NotificationSubscriptionId", "INTEGER", blazingPizzaNotificationSubscriptionTableBase); + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumnBase); + var p256dhColumnBase = new ColumnBase("P256dh", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("P256dh", p256dhColumnBase); + var urlColumnBase = new ColumnBase("Url", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Url", urlColumnBase); + var userIdColumnBase = new ColumnBase("UserId", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("UserId", userIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.NotificationSubscription", blazingPizzaNotificationSubscriptionTableBase); + var blazingPizzaNotificationSubscriptionMappingBase = new TableMappingBase(notificationSubscription, blazingPizzaNotificationSubscriptionTableBase, true); + blazingPizzaNotificationSubscriptionTableBase.AddTypeMapping(blazingPizzaNotificationSubscriptionMappingBase, false); + defaultTableMappings1.Add(blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)notificationSubscriptionIdColumnBase, notificationSubscription.FindProperty("NotificationSubscriptionId")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)authColumnBase, notificationSubscription.FindProperty("Auth")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)p256dhColumnBase, notificationSubscription.FindProperty("P256dh")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)urlColumnBase, notificationSubscription.FindProperty("Url")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase, notificationSubscription.FindProperty("UserId")!, blazingPizzaNotificationSubscriptionMappingBase); + + var tableMappings1 = new List(); + notificationSubscription.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var notificationSubscriptionsTable = new Table("NotificationSubscriptions", null, relationalModel); + var notificationSubscriptionIdColumn = new Column("NotificationSubscriptionId", "INTEGER", notificationSubscriptionsTable); + notificationSubscriptionsTable.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumn); + var authColumn = new Column("Auth", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Auth", authColumn); + var p256dhColumn = new Column("P256dh", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("P256dh", p256dhColumn); + var urlColumn = new Column("Url", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Url", urlColumn); + var userIdColumn0 = new Column("UserId", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("UserId", userIdColumn0); + var pK_NotificationSubscriptions = new UniqueConstraint("PK_NotificationSubscriptions", notificationSubscriptionsTable, new[] { notificationSubscriptionIdColumn }); + notificationSubscriptionsTable.PrimaryKey = pK_NotificationSubscriptions; + var pK_NotificationSubscriptionsUc = RelationalModel.GetKey(this, + "BlazingPizza.NotificationSubscription", + new[] { "NotificationSubscriptionId" }); + pK_NotificationSubscriptions.MappedKeys.Add(pK_NotificationSubscriptionsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_NotificationSubscriptionsUc).Add(pK_NotificationSubscriptions); + notificationSubscriptionsTable.UniqueConstraints.Add("PK_NotificationSubscriptions", pK_NotificationSubscriptions); + relationalModel.Tables.Add(("NotificationSubscriptions", null), notificationSubscriptionsTable); + var notificationSubscriptionsTableMapping = new TableMapping(notificationSubscription, notificationSubscriptionsTable, true); + notificationSubscriptionsTable.AddTypeMapping(notificationSubscriptionsTableMapping, false); + tableMappings1.Add(notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(notificationSubscriptionIdColumn, notificationSubscription.FindProperty("NotificationSubscriptionId")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(authColumn, notificationSubscription.FindProperty("Auth")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(p256dhColumn, notificationSubscription.FindProperty("P256dh")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(urlColumn, notificationSubscription.FindProperty("Url")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn0, notificationSubscription.FindProperty("UserId")!, notificationSubscriptionsTableMapping); + + var order = FindEntityType("BlazingPizza.Order")!; + + var defaultTableMappings2 = new List>(); + order.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings2); + var blazingPizzaOrderTableBase = new TableBase("BlazingPizza.Order", null, relationalModel); + var createdTimeColumnBase = new ColumnBase("CreatedTime", "TEXT", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("CreatedTime", createdTimeColumnBase); + var deliveryAddressIdColumnBase = new ColumnBase("DeliveryAddressId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("DeliveryAddressId", deliveryAddressIdColumnBase); + var orderIdColumnBase0 = new ColumnBase("OrderId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("OrderId", orderIdColumnBase0); + var userIdColumnBase0 = new ColumnBase("UserId", "TEXT", blazingPizzaOrderTableBase) + { + IsNullable = true + }; + blazingPizzaOrderTableBase.Columns.Add("UserId", userIdColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.Order", blazingPizzaOrderTableBase); + var blazingPizzaOrderMappingBase = new TableMappingBase(order, blazingPizzaOrderTableBase, true); + blazingPizzaOrderTableBase.AddTypeMapping(blazingPizzaOrderMappingBase, false); + defaultTableMappings2.Add(blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase0, order.FindProperty("OrderId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdTimeColumnBase, order.FindProperty("CreatedTime")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deliveryAddressIdColumnBase, order.FindProperty("DeliveryAddressId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase0, order.FindProperty("UserId")!, blazingPizzaOrderMappingBase); + + var tableMappings2 = new List(); + order.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); + var ordersTableMapping0 = new TableMapping(order, ordersTable, true) + { + IsSharedTablePrincipal = true, + }; + ordersTable.AddTypeMapping(ordersTableMapping0, false); + tableMappings2.Add(ordersTableMapping0); + RelationalModel.CreateColumnMapping(orderIdColumn, order.FindProperty("OrderId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(createdTimeColumn, order.FindProperty("CreatedTime")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(deliveryAddressIdColumn, order.FindProperty("DeliveryAddressId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(userIdColumn, order.FindProperty("UserId")!, ordersTableMapping0); + + var pizza = FindEntityType("BlazingPizza.Pizza")!; + + var defaultTableMappings3 = new List>(); + pizza.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings3); + var blazingPizzaPizzaTableBase = new TableBase("BlazingPizza.Pizza", null, relationalModel); + var idColumnBase0 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Id", idColumnBase0); + var orderIdColumnBase1 = new ColumnBase("OrderId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("OrderId", orderIdColumnBase1); + var sizeColumnBase = new ColumnBase("Size", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Size", sizeColumnBase); + var specialIdColumnBase = new ColumnBase("SpecialId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("SpecialId", specialIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Pizza", blazingPizzaPizzaTableBase); + var blazingPizzaPizzaMappingBase = new TableMappingBase(pizza, blazingPizzaPizzaTableBase, true); + blazingPizzaPizzaTableBase.AddTypeMapping(blazingPizzaPizzaMappingBase, false); + defaultTableMappings3.Add(blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, pizza.FindProperty("Id")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase1, pizza.FindProperty("OrderId")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sizeColumnBase, pizza.FindProperty("Size")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)specialIdColumnBase, pizza.FindProperty("SpecialId")!, blazingPizzaPizzaMappingBase); + + var tableMappings3 = new List(); + pizza.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); + var pizzasTable = new Table("Pizzas", null, relationalModel); + var idColumn0 = new Column("Id", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Id", idColumn0); + var orderIdColumn0 = new Column("OrderId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("OrderId", orderIdColumn0); + var sizeColumn = new Column("Size", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Size", sizeColumn); + var specialIdColumn = new Column("SpecialId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("SpecialId", specialIdColumn); + var pK_Pizzas = new UniqueConstraint("PK_Pizzas", pizzasTable, new[] { idColumn0 }); + pizzasTable.PrimaryKey = pK_Pizzas; + var pK_PizzasUc = RelationalModel.GetKey(this, + "BlazingPizza.Pizza", + new[] { "Id" }); + pK_Pizzas.MappedKeys.Add(pK_PizzasUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzasUc).Add(pK_Pizzas); + pizzasTable.UniqueConstraints.Add("PK_Pizzas", pK_Pizzas); + var iX_Pizzas_OrderId = new TableIndex( + "IX_Pizzas_OrderId", pizzasTable, new[] { orderIdColumn0 }, false); + var iX_Pizzas_OrderIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }); + iX_Pizzas_OrderId.MappedIndexes.Add(iX_Pizzas_OrderIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_OrderIdIx).Add(iX_Pizzas_OrderId); + pizzasTable.Indexes.Add("IX_Pizzas_OrderId", iX_Pizzas_OrderId); + var iX_Pizzas_SpecialId = new TableIndex( + "IX_Pizzas_SpecialId", pizzasTable, new[] { specialIdColumn }, false); + var iX_Pizzas_SpecialIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }); + iX_Pizzas_SpecialId.MappedIndexes.Add(iX_Pizzas_SpecialIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_SpecialIdIx).Add(iX_Pizzas_SpecialId); + pizzasTable.Indexes.Add("IX_Pizzas_SpecialId", iX_Pizzas_SpecialId); + relationalModel.Tables.Add(("Pizzas", null), pizzasTable); + var pizzasTableMapping = new TableMapping(pizza, pizzasTable, true); + pizzasTable.AddTypeMapping(pizzasTableMapping, false); + tableMappings3.Add(pizzasTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, pizza.FindProperty("Id")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(orderIdColumn0, pizza.FindProperty("OrderId")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(sizeColumn, pizza.FindProperty("Size")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(specialIdColumn, pizza.FindProperty("SpecialId")!, pizzasTableMapping); + + var pizzaSpecial = FindEntityType("BlazingPizza.PizzaSpecial")!; + + var defaultTableMappings4 = new List>(); + pizzaSpecial.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); + var blazingPizzaPizzaSpecialTableBase = new TableBase("BlazingPizza.PizzaSpecial", null, relationalModel); + var basePriceColumnBase = new ColumnBase("BasePrice", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("BasePrice", basePriceColumnBase); + var descriptionColumnBase = new ColumnBase("Description", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Description", descriptionColumnBase); + var idColumnBase1 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Id", idColumnBase1); + var imageUrlColumnBase = new ColumnBase("ImageUrl", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("ImageUrl", imageUrlColumnBase); + var nameColumnBase0 = new ColumnBase("Name", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Name", nameColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaSpecial", blazingPizzaPizzaSpecialTableBase); + var blazingPizzaPizzaSpecialMappingBase = new TableMappingBase(pizzaSpecial, blazingPizzaPizzaSpecialTableBase, true); + blazingPizzaPizzaSpecialTableBase.AddTypeMapping(blazingPizzaPizzaSpecialMappingBase, false); + defaultTableMappings4.Add(blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, pizzaSpecial.FindProperty("Id")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)basePriceColumnBase, pizzaSpecial.FindProperty("BasePrice")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase, pizzaSpecial.FindProperty("Description")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)imageUrlColumnBase, pizzaSpecial.FindProperty("ImageUrl")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase0, pizzaSpecial.FindProperty("Name")!, blazingPizzaPizzaSpecialMappingBase); + + var tableMappings4 = new List(); + pizzaSpecial.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); + var specialsTable = new Table("Specials", null, relationalModel); + var idColumn1 = new Column("Id", "INTEGER", specialsTable); + specialsTable.Columns.Add("Id", idColumn1); + var basePriceColumn = new Column("BasePrice", "TEXT", specialsTable); + specialsTable.Columns.Add("BasePrice", basePriceColumn); + var descriptionColumn = new Column("Description", "TEXT", specialsTable); + specialsTable.Columns.Add("Description", descriptionColumn); + var imageUrlColumn = new Column("ImageUrl", "TEXT", specialsTable); + specialsTable.Columns.Add("ImageUrl", imageUrlColumn); + var nameColumn0 = new Column("Name", "TEXT", specialsTable); + specialsTable.Columns.Add("Name", nameColumn0); + var pK_Specials = new UniqueConstraint("PK_Specials", specialsTable, new[] { idColumn1 }); + specialsTable.PrimaryKey = pK_Specials; + var pK_SpecialsUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + pK_Specials.MappedKeys.Add(pK_SpecialsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_SpecialsUc).Add(pK_Specials); + specialsTable.UniqueConstraints.Add("PK_Specials", pK_Specials); + relationalModel.Tables.Add(("Specials", null), specialsTable); + var specialsTableMapping = new TableMapping(pizzaSpecial, specialsTable, true); + specialsTable.AddTypeMapping(specialsTableMapping, false); + tableMappings4.Add(specialsTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, pizzaSpecial.FindProperty("Id")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(basePriceColumn, pizzaSpecial.FindProperty("BasePrice")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn, pizzaSpecial.FindProperty("Description")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(imageUrlColumn, pizzaSpecial.FindProperty("ImageUrl")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn0, pizzaSpecial.FindProperty("Name")!, specialsTableMapping); + + var pizzaTopping = FindEntityType("BlazingPizza.PizzaTopping")!; + + var defaultTableMappings5 = new List>(); + pizzaTopping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings5); + var blazingPizzaPizzaToppingTableBase = new TableBase("BlazingPizza.PizzaTopping", null, relationalModel); + var pizzaIdColumnBase = new ColumnBase("PizzaId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("PizzaId", pizzaIdColumnBase); + var toppingIdColumnBase = new ColumnBase("ToppingId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("ToppingId", toppingIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaTopping", blazingPizzaPizzaToppingTableBase); + var blazingPizzaPizzaToppingMappingBase = new TableMappingBase(pizzaTopping, blazingPizzaPizzaToppingTableBase, true); + blazingPizzaPizzaToppingTableBase.AddTypeMapping(blazingPizzaPizzaToppingMappingBase, false); + defaultTableMappings5.Add(blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pizzaIdColumnBase, pizzaTopping.FindProperty("PizzaId")!, blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)toppingIdColumnBase, pizzaTopping.FindProperty("ToppingId")!, blazingPizzaPizzaToppingMappingBase); + + var tableMappings5 = new List(); + pizzaTopping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); + var pizzaToppingTable = new Table("PizzaTopping", null, relationalModel); + var pizzaIdColumn = new Column("PizzaId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("PizzaId", pizzaIdColumn); + var toppingIdColumn = new Column("ToppingId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("ToppingId", toppingIdColumn); + var pK_PizzaTopping = new UniqueConstraint("PK_PizzaTopping", pizzaToppingTable, new[] { pizzaIdColumn, toppingIdColumn }); + pizzaToppingTable.PrimaryKey = pK_PizzaTopping; + var pK_PizzaToppingUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId", "ToppingId" }); + pK_PizzaTopping.MappedKeys.Add(pK_PizzaToppingUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzaToppingUc).Add(pK_PizzaTopping); + pizzaToppingTable.UniqueConstraints.Add("PK_PizzaTopping", pK_PizzaTopping); + var iX_PizzaTopping_ToppingId = new TableIndex( + "IX_PizzaTopping_ToppingId", pizzaToppingTable, new[] { toppingIdColumn }, false); + var iX_PizzaTopping_ToppingIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }); + iX_PizzaTopping_ToppingId.MappedIndexes.Add(iX_PizzaTopping_ToppingIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PizzaTopping_ToppingIdIx).Add(iX_PizzaTopping_ToppingId); + pizzaToppingTable.Indexes.Add("IX_PizzaTopping_ToppingId", iX_PizzaTopping_ToppingId); + relationalModel.Tables.Add(("PizzaTopping", null), pizzaToppingTable); + var pizzaToppingTableMapping = new TableMapping(pizzaTopping, pizzaToppingTable, true); + pizzaToppingTable.AddTypeMapping(pizzaToppingTableMapping, false); + tableMappings5.Add(pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(pizzaIdColumn, pizzaTopping.FindProperty("PizzaId")!, pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(toppingIdColumn, pizzaTopping.FindProperty("ToppingId")!, pizzaToppingTableMapping); + + var pizzaStoreUser = FindEntityType("BlazingPizza.Server.PizzaStoreUser")!; + + var defaultTableMappings6 = new List>(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings6); + var blazingPizzaServerPizzaStoreUserTableBase = new TableBase("BlazingPizza.Server.PizzaStoreUser", null, relationalModel); + var accessFailedCountColumnBase = new ColumnBase("AccessFailedCount", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("AccessFailedCount", accessFailedCountColumnBase); + var concurrencyStampColumnBase = new ColumnBase("ConcurrencyStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase); + var emailColumnBase = new ColumnBase("Email", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Email", emailColumnBase); + var emailConfirmedColumnBase = new ColumnBase("EmailConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("EmailConfirmed", emailConfirmedColumnBase); + var idColumnBase2 = new ColumnBase("Id", "TEXT", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Id", idColumnBase2); + var lockoutEnabledColumnBase = new ColumnBase("LockoutEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnabled", lockoutEnabledColumnBase); + var lockoutEndColumnBase = new ColumnBase("LockoutEnd", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnd", lockoutEndColumnBase); + var normalizedEmailColumnBase = new ColumnBase("NormalizedEmail", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedEmail", normalizedEmailColumnBase); + var normalizedUserNameColumnBase = new ColumnBase("NormalizedUserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedUserName", normalizedUserNameColumnBase); + var passwordHashColumnBase = new ColumnBase("PasswordHash", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PasswordHash", passwordHashColumnBase); + var phoneNumberColumnBase = new ColumnBase("PhoneNumber", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumber", phoneNumberColumnBase); + var phoneNumberConfirmedColumnBase = new ColumnBase("PhoneNumberConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumnBase); + var securityStampColumnBase = new ColumnBase("SecurityStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("SecurityStamp", securityStampColumnBase); + var twoFactorEnabledColumnBase = new ColumnBase("TwoFactorEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumnBase); + var userNameColumnBase = new ColumnBase("UserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("UserName", userNameColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Server.PizzaStoreUser", blazingPizzaServerPizzaStoreUserTableBase); + var blazingPizzaServerPizzaStoreUserMappingBase = new TableMappingBase(pizzaStoreUser, blazingPizzaServerPizzaStoreUserTableBase, true); + blazingPizzaServerPizzaStoreUserTableBase.AddTypeMapping(blazingPizzaServerPizzaStoreUserMappingBase, false); + defaultTableMappings6.Add(blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, pizzaStoreUser.FindProperty("Id")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)accessFailedCountColumnBase, pizzaStoreUser.FindProperty("AccessFailedCount")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailColumnBase, pizzaStoreUser.FindProperty("Email")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailConfirmedColumnBase, pizzaStoreUser.FindProperty("EmailConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEnabledColumnBase, pizzaStoreUser.FindProperty("LockoutEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEndColumnBase, pizzaStoreUser.FindProperty("LockoutEnd")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedEmailColumnBase, pizzaStoreUser.FindProperty("NormalizedEmail")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedUserNameColumnBase, pizzaStoreUser.FindProperty("NormalizedUserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)passwordHashColumnBase, pizzaStoreUser.FindProperty("PasswordHash")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberColumnBase, pizzaStoreUser.FindProperty("PhoneNumber")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberConfirmedColumnBase, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)securityStampColumnBase, pizzaStoreUser.FindProperty("SecurityStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)twoFactorEnabledColumnBase, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userNameColumnBase, pizzaStoreUser.FindProperty("UserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + + var tableMappings6 = new List(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:TableMappings", tableMappings6); + var aspNetUsersTable = new Table("AspNetUsers", null, relationalModel); + var idColumn2 = new Column("Id", "TEXT", aspNetUsersTable); + aspNetUsersTable.Columns.Add("Id", idColumn2); + var accessFailedCountColumn = new Column("AccessFailedCount", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("AccessFailedCount", accessFailedCountColumn); + var concurrencyStampColumn = new Column("ConcurrencyStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn); + var emailColumn = new Column("Email", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("Email", emailColumn); + var emailConfirmedColumn = new Column("EmailConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("EmailConfirmed", emailConfirmedColumn); + var lockoutEnabledColumn = new Column("LockoutEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("LockoutEnabled", lockoutEnabledColumn); + var lockoutEndColumn = new Column("LockoutEnd", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("LockoutEnd", lockoutEndColumn); + var normalizedEmailColumn = new Column("NormalizedEmail", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedEmail", normalizedEmailColumn); + var normalizedUserNameColumn = new Column("NormalizedUserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedUserName", normalizedUserNameColumn); + var passwordHashColumn = new Column("PasswordHash", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PasswordHash", passwordHashColumn); + var phoneNumberColumn = new Column("PhoneNumber", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PhoneNumber", phoneNumberColumn); + var phoneNumberConfirmedColumn = new Column("PhoneNumberConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumn); + var securityStampColumn = new Column("SecurityStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("SecurityStamp", securityStampColumn); + var twoFactorEnabledColumn = new Column("TwoFactorEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumn); + var userNameColumn = new Column("UserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("UserName", userNameColumn); + var pK_AspNetUsers = new UniqueConstraint("PK_AspNetUsers", aspNetUsersTable, new[] { idColumn2 }); + aspNetUsersTable.PrimaryKey = pK_AspNetUsers; + var pK_AspNetUsersUc = RelationalModel.GetKey(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + pK_AspNetUsers.MappedKeys.Add(pK_AspNetUsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUsersUc).Add(pK_AspNetUsers); + aspNetUsersTable.UniqueConstraints.Add("PK_AspNetUsers", pK_AspNetUsers); + var emailIndex = new TableIndex( + "EmailIndex", aspNetUsersTable, new[] { normalizedEmailColumn }, false); + var emailIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedEmail" }); + emailIndex.MappedIndexes.Add(emailIndexIx); + RelationalModel.GetOrCreateTableIndexes(emailIndexIx).Add(emailIndex); + aspNetUsersTable.Indexes.Add("EmailIndex", emailIndex); + var userNameIndex = new TableIndex( + "UserNameIndex", aspNetUsersTable, new[] { normalizedUserNameColumn }, true); + var userNameIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedUserName" }); + userNameIndex.MappedIndexes.Add(userNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(userNameIndexIx).Add(userNameIndex); + aspNetUsersTable.Indexes.Add("UserNameIndex", userNameIndex); + relationalModel.Tables.Add(("AspNetUsers", null), aspNetUsersTable); + var aspNetUsersTableMapping = new TableMapping(pizzaStoreUser, aspNetUsersTable, true); + aspNetUsersTable.AddTypeMapping(aspNetUsersTableMapping, false); + tableMappings6.Add(aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(idColumn2, pizzaStoreUser.FindProperty("Id")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(accessFailedCountColumn, pizzaStoreUser.FindProperty("AccessFailedCount")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailColumn, pizzaStoreUser.FindProperty("Email")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailConfirmedColumn, pizzaStoreUser.FindProperty("EmailConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEnabledColumn, pizzaStoreUser.FindProperty("LockoutEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEndColumn, pizzaStoreUser.FindProperty("LockoutEnd")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedEmailColumn, pizzaStoreUser.FindProperty("NormalizedEmail")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedUserNameColumn, pizzaStoreUser.FindProperty("NormalizedUserName")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(passwordHashColumn, pizzaStoreUser.FindProperty("PasswordHash")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberColumn, pizzaStoreUser.FindProperty("PhoneNumber")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberConfirmedColumn, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(securityStampColumn, pizzaStoreUser.FindProperty("SecurityStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(twoFactorEnabledColumn, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(userNameColumn, pizzaStoreUser.FindProperty("UserName")!, aspNetUsersTableMapping); + + var topping = FindEntityType("BlazingPizza.Topping")!; + + var defaultTableMappings7 = new List>(); + topping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings7); + var blazingPizzaToppingTableBase = new TableBase("BlazingPizza.Topping", null, relationalModel); + var idColumnBase3 = new ColumnBase("Id", "INTEGER", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Id", idColumnBase3); + var nameColumnBase1 = new ColumnBase("Name", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Name", nameColumnBase1); + var priceColumnBase = new ColumnBase("Price", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Price", priceColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Topping", blazingPizzaToppingTableBase); + var blazingPizzaToppingMappingBase = new TableMappingBase(topping, blazingPizzaToppingTableBase, true); + blazingPizzaToppingTableBase.AddTypeMapping(blazingPizzaToppingMappingBase, false); + defaultTableMappings7.Add(blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase3, topping.FindProperty("Id")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase1, topping.FindProperty("Name")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)priceColumnBase, topping.FindProperty("Price")!, blazingPizzaToppingMappingBase); + + var tableMappings7 = new List(); + topping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings7); + var toppingsTable = new Table("Toppings", null, relationalModel); + var idColumn3 = new Column("Id", "INTEGER", toppingsTable); + toppingsTable.Columns.Add("Id", idColumn3); + var nameColumn1 = new Column("Name", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Name", nameColumn1); + var priceColumn = new Column("Price", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Price", priceColumn); + var pK_Toppings = new UniqueConstraint("PK_Toppings", toppingsTable, new[] { idColumn3 }); + toppingsTable.PrimaryKey = pK_Toppings; + var pK_ToppingsUc = RelationalModel.GetKey(this, + "BlazingPizza.Topping", + new[] { "Id" }); + pK_Toppings.MappedKeys.Add(pK_ToppingsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_ToppingsUc).Add(pK_Toppings); + toppingsTable.UniqueConstraints.Add("PK_Toppings", pK_Toppings); + relationalModel.Tables.Add(("Toppings", null), toppingsTable); + var toppingsTableMapping = new TableMapping(topping, toppingsTable, true); + toppingsTable.AddTypeMapping(toppingsTableMapping, false); + tableMappings7.Add(toppingsTableMapping); + RelationalModel.CreateColumnMapping(idColumn3, topping.FindProperty("Id")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn1, topping.FindProperty("Name")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(priceColumn, topping.FindProperty("Price")!, toppingsTableMapping); + + var deviceFlowCodes = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes")!; + + var defaultTableMappings8 = new List>(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings8); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", null, relationalModel); + var clientIdColumnBase = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("ClientId", clientIdColumnBase); + var creationTimeColumnBase = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("CreationTime", creationTimeColumnBase); + var dataColumnBase = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Data", dataColumnBase); + var descriptionColumnBase0 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Description", descriptionColumnBase0); + var deviceCodeColumnBase = new ColumnBase("DeviceCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("DeviceCode", deviceCodeColumnBase); + var expirationColumnBase = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Expiration", expirationColumnBase); + var sessionIdColumnBase = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SessionId", sessionIdColumnBase); + var subjectIdColumnBase = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SubjectId", subjectIdColumnBase); + var userCodeColumnBase = new ColumnBase("UserCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("UserCode", userCodeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase = new TableMappingBase(deviceFlowCodes, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase, false); + defaultTableMappings8.Add(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userCodeColumnBase, deviceFlowCodes.FindProperty("UserCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase, deviceFlowCodes.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase, deviceFlowCodes.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, deviceFlowCodes.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase0, deviceFlowCodes.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deviceCodeColumnBase, deviceFlowCodes.FindProperty("DeviceCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase, deviceFlowCodes.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase, deviceFlowCodes.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase, deviceFlowCodes.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + + var tableMappings8 = new List(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:TableMappings", tableMappings8); + var deviceCodesTable = new Table("DeviceCodes", null, relationalModel); + var userCodeColumn = new Column("UserCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("UserCode", userCodeColumn); + var clientIdColumn = new Column("ClientId", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("ClientId", clientIdColumn); + var creationTimeColumn = new Column("CreationTime", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("CreationTime", creationTimeColumn); + var dataColumn = new Column("Data", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Data", dataColumn); + var descriptionColumn0 = new Column("Description", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("Description", descriptionColumn0); + var deviceCodeColumn = new Column("DeviceCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("DeviceCode", deviceCodeColumn); + var expirationColumn = new Column("Expiration", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Expiration", expirationColumn); + var sessionIdColumn = new Column("SessionId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SessionId", sessionIdColumn); + var subjectIdColumn = new Column("SubjectId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SubjectId", subjectIdColumn); + var pK_DeviceCodes = new UniqueConstraint("PK_DeviceCodes", deviceCodesTable, new[] { userCodeColumn }); + deviceCodesTable.PrimaryKey = pK_DeviceCodes; + var pK_DeviceCodesUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "UserCode" }); + pK_DeviceCodes.MappedKeys.Add(pK_DeviceCodesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_DeviceCodesUc).Add(pK_DeviceCodes); + deviceCodesTable.UniqueConstraints.Add("PK_DeviceCodes", pK_DeviceCodes); + var iX_DeviceCodes_DeviceCode = new TableIndex( + "IX_DeviceCodes_DeviceCode", deviceCodesTable, new[] { deviceCodeColumn }, true); + var iX_DeviceCodes_DeviceCodeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "DeviceCode" }); + iX_DeviceCodes_DeviceCode.MappedIndexes.Add(iX_DeviceCodes_DeviceCodeIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_DeviceCodeIx).Add(iX_DeviceCodes_DeviceCode); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_DeviceCode", iX_DeviceCodes_DeviceCode); + var iX_DeviceCodes_Expiration = new TableIndex( + "IX_DeviceCodes_Expiration", deviceCodesTable, new[] { expirationColumn }, false); + var iX_DeviceCodes_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "Expiration" }); + iX_DeviceCodes_Expiration.MappedIndexes.Add(iX_DeviceCodes_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_ExpirationIx).Add(iX_DeviceCodes_Expiration); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_Expiration", iX_DeviceCodes_Expiration); + relationalModel.Tables.Add(("DeviceCodes", null), deviceCodesTable); + var deviceCodesTableMapping = new TableMapping(deviceFlowCodes, deviceCodesTable, true); + deviceCodesTable.AddTypeMapping(deviceCodesTableMapping, false); + tableMappings8.Add(deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(userCodeColumn, deviceFlowCodes.FindProperty("UserCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn, deviceFlowCodes.FindProperty("ClientId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn, deviceFlowCodes.FindProperty("CreationTime")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, deviceFlowCodes.FindProperty("Data")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn0, deviceFlowCodes.FindProperty("Description")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(deviceCodeColumn, deviceFlowCodes.FindProperty("DeviceCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn, deviceFlowCodes.FindProperty("Expiration")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn, deviceFlowCodes.FindProperty("SessionId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn, deviceFlowCodes.FindProperty("SubjectId")!, deviceCodesTableMapping); + + var key = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.Key")!; + + var defaultTableMappings9 = new List>(); + key.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings9); + var duendeIdentityServerEntityFrameworkEntitiesKeyTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.Key", null, relationalModel); + var algorithmColumnBase = new ColumnBase("Algorithm", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Algorithm", algorithmColumnBase); + var createdColumnBase = new ColumnBase("Created", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Created", createdColumnBase); + var dataColumnBase0 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Data", dataColumnBase0); + var dataProtectedColumnBase = new ColumnBase("DataProtected", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("DataProtected", dataProtectedColumnBase); + var idColumnBase4 = new ColumnBase("Id", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Id", idColumnBase4); + var isX509CertificateColumnBase = new ColumnBase("IsX509Certificate", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("IsX509Certificate", isX509CertificateColumnBase); + var useColumnBase = new ColumnBase("Use", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Use", useColumnBase); + var versionColumnBase = new ColumnBase("Version", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Version", versionColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.Key", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + var duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase = new TableMappingBase(key, duendeIdentityServerEntityFrameworkEntitiesKeyTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase, false); + defaultTableMappings9.Add(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase4, key.FindProperty("Id")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)algorithmColumnBase, key.FindProperty("Algorithm")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdColumnBase, key.FindProperty("Created")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase0, key.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataProtectedColumnBase, key.FindProperty("DataProtected")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)isX509CertificateColumnBase, key.FindProperty("IsX509Certificate")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)useColumnBase, key.FindProperty("Use")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)versionColumnBase, key.FindProperty("Version")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + + var tableMappings9 = new List(); + key.SetRuntimeAnnotation("Relational:TableMappings", tableMappings9); + var keysTable = new Table("Keys", null, relationalModel); + var idColumn4 = new Column("Id", "TEXT", keysTable); + keysTable.Columns.Add("Id", idColumn4); + var algorithmColumn = new Column("Algorithm", "TEXT", keysTable); + keysTable.Columns.Add("Algorithm", algorithmColumn); + var createdColumn = new Column("Created", "TEXT", keysTable); + keysTable.Columns.Add("Created", createdColumn); + var dataColumn0 = new Column("Data", "TEXT", keysTable); + keysTable.Columns.Add("Data", dataColumn0); + var dataProtectedColumn = new Column("DataProtected", "INTEGER", keysTable); + keysTable.Columns.Add("DataProtected", dataProtectedColumn); + var isX509CertificateColumn = new Column("IsX509Certificate", "INTEGER", keysTable); + keysTable.Columns.Add("IsX509Certificate", isX509CertificateColumn); + var useColumn = new Column("Use", "TEXT", keysTable) + { + IsNullable = true + }; + keysTable.Columns.Add("Use", useColumn); + var versionColumn = new Column("Version", "INTEGER", keysTable); + keysTable.Columns.Add("Version", versionColumn); + var pK_Keys = new UniqueConstraint("PK_Keys", keysTable, new[] { idColumn4 }); + keysTable.PrimaryKey = pK_Keys; + var pK_KeysUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Id" }); + pK_Keys.MappedKeys.Add(pK_KeysUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_KeysUc).Add(pK_Keys); + keysTable.UniqueConstraints.Add("PK_Keys", pK_Keys); + var iX_Keys_Use = new TableIndex( + "IX_Keys_Use", keysTable, new[] { useColumn }, false); + var iX_Keys_UseIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Use" }); + iX_Keys_Use.MappedIndexes.Add(iX_Keys_UseIx); + RelationalModel.GetOrCreateTableIndexes(iX_Keys_UseIx).Add(iX_Keys_Use); + keysTable.Indexes.Add("IX_Keys_Use", iX_Keys_Use); + relationalModel.Tables.Add(("Keys", null), keysTable); + var keysTableMapping = new TableMapping(key, keysTable, true); + keysTable.AddTypeMapping(keysTableMapping, false); + tableMappings9.Add(keysTableMapping); + RelationalModel.CreateColumnMapping(idColumn4, key.FindProperty("Id")!, keysTableMapping); + RelationalModel.CreateColumnMapping(algorithmColumn, key.FindProperty("Algorithm")!, keysTableMapping); + RelationalModel.CreateColumnMapping(createdColumn, key.FindProperty("Created")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataColumn0, key.FindProperty("Data")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataProtectedColumn, key.FindProperty("DataProtected")!, keysTableMapping); + RelationalModel.CreateColumnMapping(isX509CertificateColumn, key.FindProperty("IsX509Certificate")!, keysTableMapping); + RelationalModel.CreateColumnMapping(useColumn, key.FindProperty("Use")!, keysTableMapping); + RelationalModel.CreateColumnMapping(versionColumn, key.FindProperty("Version")!, keysTableMapping); + + var persistedGrant = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant")!; + + var defaultTableMappings10 = new List>(); + persistedGrant.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings10); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", null, relationalModel); + var clientIdColumnBase0 = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ClientId", clientIdColumnBase0); + var consumedTimeColumnBase = new ColumnBase("ConsumedTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ConsumedTime", consumedTimeColumnBase); + var creationTimeColumnBase0 = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("CreationTime", creationTimeColumnBase0); + var dataColumnBase1 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Data", dataColumnBase1); + var descriptionColumnBase1 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Description", descriptionColumnBase1); + var expirationColumnBase0 = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Expiration", expirationColumnBase0); + var keyColumnBase = new ColumnBase("Key", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Key", keyColumnBase); + var sessionIdColumnBase0 = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SessionId", sessionIdColumnBase0); + var subjectIdColumnBase0 = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SubjectId", subjectIdColumnBase0); + var typeColumnBase = new ColumnBase("Type", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Type", typeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase = new TableMappingBase(persistedGrant, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase, false); + defaultTableMappings10.Add(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)keyColumnBase, persistedGrant.FindProperty("Key")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase0, persistedGrant.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)consumedTimeColumnBase, persistedGrant.FindProperty("ConsumedTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase0, persistedGrant.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase1, persistedGrant.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase1, persistedGrant.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase0, persistedGrant.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase0, persistedGrant.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase0, persistedGrant.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)typeColumnBase, persistedGrant.FindProperty("Type")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + + var tableMappings10 = new List(); + persistedGrant.SetRuntimeAnnotation("Relational:TableMappings", tableMappings10); + var persistedGrantsTable = new Table("PersistedGrants", null, relationalModel); + var keyColumn = new Column("Key", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Key", keyColumn); + var clientIdColumn0 = new Column("ClientId", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("ClientId", clientIdColumn0); + var consumedTimeColumn = new Column("ConsumedTime", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("ConsumedTime", consumedTimeColumn); + var creationTimeColumn0 = new Column("CreationTime", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("CreationTime", creationTimeColumn0); + var dataColumn1 = new Column("Data", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Data", dataColumn1); + var descriptionColumn1 = new Column("Description", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Description", descriptionColumn1); + var expirationColumn0 = new Column("Expiration", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Expiration", expirationColumn0); + var sessionIdColumn0 = new Column("SessionId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SessionId", sessionIdColumn0); + var subjectIdColumn0 = new Column("SubjectId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SubjectId", subjectIdColumn0); + var typeColumn = new Column("Type", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Type", typeColumn); + var pK_PersistedGrants = new UniqueConstraint("PK_PersistedGrants", persistedGrantsTable, new[] { keyColumn }); + persistedGrantsTable.PrimaryKey = pK_PersistedGrants; + var pK_PersistedGrantsUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Key" }); + pK_PersistedGrants.MappedKeys.Add(pK_PersistedGrantsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PersistedGrantsUc).Add(pK_PersistedGrants); + persistedGrantsTable.UniqueConstraints.Add("PK_PersistedGrants", pK_PersistedGrants); + var iX_PersistedGrants_ConsumedTime = new TableIndex( + "IX_PersistedGrants_ConsumedTime", persistedGrantsTable, new[] { consumedTimeColumn }, false); + var iX_PersistedGrants_ConsumedTimeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "ConsumedTime" }); + iX_PersistedGrants_ConsumedTime.MappedIndexes.Add(iX_PersistedGrants_ConsumedTimeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ConsumedTimeIx).Add(iX_PersistedGrants_ConsumedTime); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_ConsumedTime", iX_PersistedGrants_ConsumedTime); + var iX_PersistedGrants_Expiration = new TableIndex( + "IX_PersistedGrants_Expiration", persistedGrantsTable, new[] { expirationColumn0 }, false); + var iX_PersistedGrants_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Expiration" }); + iX_PersistedGrants_Expiration.MappedIndexes.Add(iX_PersistedGrants_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ExpirationIx).Add(iX_PersistedGrants_Expiration); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_Expiration", iX_PersistedGrants_Expiration); + var iX_PersistedGrants_SubjectId_ClientId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_ClientId_Type", persistedGrantsTable, new[] { subjectIdColumn0, clientIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_ClientId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "ClientId", "Type" }); + iX_PersistedGrants_SubjectId_ClientId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_ClientId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_ClientId_TypeIx).Add(iX_PersistedGrants_SubjectId_ClientId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_ClientId_Type", iX_PersistedGrants_SubjectId_ClientId_Type); + var iX_PersistedGrants_SubjectId_SessionId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_SessionId_Type", persistedGrantsTable, new[] { subjectIdColumn0, sessionIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_SessionId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "SessionId", "Type" }); + iX_PersistedGrants_SubjectId_SessionId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_SessionId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_SessionId_TypeIx).Add(iX_PersistedGrants_SubjectId_SessionId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_SessionId_Type", iX_PersistedGrants_SubjectId_SessionId_Type); + relationalModel.Tables.Add(("PersistedGrants", null), persistedGrantsTable); + var persistedGrantsTableMapping = new TableMapping(persistedGrant, persistedGrantsTable, true); + persistedGrantsTable.AddTypeMapping(persistedGrantsTableMapping, false); + tableMappings10.Add(persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(keyColumn, persistedGrant.FindProperty("Key")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn0, persistedGrant.FindProperty("ClientId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(consumedTimeColumn, persistedGrant.FindProperty("ConsumedTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn0, persistedGrant.FindProperty("CreationTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(dataColumn1, persistedGrant.FindProperty("Data")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn1, persistedGrant.FindProperty("Description")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn0, persistedGrant.FindProperty("Expiration")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn0, persistedGrant.FindProperty("SessionId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn0, persistedGrant.FindProperty("SubjectId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(typeColumn, persistedGrant.FindProperty("Type")!, persistedGrantsTableMapping); + + var identityRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRole")!; + + var defaultTableMappings11 = new List>(); + identityRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings11); + var microsoftAspNetCoreIdentityIdentityRoleTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRole", null, relationalModel); + var concurrencyStampColumnBase0 = new ColumnBase("ConcurrencyStamp", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase0); + var idColumnBase5 = new ColumnBase("Id", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase); + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Id", idColumnBase5); + var nameColumnBase2 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Name", nameColumnBase2); + var normalizedNameColumnBase = new ColumnBase("NormalizedName", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("NormalizedName", normalizedNameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRole", microsoftAspNetCoreIdentityIdentityRoleTableBase); + var microsoftAspNetCoreIdentityIdentityRoleMappingBase = new TableMappingBase(identityRole, microsoftAspNetCoreIdentityIdentityRoleTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleMappingBase, false); + defaultTableMappings11.Add(microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase5, identityRole.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase0, identityRole.FindProperty("ConcurrencyStamp")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase2, identityRole.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedNameColumnBase, identityRole.FindProperty("NormalizedName")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + + var tableMappings11 = new List(); + identityRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings11); + var aspNetRolesTable = new Table("AspNetRoles", null, relationalModel); + var idColumn5 = new Column("Id", "TEXT", aspNetRolesTable); + aspNetRolesTable.Columns.Add("Id", idColumn5); + var concurrencyStampColumn0 = new Column("ConcurrencyStamp", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn0); + var nameColumn2 = new Column("Name", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("Name", nameColumn2); + var normalizedNameColumn = new Column("NormalizedName", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("NormalizedName", normalizedNameColumn); + var pK_AspNetRoles = new UniqueConstraint("PK_AspNetRoles", aspNetRolesTable, new[] { idColumn5 }); + aspNetRolesTable.PrimaryKey = pK_AspNetRoles; + var pK_AspNetRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + pK_AspNetRoles.MappedKeys.Add(pK_AspNetRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRolesUc).Add(pK_AspNetRoles); + aspNetRolesTable.UniqueConstraints.Add("PK_AspNetRoles", pK_AspNetRoles); + var roleNameIndex = new TableIndex( + "RoleNameIndex", aspNetRolesTable, new[] { normalizedNameColumn }, true); + var roleNameIndexIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "NormalizedName" }); + roleNameIndex.MappedIndexes.Add(roleNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(roleNameIndexIx).Add(roleNameIndex); + aspNetRolesTable.Indexes.Add("RoleNameIndex", roleNameIndex); + relationalModel.Tables.Add(("AspNetRoles", null), aspNetRolesTable); + var aspNetRolesTableMapping = new TableMapping(identityRole, aspNetRolesTable, true); + aspNetRolesTable.AddTypeMapping(aspNetRolesTableMapping, false); + tableMappings11.Add(aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(idColumn5, identityRole.FindProperty("Id")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn0, identityRole.FindProperty("ConcurrencyStamp")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(nameColumn2, identityRole.FindProperty("Name")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(normalizedNameColumn, identityRole.FindProperty("NormalizedName")!, aspNetRolesTableMapping); + + var identityRoleClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRoleClaim")!; + + var defaultTableMappings12 = new List>(); + identityRoleClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings12); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRoleClaim", null, relationalModel); + var claimTypeColumnBase = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase); + var claimValueColumnBase = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase); + var idColumnBase6 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("Id", idColumnBase6); + var roleIdColumnBase = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("RoleId", roleIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRoleClaim", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase = new TableMappingBase(identityRoleClaim, microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase, false); + defaultTableMappings12.Add(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase6, identityRoleClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase, identityRoleClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase, identityRoleClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase, identityRoleClaim.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + + var tableMappings12 = new List(); + identityRoleClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings12); + var aspNetRoleClaimsTable = new Table("AspNetRoleClaims", null, relationalModel); + var idColumn6 = new Column("Id", "INTEGER", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("Id", idColumn6); + var claimTypeColumn = new Column("ClaimType", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimType", claimTypeColumn); + var claimValueColumn = new Column("ClaimValue", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimValue", claimValueColumn); + var roleIdColumn = new Column("RoleId", "TEXT", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("RoleId", roleIdColumn); + var pK_AspNetRoleClaims = new UniqueConstraint("PK_AspNetRoleClaims", aspNetRoleClaimsTable, new[] { idColumn6 }); + aspNetRoleClaimsTable.PrimaryKey = pK_AspNetRoleClaims; + var pK_AspNetRoleClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "Id" }); + pK_AspNetRoleClaims.MappedKeys.Add(pK_AspNetRoleClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRoleClaimsUc).Add(pK_AspNetRoleClaims); + aspNetRoleClaimsTable.UniqueConstraints.Add("PK_AspNetRoleClaims", pK_AspNetRoleClaims); + var iX_AspNetRoleClaims_RoleId = new TableIndex( + "IX_AspNetRoleClaims_RoleId", aspNetRoleClaimsTable, new[] { roleIdColumn }, false); + var iX_AspNetRoleClaims_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }); + iX_AspNetRoleClaims_RoleId.MappedIndexes.Add(iX_AspNetRoleClaims_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetRoleClaims_RoleIdIx).Add(iX_AspNetRoleClaims_RoleId); + aspNetRoleClaimsTable.Indexes.Add("IX_AspNetRoleClaims_RoleId", iX_AspNetRoleClaims_RoleId); + relationalModel.Tables.Add(("AspNetRoleClaims", null), aspNetRoleClaimsTable); + var aspNetRoleClaimsTableMapping = new TableMapping(identityRoleClaim, aspNetRoleClaimsTable, true); + aspNetRoleClaimsTable.AddTypeMapping(aspNetRoleClaimsTableMapping, false); + tableMappings12.Add(aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn6, identityRoleClaim.FindProperty("Id")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn, identityRoleClaim.FindProperty("ClaimType")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn, identityRoleClaim.FindProperty("ClaimValue")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn, identityRoleClaim.FindProperty("RoleId")!, aspNetRoleClaimsTableMapping); + + var identityUserClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserClaim")!; + + var defaultTableMappings13 = new List>(); + identityUserClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings13); + var microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserClaim", null, relationalModel); + var claimTypeColumnBase0 = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase0); + var claimValueColumnBase0 = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase0); + var idColumnBase7 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("Id", idColumnBase7); + var userIdColumnBase1 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("UserId", userIdColumnBase1); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserClaim", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase = new TableMappingBase(identityUserClaim, microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase, false); + defaultTableMappings13.Add(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase7, identityUserClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase0, identityUserClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase0, identityUserClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase1, identityUserClaim.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + + var tableMappings13 = new List(); + identityUserClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings13); + var aspNetUserClaimsTable = new Table("AspNetUserClaims", null, relationalModel); + var idColumn7 = new Column("Id", "INTEGER", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("Id", idColumn7); + var claimTypeColumn0 = new Column("ClaimType", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimType", claimTypeColumn0); + var claimValueColumn0 = new Column("ClaimValue", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimValue", claimValueColumn0); + var userIdColumn1 = new Column("UserId", "TEXT", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("UserId", userIdColumn1); + var pK_AspNetUserClaims = new UniqueConstraint("PK_AspNetUserClaims", aspNetUserClaimsTable, new[] { idColumn7 }); + aspNetUserClaimsTable.PrimaryKey = pK_AspNetUserClaims; + var pK_AspNetUserClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "Id" }); + pK_AspNetUserClaims.MappedKeys.Add(pK_AspNetUserClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserClaimsUc).Add(pK_AspNetUserClaims); + aspNetUserClaimsTable.UniqueConstraints.Add("PK_AspNetUserClaims", pK_AspNetUserClaims); + var iX_AspNetUserClaims_UserId = new TableIndex( + "IX_AspNetUserClaims_UserId", aspNetUserClaimsTable, new[] { userIdColumn1 }, false); + var iX_AspNetUserClaims_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }); + iX_AspNetUserClaims_UserId.MappedIndexes.Add(iX_AspNetUserClaims_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserClaims_UserIdIx).Add(iX_AspNetUserClaims_UserId); + aspNetUserClaimsTable.Indexes.Add("IX_AspNetUserClaims_UserId", iX_AspNetUserClaims_UserId); + relationalModel.Tables.Add(("AspNetUserClaims", null), aspNetUserClaimsTable); + var aspNetUserClaimsTableMapping = new TableMapping(identityUserClaim, aspNetUserClaimsTable, true); + aspNetUserClaimsTable.AddTypeMapping(aspNetUserClaimsTableMapping, false); + tableMappings13.Add(aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn7, identityUserClaim.FindProperty("Id")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn0, identityUserClaim.FindProperty("ClaimType")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn0, identityUserClaim.FindProperty("ClaimValue")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn1, identityUserClaim.FindProperty("UserId")!, aspNetUserClaimsTableMapping); + + var identityUserLogin = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserLogin")!; + + var defaultTableMappings14 = new List>(); + identityUserLogin.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings14); + var microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserLogin", null, relationalModel); + var loginProviderColumnBase = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase); + var providerDisplayNameColumnBase = new ColumnBase("ProviderDisplayName", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderDisplayName", providerDisplayNameColumnBase); + var providerKeyColumnBase = new ColumnBase("ProviderKey", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderKey", providerKeyColumnBase); + var userIdColumnBase2 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("UserId", userIdColumnBase2); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserLogin", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase = new TableMappingBase(identityUserLogin, microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase, false); + defaultTableMappings14.Add(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase, identityUserLogin.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerKeyColumnBase, identityUserLogin.FindProperty("ProviderKey")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerDisplayNameColumnBase, identityUserLogin.FindProperty("ProviderDisplayName")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase2, identityUserLogin.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + + var tableMappings14 = new List(); + identityUserLogin.SetRuntimeAnnotation("Relational:TableMappings", tableMappings14); + var aspNetUserLoginsTable = new Table("AspNetUserLogins", null, relationalModel); + var loginProviderColumn = new Column("LoginProvider", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("LoginProvider", loginProviderColumn); + var providerKeyColumn = new Column("ProviderKey", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("ProviderKey", providerKeyColumn); + var providerDisplayNameColumn = new Column("ProviderDisplayName", "TEXT", aspNetUserLoginsTable) + { + IsNullable = true + }; + aspNetUserLoginsTable.Columns.Add("ProviderDisplayName", providerDisplayNameColumn); + var userIdColumn2 = new Column("UserId", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("UserId", userIdColumn2); + var pK_AspNetUserLogins = new UniqueConstraint("PK_AspNetUserLogins", aspNetUserLoginsTable, new[] { loginProviderColumn, providerKeyColumn }); + aspNetUserLoginsTable.PrimaryKey = pK_AspNetUserLogins; + var pK_AspNetUserLoginsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "LoginProvider", "ProviderKey" }); + pK_AspNetUserLogins.MappedKeys.Add(pK_AspNetUserLoginsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserLoginsUc).Add(pK_AspNetUserLogins); + aspNetUserLoginsTable.UniqueConstraints.Add("PK_AspNetUserLogins", pK_AspNetUserLogins); + var iX_AspNetUserLogins_UserId = new TableIndex( + "IX_AspNetUserLogins_UserId", aspNetUserLoginsTable, new[] { userIdColumn2 }, false); + var iX_AspNetUserLogins_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }); + iX_AspNetUserLogins_UserId.MappedIndexes.Add(iX_AspNetUserLogins_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserLogins_UserIdIx).Add(iX_AspNetUserLogins_UserId); + aspNetUserLoginsTable.Indexes.Add("IX_AspNetUserLogins_UserId", iX_AspNetUserLogins_UserId); + relationalModel.Tables.Add(("AspNetUserLogins", null), aspNetUserLoginsTable); + var aspNetUserLoginsTableMapping = new TableMapping(identityUserLogin, aspNetUserLoginsTable, true); + aspNetUserLoginsTable.AddTypeMapping(aspNetUserLoginsTableMapping, false); + tableMappings14.Add(aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn, identityUserLogin.FindProperty("LoginProvider")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerKeyColumn, identityUserLogin.FindProperty("ProviderKey")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerDisplayNameColumn, identityUserLogin.FindProperty("ProviderDisplayName")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn2, identityUserLogin.FindProperty("UserId")!, aspNetUserLoginsTableMapping); + + var identityUserRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserRole")!; + + var defaultTableMappings15 = new List>(); + identityUserRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings15); + var microsoftAspNetCoreIdentityIdentityUserRolestringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserRole", null, relationalModel); + var roleIdColumnBase0 = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("RoleId", roleIdColumnBase0); + var userIdColumnBase3 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("UserId", userIdColumnBase3); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserRole", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + var microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase = new TableMappingBase(identityUserRole, microsoftAspNetCoreIdentityIdentityUserRolestringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase, false); + defaultTableMappings15.Add(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase0, identityUserRole.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase3, identityUserRole.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + + var tableMappings15 = new List(); + identityUserRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings15); + var aspNetUserRolesTable = new Table("AspNetUserRoles", null, relationalModel); + var userIdColumn3 = new Column("UserId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("UserId", userIdColumn3); + var roleIdColumn0 = new Column("RoleId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("RoleId", roleIdColumn0); + var pK_AspNetUserRoles = new UniqueConstraint("PK_AspNetUserRoles", aspNetUserRolesTable, new[] { userIdColumn3, roleIdColumn0 }); + aspNetUserRolesTable.PrimaryKey = pK_AspNetUserRoles; + var pK_AspNetUserRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId", "RoleId" }); + pK_AspNetUserRoles.MappedKeys.Add(pK_AspNetUserRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserRolesUc).Add(pK_AspNetUserRoles); + aspNetUserRolesTable.UniqueConstraints.Add("PK_AspNetUserRoles", pK_AspNetUserRoles); + var iX_AspNetUserRoles_RoleId = new TableIndex( + "IX_AspNetUserRoles_RoleId", aspNetUserRolesTable, new[] { roleIdColumn0 }, false); + var iX_AspNetUserRoles_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }); + iX_AspNetUserRoles_RoleId.MappedIndexes.Add(iX_AspNetUserRoles_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserRoles_RoleIdIx).Add(iX_AspNetUserRoles_RoleId); + aspNetUserRolesTable.Indexes.Add("IX_AspNetUserRoles_RoleId", iX_AspNetUserRoles_RoleId); + relationalModel.Tables.Add(("AspNetUserRoles", null), aspNetUserRolesTable); + var aspNetUserRolesTableMapping = new TableMapping(identityUserRole, aspNetUserRolesTable, true); + aspNetUserRolesTable.AddTypeMapping(aspNetUserRolesTableMapping, false); + tableMappings15.Add(aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn0, identityUserRole.FindProperty("RoleId")!, aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn3, identityUserRole.FindProperty("UserId")!, aspNetUserRolesTableMapping); + + var identityUserToken = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserToken")!; + + var defaultTableMappings16 = new List>(); + identityUserToken.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings16); + var microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserToken", null, relationalModel); + var loginProviderColumnBase0 = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase0); + var nameColumnBase3 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Name", nameColumnBase3); + var userIdColumnBase4 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("UserId", userIdColumnBase4); + var valueColumnBase = new ColumnBase("Value", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Value", valueColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserToken", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase = new TableMappingBase(identityUserToken, microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase, false); + defaultTableMappings16.Add(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase0, identityUserToken.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase3, identityUserToken.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase4, identityUserToken.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueColumnBase, identityUserToken.FindProperty("Value")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + + var tableMappings16 = new List(); + identityUserToken.SetRuntimeAnnotation("Relational:TableMappings", tableMappings16); + var aspNetUserTokensTable = new Table("AspNetUserTokens", null, relationalModel); + var userIdColumn4 = new Column("UserId", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("UserId", userIdColumn4); + var loginProviderColumn0 = new Column("LoginProvider", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("LoginProvider", loginProviderColumn0); + var nameColumn3 = new Column("Name", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("Name", nameColumn3); + var valueColumn = new Column("Value", "TEXT", aspNetUserTokensTable) + { + IsNullable = true + }; + aspNetUserTokensTable.Columns.Add("Value", valueColumn); + var pK_AspNetUserTokens = new UniqueConstraint("PK_AspNetUserTokens", aspNetUserTokensTable, new[] { userIdColumn4, loginProviderColumn0, nameColumn3 }); + aspNetUserTokensTable.PrimaryKey = pK_AspNetUserTokens; + var pK_AspNetUserTokensUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId", "LoginProvider", "Name" }); + pK_AspNetUserTokens.MappedKeys.Add(pK_AspNetUserTokensUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserTokensUc).Add(pK_AspNetUserTokens); + aspNetUserTokensTable.UniqueConstraints.Add("PK_AspNetUserTokens", pK_AspNetUserTokens); + relationalModel.Tables.Add(("AspNetUserTokens", null), aspNetUserTokensTable); + var aspNetUserTokensTableMapping = new TableMapping(identityUserToken, aspNetUserTokensTable, true); + aspNetUserTokensTable.AddTypeMapping(aspNetUserTokensTableMapping, false); + tableMappings16.Add(aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn0, identityUserToken.FindProperty("LoginProvider")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(nameColumn3, identityUserToken.FindProperty("Name")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn4, identityUserToken.FindProperty("UserId")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(valueColumn, identityUserToken.FindProperty("Value")!, aspNetUserTokensTableMapping); + var fK_AspNetRoleClaims_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetRoleClaims_AspNetRoles_RoleId", aspNetRoleClaimsTable, aspNetRolesTable, + new[] { roleIdColumn }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetRoleClaims_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetRoleClaims_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk).Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRoleClaimsTable.ForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + var fK_AspNetUserClaims_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserClaims_AspNetUsers_UserId", aspNetUserClaimsTable, aspNetUsersTable, + new[] { userIdColumn1 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserClaims_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserClaims_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserClaims_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserClaims_AspNetUsers_UserIdFk).Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUserClaimsTable.ForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + var fK_AspNetUserLogins_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserLogins_AspNetUsers_UserId", aspNetUserLoginsTable, aspNetUsersTable, + new[] { userIdColumn2 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserLogins_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserLogins_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserLogins_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserLogins_AspNetUsers_UserIdFk).Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUserLoginsTable.ForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + var fK_AspNetUserRoles_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetRoles_RoleId", aspNetUserRolesTable, aspNetRolesTable, + new[] { roleIdColumn0 }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetRoles_RoleIdFk).Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + var fK_AspNetUserRoles_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetUsers_UserId", aspNetUserRolesTable, aspNetUsersTable, + new[] { userIdColumn3 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetUsers_UserIdFk).Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + var fK_AspNetUserTokens_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserTokens_AspNetUsers_UserId", aspNetUserTokensTable, aspNetUsersTable, + new[] { userIdColumn4 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserTokens_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserTokens_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserTokens_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserTokens_AspNetUsers_UserIdFk).Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUserTokensTable.ForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + var fK_Orders_Address_DeliveryAddressId = new ForeignKeyConstraint( + "FK_Orders_Address_DeliveryAddressId", ordersTable, addressTable, + new[] { deliveryAddressIdColumn }, + addressTable.FindUniqueConstraint("PK_Address")!, ReferentialAction.Cascade); + var fK_Orders_Address_DeliveryAddressIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }, + "BlazingPizza.Address", + new[] { "Id" }); + fK_Orders_Address_DeliveryAddressId.MappedForeignKeys.Add(fK_Orders_Address_DeliveryAddressIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Orders_Address_DeliveryAddressIdFk).Add(fK_Orders_Address_DeliveryAddressId); + ordersTable.ForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + addressTable.ReferencingForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + var fK_Pizzas_Orders_OrderId = new ForeignKeyConstraint( + "FK_Pizzas_Orders_OrderId", pizzasTable, ordersTable, + new[] { orderIdColumn0 }, + ordersTable.FindUniqueConstraint("PK_Orders")!, ReferentialAction.Cascade); + var fK_Pizzas_Orders_OrderIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" }); + fK_Pizzas_Orders_OrderId.MappedForeignKeys.Add(fK_Pizzas_Orders_OrderIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Orders_OrderIdFk).Add(fK_Pizzas_Orders_OrderId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + ordersTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + var fK_Pizzas_Specials_SpecialId = new ForeignKeyConstraint( + "FK_Pizzas_Specials_SpecialId", pizzasTable, specialsTable, + new[] { specialIdColumn }, + specialsTable.FindUniqueConstraint("PK_Specials")!, ReferentialAction.Cascade); + var fK_Pizzas_Specials_SpecialIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + fK_Pizzas_Specials_SpecialId.MappedForeignKeys.Add(fK_Pizzas_Specials_SpecialIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Specials_SpecialIdFk).Add(fK_Pizzas_Specials_SpecialId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + specialsTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + var fK_PizzaTopping_Pizzas_PizzaId = new ForeignKeyConstraint( + "FK_PizzaTopping_Pizzas_PizzaId", pizzaToppingTable, pizzasTable, + new[] { pizzaIdColumn }, + pizzasTable.FindUniqueConstraint("PK_Pizzas")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Pizzas_PizzaIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId" }, + "BlazingPizza.Pizza", + new[] { "Id" }); + fK_PizzaTopping_Pizzas_PizzaId.MappedForeignKeys.Add(fK_PizzaTopping_Pizzas_PizzaIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Pizzas_PizzaIdFk).Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzasTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + var fK_PizzaTopping_Toppings_ToppingId = new ForeignKeyConstraint( + "FK_PizzaTopping_Toppings_ToppingId", pizzaToppingTable, toppingsTable, + new[] { toppingIdColumn }, + toppingsTable.FindUniqueConstraint("PK_Toppings")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Toppings_ToppingIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }, + "BlazingPizza.Topping", + new[] { "Id" }); + fK_PizzaTopping_Toppings_ToppingId.MappedForeignKeys.Add(fK_PizzaTopping_Toppings_ToppingIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Toppings_ToppingIdFk).Add(fK_PizzaTopping_Toppings_ToppingId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + toppingsTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs new file mode 100644 index 00000000..7295425c --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs @@ -0,0 +1,249 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaStoreUserEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Server.PizzaStoreUser", + typeof(PizzaStoreUser), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var accessFailedCount = runtimeEntityType.AddProperty( + "AccessFailedCount", + typeof(int), + propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + accessFailedCount.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var concurrencyStamp = runtimeEntityType.AddProperty( + "ConcurrencyStamp", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var email = runtimeEntityType.AddProperty( + "Email", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + email.TypeMapping = SqliteStringTypeMapping.Default; + + var emailConfirmed = runtimeEntityType.AddProperty( + "EmailConfirmed", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + emailConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var lockoutEnabled = runtimeEntityType.AddProperty( + "LockoutEnabled", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + lockoutEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var lockoutEnd = runtimeEntityType.AddProperty( + "LockoutEnd", + typeof(DateTimeOffset?), + propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + lockoutEnd.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default; + + var normalizedEmail = runtimeEntityType.AddProperty( + "NormalizedEmail", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedEmail.TypeMapping = SqliteStringTypeMapping.Default; + + var normalizedUserName = runtimeEntityType.AddProperty( + "NormalizedUserName", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedUserName.TypeMapping = SqliteStringTypeMapping.Default; + + var passwordHash = runtimeEntityType.AddProperty( + "PasswordHash", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + passwordHash.TypeMapping = SqliteStringTypeMapping.Default; + + var phoneNumber = runtimeEntityType.AddProperty( + "PhoneNumber", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + phoneNumber.TypeMapping = SqliteStringTypeMapping.Default; + + var phoneNumberConfirmed = runtimeEntityType.AddProperty( + "PhoneNumberConfirmed", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + phoneNumberConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var securityStamp = runtimeEntityType.AddProperty( + "SecurityStamp", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + securityStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var twoFactorEnabled = runtimeEntityType.AddProperty( + "TwoFactorEnabled", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + twoFactorEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var userName = runtimeEntityType.AddProperty( + "UserName", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + userName.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { normalizedEmail }); + index.AddAnnotation("Relational:Name", "EmailIndex"); + + var index0 = runtimeEntityType.AddIndex( + new[] { normalizedUserName }, + unique: true); + index0.AddAnnotation("Relational:Name", "UserNameIndex"); + + return runtimeEntityType; + } + + 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", "AspNetUsers"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs new file mode 100644 index 00000000..803ab153 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs @@ -0,0 +1,130 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaToppingEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.PizzaTopping", + typeof(PizzaTopping), + baseEntityType); + + var pizzaId = runtimeEntityType.AddProperty( + "PizzaId", + typeof(int), + propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + pizzaId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var toppingId = runtimeEntityType.AddProperty( + "ToppingId", + typeof(int), + propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + toppingId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { pizzaId, toppingId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { toppingId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PizzaId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var toppings = principalEntityType.AddNavigation("Toppings", + runtimeForeignKey, + onDependent: false, + typeof(List), + propertyInfo: typeof(Pizza).GetProperty("Toppings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ToppingId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var topping = declaringEntityType.AddNavigation("Topping", + runtimeForeignKey, + onDependent: true, + typeof(Topping), + propertyInfo: typeof(PizzaTopping).GetProperty("Topping", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("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", "PizzaTopping"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs new file mode 100644 index 00000000..d3a19507 --- /dev/null +++ b/save-points/07-javascript-interop/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class ToppingEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Topping", + typeof(Topping), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var price = runtimeEntityType.AddProperty( + "Price", + typeof(decimal), + propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + price.TypeMapping = SqliteDecimalTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Toppings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/AddressEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/AddressEntityType.cs deleted file mode 100644 index 82db81b6..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/AddressEntityType.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class AddressEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Address", - typeof(Address), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var city = runtimeEntityType.AddProperty( - "City", - typeof(string), - propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50); - - var line1 = runtimeEntityType.AddProperty( - "Line1", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var line2 = runtimeEntityType.AddProperty( - "Line2", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var postalCode = runtimeEntityType.AddProperty( - "PostalCode", - typeof(string), - propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 20); - - var region = runtimeEntityType.AddProperty( - "Region", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 20); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Address"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs deleted file mode 100644 index 1dd4563b..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class DeviceFlowCodesEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", - typeof(DeviceFlowCodes), - baseEntityType); - - var userCode = runtimeEntityType.AddProperty( - "UserCode", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 200); - - var clientId = runtimeEntityType.AddProperty( - "ClientId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var creationTime = runtimeEntityType.AddProperty( - "CreationTime", - typeof(DateTime), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50000); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var deviceCode = runtimeEntityType.AddProperty( - "DeviceCode", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var expiration = runtimeEntityType.AddProperty( - "Expiration", - typeof(DateTime?), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var sessionId = runtimeEntityType.AddProperty( - "SessionId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var subjectId = runtimeEntityType.AddProperty( - "SubjectId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var key = runtimeEntityType.AddKey( - new[] { userCode }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { deviceCode }, - unique: true); - - var index0 = runtimeEntityType.AddIndex( - new[] { expiration }); - - return runtimeEntityType; - } - - 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", "DeviceCodes"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs deleted file mode 100644 index 8946b261..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityRoleClaimstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityRoleClaim", - typeof(IdentityRoleClaim), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var claimType = runtimeEntityType.AddProperty( - "ClaimType", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var claimValue = runtimeEntityType.AddProperty( - "ClaimValue", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var roleId = runtimeEntityType.AddProperty( - "RoleId", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { roleId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetRoleClaims"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityRoleEntityType.cs deleted file mode 100644 index 2f1fec2b..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityRoleEntityType.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityRoleEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityRole", - typeof(IdentityRole), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var concurrencyStamp = runtimeEntityType.AddProperty( - "ConcurrencyStamp", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - concurrencyToken: true); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var normalizedName = runtimeEntityType.AddProperty( - "NormalizedName", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { normalizedName }, - unique: true); - index.AddAnnotation("Relational:Name", "RoleNameIndex"); - - return runtimeEntityType; - } - - 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", "AspNetRoles"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs deleted file mode 100644 index 55418a1e..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserClaimstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserClaim", - typeof(IdentityUserClaim), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var claimType = runtimeEntityType.AddProperty( - "ClaimType", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var claimValue = runtimeEntityType.AddProperty( - "ClaimValue", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { userId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserClaims"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs deleted file mode 100644 index 3ca029bd..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserLoginstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserLogin", - typeof(IdentityUserLogin), - baseEntityType); - - var loginProvider = runtimeEntityType.AddProperty( - "LoginProvider", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var providerKey = runtimeEntityType.AddProperty( - "ProviderKey", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var providerDisplayName = runtimeEntityType.AddProperty( - "ProviderDisplayName", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { loginProvider, providerKey }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { userId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserLogins"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs deleted file mode 100644 index 70078d7a..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs +++ /dev/null @@ -1,82 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserRolestringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserRole", - typeof(IdentityUserRole), - baseEntityType); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var roleId = runtimeEntityType.AddProperty( - "RoleId", - typeof(string), - propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var key = runtimeEntityType.AddKey( - new[] { userId, roleId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { roleId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, - 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("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserRoles"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs deleted file mode 100644 index 93ba6d31..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserTokenstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserToken", - typeof(IdentityUserToken), - baseEntityType); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var loginProvider = runtimeEntityType.AddProperty( - "LoginProvider", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var value = runtimeEntityType.AddProperty( - "Value", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { userId, loginProvider, name }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserTokens"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/KeyEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/KeyEntityType.cs deleted file mode 100644 index f6c6b4c7..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/KeyEntityType.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class KeyEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.Key", - typeof(Key), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var algorithm = runtimeEntityType.AddProperty( - "Algorithm", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var created = runtimeEntityType.AddProperty( - "Created", - typeof(DateTime), - propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var dataProtected = runtimeEntityType.AddProperty( - "DataProtected", - typeof(bool), - propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var isX509Certificate = runtimeEntityType.AddProperty( - "IsX509Certificate", - typeof(bool), - propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var use = runtimeEntityType.AddProperty( - "Use", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var version = runtimeEntityType.AddProperty( - "Version", - typeof(int), - propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { use }); - - return runtimeEntityType; - } - - 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", "Keys"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/LatLongEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/LatLongEntityType.cs deleted file mode 100644 index 3fd254bd..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/LatLongEntityType.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class LatLongEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.LatLong", - typeof(LatLong), - baseEntityType); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var latitude = runtimeEntityType.AddProperty( - "Latitude", - typeof(double), - propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var longitude = runtimeEntityType.AddProperty( - "Longitude", - typeof(double), - propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { orderId }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - unique: true, - required: true, - ownership: true); - - var deliveryLocation = principalEntityType.AddNavigation("DeliveryLocation", - runtimeForeignKey, - onDependent: false, - typeof(LatLong), - propertyInfo: typeof(Order).GetProperty("DeliveryLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - eagerLoaded: 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", "Orders"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs deleted file mode 100644 index db236e4c..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class NotificationSubscriptionEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.NotificationSubscription", - typeof(NotificationSubscription), - baseEntityType); - - var notificationSubscriptionId = runtimeEntityType.AddProperty( - "NotificationSubscriptionId", - typeof(int), - propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var auth = runtimeEntityType.AddProperty( - "Auth", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var p256dh = runtimeEntityType.AddProperty( - "P256dh", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var url = runtimeEntityType.AddProperty( - "Url", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { notificationSubscriptionId }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "NotificationSubscriptions"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/OrderEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/OrderEntityType.cs deleted file mode 100644 index 9d9ec6fd..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/OrderEntityType.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class OrderEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Order", - typeof(Order), - baseEntityType); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var createdTime = runtimeEntityType.AddProperty( - "CreatedTime", - typeof(DateTime), - propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var deliveryAddressId = runtimeEntityType.AddProperty( - "DeliveryAddressId", - typeof(int?), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { orderId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { deliveryAddressId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType); - - var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", - runtimeForeignKey, - onDependent: true, - typeof(Address), - propertyInfo: typeof(Order).GetProperty("DeliveryAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("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", "Orders"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PersistedGrantEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/PersistedGrantEntityType.cs deleted file mode 100644 index 842d53a5..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PersistedGrantEntityType.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PersistedGrantEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", - typeof(PersistedGrant), - baseEntityType); - - var key = runtimeEntityType.AddProperty( - "Key", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Key", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 200); - - var clientId = runtimeEntityType.AddProperty( - "ClientId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var consumedTime = runtimeEntityType.AddProperty( - "ConsumedTime", - typeof(DateTime?), - propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var creationTime = runtimeEntityType.AddProperty( - "CreationTime", - typeof(DateTime), - propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50000); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var expiration = runtimeEntityType.AddProperty( - "Expiration", - typeof(DateTime?), - propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var sessionId = runtimeEntityType.AddProperty( - "SessionId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var subjectId = runtimeEntityType.AddProperty( - "SubjectId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var type = runtimeEntityType.AddProperty( - "Type", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50); - - var key0 = runtimeEntityType.AddKey( - new[] { key }); - runtimeEntityType.SetPrimaryKey(key0); - - var index = runtimeEntityType.AddIndex( - new[] { consumedTime }); - - var index0 = runtimeEntityType.AddIndex( - new[] { expiration }); - - var index1 = runtimeEntityType.AddIndex( - new[] { subjectId, clientId, type }); - - var index2 = runtimeEntityType.AddIndex( - new[] { subjectId, sessionId, type }); - - return runtimeEntityType; - } - - 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", "PersistedGrants"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaEntityType.cs deleted file mode 100644 index 3a124e63..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaEntityType.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Pizza", - typeof(Pizza), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var size = runtimeEntityType.AddProperty( - "Size", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var specialId = runtimeEntityType.AddProperty( - "SpecialId", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { orderId }); - - var index0 = runtimeEntityType.AddIndex( - new[] { specialId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var pizzas = principalEntityType.AddNavigation("Pizzas", - runtimeForeignKey, - onDependent: false, - typeof(List), - propertyInfo: typeof(Order).GetProperty("Pizzas", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SpecialId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var special = declaringEntityType.AddNavigation("Special", - runtimeForeignKey, - onDependent: true, - typeof(PizzaSpecial), - propertyInfo: typeof(Pizza).GetProperty("Special", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("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", "Pizzas"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs deleted file mode 100644 index e86b0f50..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaSpecialEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.PizzaSpecial", - typeof(PizzaSpecial), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var basePrice = runtimeEntityType.AddProperty( - "BasePrice", - typeof(decimal), - propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var imageUrl = runtimeEntityType.AddProperty( - "ImageUrl", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Specials"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreContextModel.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreContextModel.cs deleted file mode 100644 index 8b516a68..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreContextModel.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - [DbContext(typeof(PizzaStoreContext))] - public partial class PizzaStoreContextModel : RuntimeModel - { - static PizzaStoreContextModel() - { - var model = new PizzaStoreContextModel(); - model.Initialize(); - model.Customize(); - _instance = model; - } - - private static PizzaStoreContextModel _instance; - public static IModel Instance => _instance; - - partial void Initialize(); - - partial void Customize(); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs deleted file mode 100644 index ba42d6b0..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - public partial class PizzaStoreContextModel - { - partial void Initialize() - { - var address = AddressEntityType.Create(this); - var latLong = LatLongEntityType.Create(this); - var notificationSubscription = NotificationSubscriptionEntityType.Create(this); - var order = OrderEntityType.Create(this); - var pizza = PizzaEntityType.Create(this); - var pizzaSpecial = PizzaSpecialEntityType.Create(this); - var pizzaTopping = PizzaToppingEntityType.Create(this); - var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); - var topping = ToppingEntityType.Create(this); - var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); - var key = KeyEntityType.Create(this); - var persistedGrant = PersistedGrantEntityType.Create(this); - var identityRole = IdentityRoleEntityType.Create(this); - var identityRoleClaimstring = IdentityRoleClaimstringEntityType.Create(this); - var identityUserClaimstring = IdentityUserClaimstringEntityType.Create(this); - var identityUserLoginstring = IdentityUserLoginstringEntityType.Create(this); - var identityUserRolestring = IdentityUserRolestringEntityType.Create(this); - var identityUserTokenstring = IdentityUserTokenstringEntityType.Create(this); - - LatLongEntityType.CreateForeignKey1(latLong, order); - OrderEntityType.CreateForeignKey1(order, address); - PizzaEntityType.CreateForeignKey1(pizza, order); - PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); - PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); - PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); - IdentityRoleClaimstringEntityType.CreateForeignKey1(identityRoleClaimstring, identityRole); - IdentityUserClaimstringEntityType.CreateForeignKey1(identityUserClaimstring, pizzaStoreUser); - IdentityUserLoginstringEntityType.CreateForeignKey1(identityUserLoginstring, pizzaStoreUser); - IdentityUserRolestringEntityType.CreateForeignKey1(identityUserRolestring, identityRole); - IdentityUserRolestringEntityType.CreateForeignKey2(identityUserRolestring, pizzaStoreUser); - IdentityUserTokenstringEntityType.CreateForeignKey1(identityUserTokenstring, pizzaStoreUser); - - AddressEntityType.CreateAnnotations(address); - LatLongEntityType.CreateAnnotations(latLong); - NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); - OrderEntityType.CreateAnnotations(order); - PizzaEntityType.CreateAnnotations(pizza); - PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); - PizzaToppingEntityType.CreateAnnotations(pizzaTopping); - PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); - ToppingEntityType.CreateAnnotations(topping); - DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); - KeyEntityType.CreateAnnotations(key); - PersistedGrantEntityType.CreateAnnotations(persistedGrant); - IdentityRoleEntityType.CreateAnnotations(identityRole); - IdentityRoleClaimstringEntityType.CreateAnnotations(identityRoleClaimstring); - IdentityUserClaimstringEntityType.CreateAnnotations(identityUserClaimstring); - IdentityUserLoginstringEntityType.CreateAnnotations(identityUserLoginstring); - IdentityUserRolestringEntityType.CreateAnnotations(identityUserRolestring); - IdentityUserTokenstringEntityType.CreateAnnotations(identityUserTokenstring); - - AddAnnotation("ProductVersion", "7.0.0"); - } - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs deleted file mode 100644 index 18b2d96d..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs +++ /dev/null @@ -1,156 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaStoreUserEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Server.PizzaStoreUser", - typeof(PizzaStoreUser), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var accessFailedCount = runtimeEntityType.AddProperty( - "AccessFailedCount", - typeof(int), - propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var concurrencyStamp = runtimeEntityType.AddProperty( - "ConcurrencyStamp", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - concurrencyToken: true); - - var email = runtimeEntityType.AddProperty( - "Email", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var emailConfirmed = runtimeEntityType.AddProperty( - "EmailConfirmed", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var lockoutEnabled = runtimeEntityType.AddProperty( - "LockoutEnabled", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var lockoutEnd = runtimeEntityType.AddProperty( - "LockoutEnd", - typeof(DateTimeOffset?), - propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var normalizedEmail = runtimeEntityType.AddProperty( - "NormalizedEmail", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var normalizedUserName = runtimeEntityType.AddProperty( - "NormalizedUserName", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var passwordHash = runtimeEntityType.AddProperty( - "PasswordHash", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var phoneNumber = runtimeEntityType.AddProperty( - "PhoneNumber", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var phoneNumberConfirmed = runtimeEntityType.AddProperty( - "PhoneNumberConfirmed", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var securityStamp = runtimeEntityType.AddProperty( - "SecurityStamp", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var twoFactorEnabled = runtimeEntityType.AddProperty( - "TwoFactorEnabled", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var userName = runtimeEntityType.AddProperty( - "UserName", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { normalizedEmail }); - index.AddAnnotation("Relational:Name", "EmailIndex"); - - var index0 = runtimeEntityType.AddIndex( - new[] { normalizedUserName }, - unique: true); - index0.AddAnnotation("Relational:Name", "UserNameIndex"); - - return runtimeEntityType; - } - - 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", "AspNetUsers"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaToppingEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaToppingEntityType.cs deleted file mode 100644 index b97d2a24..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/PizzaToppingEntityType.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaToppingEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.PizzaTopping", - typeof(PizzaTopping), - baseEntityType); - - var pizzaId = runtimeEntityType.AddProperty( - "PizzaId", - typeof(int), - propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var toppingId = runtimeEntityType.AddProperty( - "ToppingId", - typeof(int), - propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var key = runtimeEntityType.AddKey( - new[] { pizzaId, toppingId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { toppingId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PizzaId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var toppings = principalEntityType.AddNavigation("Toppings", - runtimeForeignKey, - onDependent: false, - typeof(List), - propertyInfo: typeof(Pizza).GetProperty("Toppings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ToppingId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var topping = declaringEntityType.AddNavigation("Topping", - runtimeForeignKey, - onDependent: true, - typeof(Topping), - propertyInfo: typeof(PizzaTopping).GetProperty("Topping", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("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", "PizzaTopping"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Models/ToppingEntityType.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Models/ToppingEntityType.cs deleted file mode 100644 index 9295f9bf..00000000 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Models/ToppingEntityType.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class ToppingEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Topping", - typeof(Topping), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var price = runtimeEntityType.AddProperty( - "Price", - typeof(decimal), - propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Toppings"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/Program.cs b/save-points/07-javascript-interop/BlazingPizza.Server/Program.cs index b83debb4..9db9e7ea 100644 --- a/save-points/07-javascript-interop/BlazingPizza.Server/Program.cs +++ b/save-points/07-javascript-interop/BlazingPizza.Server/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddDbContext(options => options.UseSqlite("Data Source=pizza.db") - .UseModel(BlazingPizza.Server.Models.PizzaStoreContextModel.Instance)); + .UseModel(BlazingPizza.Server.CompiledModels.PizzaStoreContextModel.Instance)); builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); diff --git a/save-points/07-javascript-interop/BlazingPizza.Server/SeedData.cs b/save-points/07-javascript-interop/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/07-javascript-interop/BlazingPizza.Server/SeedData.cs +++ b/save-points/07-javascript-interop/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/08-templated-components/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/08-templated-components/BlazingPizza.Server/BlazingPizza.Server.csproj index b028c771..3b9de83d 100644 --- a/save-points/08-templated-components/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/08-templated-components/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/AddressEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/AddressEntityType.cs similarity index 76% rename from save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/AddressEntityType.cs rename to save-points/08-templated-components/BlazingPizza.Server/CompiledModels/AddressEntityType.cs index 82db81b6..f5908d82 100644 --- a/save-points/06-authentication-and-authorization/BlazingPizza.Server/Models/AddressEntityType.cs +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/AddressEntityType.cs @@ -1,12 +1,15 @@ // using System; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable -namespace BlazingPizza.Server.Models +namespace BlazingPizza.Server.CompiledModels { internal partial class AddressEntityType { @@ -23,7 +26,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); var city = runtimeEntityType.AddProperty( "City", @@ -31,6 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + city.TypeMapping = SqliteStringTypeMapping.Default; var line1 = runtimeEntityType.AddProperty( "Line1", @@ -38,14 +58,15 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + line1.TypeMapping = SqliteStringTypeMapping.Default; var line2 = runtimeEntityType.AddProperty( "Line2", typeof(string), propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, maxLength: 100); + line2.TypeMapping = SqliteStringTypeMapping.Default; var name = runtimeEntityType.AddProperty( "Name", @@ -53,6 +74,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + name.TypeMapping = SqliteStringTypeMapping.Default; var postalCode = runtimeEntityType.AddProperty( "PostalCode", @@ -60,6 +82,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 20); + postalCode.TypeMapping = SqliteStringTypeMapping.Default; var region = runtimeEntityType.AddProperty( "Region", @@ -67,6 +90,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 20); + region.TypeMapping = SqliteStringTypeMapping.Default; var key = runtimeEntityType.AddKey( new[] { id }); diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs new file mode 100644 index 00000000..6c5ca661 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs @@ -0,0 +1,125 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class DeviceFlowCodesEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + typeof(DeviceFlowCodes), + baseEntityType); + + var userCode = runtimeEntityType.AddProperty( + "UserCode", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 200); + userCode.TypeMapping = SqliteStringTypeMapping.Default; + + var clientId = runtimeEntityType.AddProperty( + "ClientId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; + + var creationTime = runtimeEntityType.AddProperty( + "CreationTime", + typeof(DateTime), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var deviceCode = runtimeEntityType.AddProperty( + "DeviceCode", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + deviceCode.TypeMapping = SqliteStringTypeMapping.Default; + + var expiration = runtimeEntityType.AddProperty( + "Expiration", + typeof(DateTime?), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var sessionId = runtimeEntityType.AddProperty( + "SessionId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; + + var subjectId = runtimeEntityType.AddProperty( + "SubjectId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userCode }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { deviceCode }, + unique: true); + + var index0 = runtimeEntityType.AddIndex( + new[] { expiration }); + + return runtimeEntityType; + } + + 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", "DeviceCodes"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs new file mode 100644 index 00000000..73cabada --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs @@ -0,0 +1,107 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityRoleClaimEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + typeof(IdentityRoleClaim), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var claimType = runtimeEntityType.AddProperty( + "ClaimType", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; + + var claimValue = runtimeEntityType.AddProperty( + "ClaimValue", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; + + var roleId = runtimeEntityType.AddProperty( + "RoleId", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + roleId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { roleId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetRoleClaims"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs new file mode 100644 index 00000000..3f46cdc5 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityRoleEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityRole", + typeof(IdentityRole), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var concurrencyStamp = runtimeEntityType.AddProperty( + "ConcurrencyStamp", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var normalizedName = runtimeEntityType.AddProperty( + "NormalizedName", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedName.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { normalizedName }, + unique: true); + index.AddAnnotation("Relational:Name", "RoleNameIndex"); + + return runtimeEntityType; + } + + 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", "AspNetRoles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs new file mode 100644 index 00000000..5de58bf8 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs @@ -0,0 +1,107 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserClaimEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + typeof(IdentityUserClaim), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var claimType = runtimeEntityType.AddProperty( + "ClaimType", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; + + var claimValue = runtimeEntityType.AddProperty( + "ClaimValue", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { userId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserClaims"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs new file mode 100644 index 00000000..fb868abc --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs @@ -0,0 +1,91 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserLoginEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + typeof(IdentityUserLogin), + baseEntityType); + + var loginProvider = runtimeEntityType.AddProperty( + "LoginProvider", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; + + var providerKey = runtimeEntityType.AddProperty( + "ProviderKey", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + providerKey.TypeMapping = SqliteStringTypeMapping.Default; + + var providerDisplayName = runtimeEntityType.AddProperty( + "ProviderDisplayName", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + providerDisplayName.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { loginProvider, providerKey }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { userId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserLogins"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs new file mode 100644 index 00000000..f22fd836 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs @@ -0,0 +1,85 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserRoleEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserRole", + typeof(IdentityUserRole), + baseEntityType); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var roleId = runtimeEntityType.AddProperty( + "RoleId", + typeof(string), + propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + roleId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userId, roleId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { roleId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, + 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("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserRoles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs new file mode 100644 index 00000000..b4e36069 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs @@ -0,0 +1,89 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserTokenEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserToken", + typeof(IdentityUserToken), + baseEntityType); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var loginProvider = runtimeEntityType.AddProperty( + "LoginProvider", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var value = runtimeEntityType.AddProperty( + "Value", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + value.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userId, loginProvider, name }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserTokens"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/KeyEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/KeyEntityType.cs new file mode 100644 index 00000000..8743240a --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/KeyEntityType.cs @@ -0,0 +1,153 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class KeyEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.Key", + typeof(Key), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var algorithm = runtimeEntityType.AddProperty( + "Algorithm", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + algorithm.TypeMapping = SqliteStringTypeMapping.Default; + + var created = runtimeEntityType.AddProperty( + "Created", + typeof(DateTime), + propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + created.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var dataProtected = runtimeEntityType.AddProperty( + "DataProtected", + typeof(bool), + propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + dataProtected.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var isX509Certificate = runtimeEntityType.AddProperty( + "IsX509Certificate", + typeof(bool), + propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + isX509Certificate.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var use = runtimeEntityType.AddProperty( + "Use", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + use.TypeMapping = SqliteStringTypeMapping.Default; + + var version = runtimeEntityType.AddProperty( + "Version", + typeof(int), + propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + version.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { use }); + + return runtimeEntityType; + } + + 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", "Keys"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs new file mode 100644 index 00000000..657b8093 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs @@ -0,0 +1,130 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class LatLongEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.LatLong", + typeof(LatLong), + baseEntityType); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var latitude = runtimeEntityType.AddProperty( + "Latitude", + typeof(double), + propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + latitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); + + var longitude = runtimeEntityType.AddProperty( + "Longitude", + typeof(double), + propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + longitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); + + var key = runtimeEntityType.AddKey( + new[] { orderId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true, + ownership: true); + + var deliveryLocation = principalEntityType.AddNavigation("DeliveryLocation", + runtimeForeignKey, + onDependent: false, + typeof(LatLong), + propertyInfo: typeof(Order).GetProperty("DeliveryLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + eagerLoaded: 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", "Orders"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs new file mode 100644 index 00000000..891722a1 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs @@ -0,0 +1,99 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class NotificationSubscriptionEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.NotificationSubscription", + typeof(NotificationSubscription), + baseEntityType); + + var notificationSubscriptionId = runtimeEntityType.AddProperty( + "NotificationSubscriptionId", + typeof(int?), + propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw); + notificationSubscriptionId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + keyComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + providerValueComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var auth = runtimeEntityType.AddProperty( + "Auth", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + auth.TypeMapping = SqliteStringTypeMapping.Default; + + var p256dh = runtimeEntityType.AddProperty( + "P256dh", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + p256dh.TypeMapping = SqliteStringTypeMapping.Default; + + var url = runtimeEntityType.AddProperty( + "Url", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + url.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { notificationSubscriptionId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "NotificationSubscriptions"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/OrderEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/OrderEntityType.cs new file mode 100644 index 00000000..bf1e5171 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/OrderEntityType.cs @@ -0,0 +1,126 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class OrderEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Order", + typeof(Order), + baseEntityType); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var createdTime = runtimeEntityType.AddProperty( + "CreatedTime", + typeof(DateTime), + propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + createdTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var deliveryAddressId = runtimeEntityType.AddProperty( + "DeliveryAddressId", + typeof(int), + sentinel: 0); + deliveryAddressId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { orderId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { deliveryAddressId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", + runtimeForeignKey, + onDependent: true, + typeof(Address), + propertyInfo: typeof(Order).GetProperty("DeliveryAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("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", "Orders"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs new file mode 100644 index 00000000..c57731dd --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs @@ -0,0 +1,139 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PersistedGrantEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + typeof(PersistedGrant), + baseEntityType); + + var key = runtimeEntityType.AddProperty( + "Key", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Key", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 200); + key.TypeMapping = SqliteStringTypeMapping.Default; + + var clientId = runtimeEntityType.AddProperty( + "ClientId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; + + var consumedTime = runtimeEntityType.AddProperty( + "ConsumedTime", + typeof(DateTime?), + propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + consumedTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var creationTime = runtimeEntityType.AddProperty( + "CreationTime", + typeof(DateTime), + propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var expiration = runtimeEntityType.AddProperty( + "Expiration", + typeof(DateTime?), + propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var sessionId = runtimeEntityType.AddProperty( + "SessionId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; + + var subjectId = runtimeEntityType.AddProperty( + "SubjectId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; + + var type = runtimeEntityType.AddProperty( + "Type", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + type.TypeMapping = SqliteStringTypeMapping.Default; + + var key0 = runtimeEntityType.AddKey( + new[] { key }); + runtimeEntityType.SetPrimaryKey(key0); + + var index = runtimeEntityType.AddIndex( + new[] { consumedTime }); + + var index0 = runtimeEntityType.AddIndex( + new[] { expiration }); + + var index1 = runtimeEntityType.AddIndex( + new[] { subjectId, clientId, type }); + + var index2 = runtimeEntityType.AddIndex( + new[] { subjectId, sessionId, type }); + + return runtimeEntityType; + } + + 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", "PersistedGrants"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs new file mode 100644 index 00000000..f8ac05e4 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs @@ -0,0 +1,177 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Pizza", + typeof(Pizza), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var size = runtimeEntityType.AddProperty( + "Size", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + size.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var specialId = runtimeEntityType.AddProperty( + "SpecialId", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + specialId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { orderId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { specialId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var pizzas = principalEntityType.AddNavigation("Pizzas", + runtimeForeignKey, + onDependent: false, + typeof(List), + propertyInfo: typeof(Order).GetProperty("Pizzas", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SpecialId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var special = declaringEntityType.AddNavigation("Special", + runtimeForeignKey, + onDependent: true, + typeof(PizzaSpecial), + propertyInfo: typeof(Pizza).GetProperty("Special", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("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", "Pizzas"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs new file mode 100644 index 00000000..693286c8 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs @@ -0,0 +1,97 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaSpecialEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.PizzaSpecial", + typeof(PizzaSpecial), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var basePrice = runtimeEntityType.AddProperty( + "BasePrice", + typeof(decimal), + propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + basePrice.TypeMapping = SqliteDecimalTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var imageUrl = runtimeEntityType.AddProperty( + "ImageUrl", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + imageUrl.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Specials"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs new file mode 100644 index 00000000..b7e36125 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs @@ -0,0 +1,47 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + [DbContext(typeof(PizzaStoreContext))] + public partial class PizzaStoreContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static PizzaStoreContextModel() + { + var model = new PizzaStoreContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = model; + } + + private static PizzaStoreContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs new file mode 100644 index 00000000..0f8d07cb --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs @@ -0,0 +1,1619 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + public partial class PizzaStoreContextModel + { + partial void Initialize() + { + var address = AddressEntityType.Create(this); + var latLong = LatLongEntityType.Create(this); + var notificationSubscription = NotificationSubscriptionEntityType.Create(this); + var order = OrderEntityType.Create(this); + var pizza = PizzaEntityType.Create(this); + var pizzaSpecial = PizzaSpecialEntityType.Create(this); + var pizzaTopping = PizzaToppingEntityType.Create(this); + var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); + var topping = ToppingEntityType.Create(this); + var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); + var key = KeyEntityType.Create(this); + var persistedGrant = PersistedGrantEntityType.Create(this); + var identityRole = IdentityRoleEntityType.Create(this); + var identityRoleClaim = IdentityRoleClaimEntityType.Create(this); + var identityUserClaim = IdentityUserClaimEntityType.Create(this); + var identityUserLogin = IdentityUserLoginEntityType.Create(this); + var identityUserRole = IdentityUserRoleEntityType.Create(this); + var identityUserToken = IdentityUserTokenEntityType.Create(this); + + LatLongEntityType.CreateForeignKey1(latLong, order); + OrderEntityType.CreateForeignKey1(order, address); + PizzaEntityType.CreateForeignKey1(pizza, order); + PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); + PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); + PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); + IdentityRoleClaimEntityType.CreateForeignKey1(identityRoleClaim, identityRole); + IdentityUserClaimEntityType.CreateForeignKey1(identityUserClaim, pizzaStoreUser); + IdentityUserLoginEntityType.CreateForeignKey1(identityUserLogin, pizzaStoreUser); + IdentityUserRoleEntityType.CreateForeignKey1(identityUserRole, identityRole); + IdentityUserRoleEntityType.CreateForeignKey2(identityUserRole, pizzaStoreUser); + IdentityUserTokenEntityType.CreateForeignKey1(identityUserToken, pizzaStoreUser); + + AddressEntityType.CreateAnnotations(address); + LatLongEntityType.CreateAnnotations(latLong); + NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); + OrderEntityType.CreateAnnotations(order); + PizzaEntityType.CreateAnnotations(pizza); + PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); + PizzaToppingEntityType.CreateAnnotations(pizzaTopping); + PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); + ToppingEntityType.CreateAnnotations(topping); + DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); + KeyEntityType.CreateAnnotations(key); + PersistedGrantEntityType.CreateAnnotations(persistedGrant); + IdentityRoleEntityType.CreateAnnotations(identityRole); + IdentityRoleClaimEntityType.CreateAnnotations(identityRoleClaim); + IdentityUserClaimEntityType.CreateAnnotations(identityUserClaim); + IdentityUserLoginEntityType.CreateAnnotations(identityUserLogin); + IdentityUserRoleEntityType.CreateAnnotations(identityUserRole); + IdentityUserTokenEntityType.CreateAnnotations(identityUserToken); + + AddAnnotation("ProductVersion", "8.0.0"); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var address = FindEntityType("BlazingPizza.Address")!; + + var defaultTableMappings = new List>(); + address.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var blazingPizzaAddressTableBase = new TableBase("BlazingPizza.Address", null, relationalModel); + var cityColumnBase = new ColumnBase("City", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("City", cityColumnBase); + var idColumnBase = new ColumnBase("Id", "INTEGER", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Id", idColumnBase); + var line1ColumnBase = new ColumnBase("Line1", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line1", line1ColumnBase); + var line2ColumnBase = new ColumnBase("Line2", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line2", line2ColumnBase); + var nameColumnBase = new ColumnBase("Name", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Name", nameColumnBase); + var postalCodeColumnBase = new ColumnBase("PostalCode", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("PostalCode", postalCodeColumnBase); + var regionColumnBase = new ColumnBase("Region", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Region", regionColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Address", blazingPizzaAddressTableBase); + var blazingPizzaAddressMappingBase = new TableMappingBase(address, blazingPizzaAddressTableBase, true); + blazingPizzaAddressTableBase.AddTypeMapping(blazingPizzaAddressMappingBase, false); + defaultTableMappings.Add(blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, address.FindProperty("Id")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)cityColumnBase, address.FindProperty("City")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line1ColumnBase, address.FindProperty("Line1")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line2ColumnBase, address.FindProperty("Line2")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase, address.FindProperty("Name")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)postalCodeColumnBase, address.FindProperty("PostalCode")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)regionColumnBase, address.FindProperty("Region")!, blazingPizzaAddressMappingBase); + + var tableMappings = new List(); + address.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var addressTable = new Table("Address", null, relationalModel); + var idColumn = new Column("Id", "INTEGER", addressTable); + addressTable.Columns.Add("Id", idColumn); + var cityColumn = new Column("City", "TEXT", addressTable); + addressTable.Columns.Add("City", cityColumn); + var line1Column = new Column("Line1", "TEXT", addressTable); + addressTable.Columns.Add("Line1", line1Column); + var line2Column = new Column("Line2", "TEXT", addressTable); + addressTable.Columns.Add("Line2", line2Column); + var nameColumn = new Column("Name", "TEXT", addressTable); + addressTable.Columns.Add("Name", nameColumn); + var postalCodeColumn = new Column("PostalCode", "TEXT", addressTable); + addressTable.Columns.Add("PostalCode", postalCodeColumn); + var regionColumn = new Column("Region", "TEXT", addressTable); + addressTable.Columns.Add("Region", regionColumn); + var pK_Address = new UniqueConstraint("PK_Address", addressTable, new[] { idColumn }); + addressTable.PrimaryKey = pK_Address; + var pK_AddressUc = RelationalModel.GetKey(this, + "BlazingPizza.Address", + new[] { "Id" }); + pK_Address.MappedKeys.Add(pK_AddressUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AddressUc).Add(pK_Address); + addressTable.UniqueConstraints.Add("PK_Address", pK_Address); + relationalModel.Tables.Add(("Address", null), addressTable); + var addressTableMapping = new TableMapping(address, addressTable, true); + addressTable.AddTypeMapping(addressTableMapping, false); + tableMappings.Add(addressTableMapping); + RelationalModel.CreateColumnMapping(idColumn, address.FindProperty("Id")!, addressTableMapping); + RelationalModel.CreateColumnMapping(cityColumn, address.FindProperty("City")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line1Column, address.FindProperty("Line1")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line2Column, address.FindProperty("Line2")!, addressTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, address.FindProperty("Name")!, addressTableMapping); + RelationalModel.CreateColumnMapping(postalCodeColumn, address.FindProperty("PostalCode")!, addressTableMapping); + RelationalModel.CreateColumnMapping(regionColumn, address.FindProperty("Region")!, addressTableMapping); + + var latLong = FindEntityType("BlazingPizza.LatLong")!; + + var defaultTableMappings0 = new List>(); + latLong.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var blazingPizzaLatLongTableBase = new TableBase("BlazingPizza.LatLong", null, relationalModel); + var latitudeColumnBase = new ColumnBase("Latitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Latitude", latitudeColumnBase); + var longitudeColumnBase = new ColumnBase("Longitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Longitude", longitudeColumnBase); + var orderIdColumnBase = new ColumnBase("OrderId", "INTEGER", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("OrderId", orderIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.LatLong", blazingPizzaLatLongTableBase); + var blazingPizzaLatLongMappingBase = new TableMappingBase(latLong, blazingPizzaLatLongTableBase, true); + blazingPizzaLatLongTableBase.AddTypeMapping(blazingPizzaLatLongMappingBase, false); + defaultTableMappings0.Add(blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase, latLong.FindProperty("OrderId")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)latitudeColumnBase, latLong.FindProperty("Latitude")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)longitudeColumnBase, latLong.FindProperty("Longitude")!, blazingPizzaLatLongMappingBase); + + var tableMappings0 = new List(); + latLong.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var ordersTable = new Table("Orders", null, relationalModel); + var orderIdColumn = new Column("OrderId", "INTEGER", ordersTable); + ordersTable.Columns.Add("OrderId", orderIdColumn); + var createdTimeColumn = new Column("CreatedTime", "TEXT", ordersTable); + ordersTable.Columns.Add("CreatedTime", createdTimeColumn); + var deliveryAddressIdColumn = new Column("DeliveryAddressId", "INTEGER", ordersTable); + ordersTable.Columns.Add("DeliveryAddressId", deliveryAddressIdColumn); + var deliveryLocation_LatitudeColumn = new Column("DeliveryLocation_Latitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Latitude", deliveryLocation_LatitudeColumn); + var deliveryLocation_LongitudeColumn = new Column("DeliveryLocation_Longitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Longitude", deliveryLocation_LongitudeColumn); + var userIdColumn = new Column("UserId", "TEXT", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("UserId", userIdColumn); + var pK_Orders = new UniqueConstraint("PK_Orders", ordersTable, new[] { orderIdColumn }); + ordersTable.PrimaryKey = pK_Orders; + var pK_OrdersUc = RelationalModel.GetKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc).Add(pK_Orders); + var pK_OrdersUc0 = RelationalModel.GetKey(this, + "BlazingPizza.Order", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc0); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc0).Add(pK_Orders); + ordersTable.UniqueConstraints.Add("PK_Orders", pK_Orders); + var iX_Orders_DeliveryAddressId = new TableIndex( + "IX_Orders_DeliveryAddressId", ordersTable, new[] { deliveryAddressIdColumn }, false); + var iX_Orders_DeliveryAddressIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }); + iX_Orders_DeliveryAddressId.MappedIndexes.Add(iX_Orders_DeliveryAddressIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Orders_DeliveryAddressIdIx).Add(iX_Orders_DeliveryAddressId); + ordersTable.Indexes.Add("IX_Orders_DeliveryAddressId", iX_Orders_DeliveryAddressId); + relationalModel.Tables.Add(("Orders", null), ordersTable); + var ordersTableMapping = new TableMapping(latLong, ordersTable, true) + { + IsSharedTablePrincipal = false, + }; + ordersTable.AddTypeMapping(ordersTableMapping, true); + tableMappings0.Add(ordersTableMapping); + ordersTable.AddRowInternalForeignKey(latLong, RelationalModel.GetForeignKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" })); + RelationalModel.CreateColumnMapping(orderIdColumn, latLong.FindProperty("OrderId")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LatitudeColumn, latLong.FindProperty("Latitude")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LongitudeColumn, latLong.FindProperty("Longitude")!, ordersTableMapping); + + var notificationSubscription = FindEntityType("BlazingPizza.NotificationSubscription")!; + + var defaultTableMappings1 = new List>(); + notificationSubscription.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var blazingPizzaNotificationSubscriptionTableBase = new TableBase("BlazingPizza.NotificationSubscription", null, relationalModel); + var authColumnBase = new ColumnBase("Auth", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Auth", authColumnBase); + var notificationSubscriptionIdColumnBase = new ColumnBase("NotificationSubscriptionId", "INTEGER", blazingPizzaNotificationSubscriptionTableBase); + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumnBase); + var p256dhColumnBase = new ColumnBase("P256dh", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("P256dh", p256dhColumnBase); + var urlColumnBase = new ColumnBase("Url", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Url", urlColumnBase); + var userIdColumnBase = new ColumnBase("UserId", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("UserId", userIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.NotificationSubscription", blazingPizzaNotificationSubscriptionTableBase); + var blazingPizzaNotificationSubscriptionMappingBase = new TableMappingBase(notificationSubscription, blazingPizzaNotificationSubscriptionTableBase, true); + blazingPizzaNotificationSubscriptionTableBase.AddTypeMapping(blazingPizzaNotificationSubscriptionMappingBase, false); + defaultTableMappings1.Add(blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)notificationSubscriptionIdColumnBase, notificationSubscription.FindProperty("NotificationSubscriptionId")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)authColumnBase, notificationSubscription.FindProperty("Auth")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)p256dhColumnBase, notificationSubscription.FindProperty("P256dh")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)urlColumnBase, notificationSubscription.FindProperty("Url")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase, notificationSubscription.FindProperty("UserId")!, blazingPizzaNotificationSubscriptionMappingBase); + + var tableMappings1 = new List(); + notificationSubscription.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var notificationSubscriptionsTable = new Table("NotificationSubscriptions", null, relationalModel); + var notificationSubscriptionIdColumn = new Column("NotificationSubscriptionId", "INTEGER", notificationSubscriptionsTable); + notificationSubscriptionsTable.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumn); + var authColumn = new Column("Auth", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Auth", authColumn); + var p256dhColumn = new Column("P256dh", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("P256dh", p256dhColumn); + var urlColumn = new Column("Url", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Url", urlColumn); + var userIdColumn0 = new Column("UserId", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("UserId", userIdColumn0); + var pK_NotificationSubscriptions = new UniqueConstraint("PK_NotificationSubscriptions", notificationSubscriptionsTable, new[] { notificationSubscriptionIdColumn }); + notificationSubscriptionsTable.PrimaryKey = pK_NotificationSubscriptions; + var pK_NotificationSubscriptionsUc = RelationalModel.GetKey(this, + "BlazingPizza.NotificationSubscription", + new[] { "NotificationSubscriptionId" }); + pK_NotificationSubscriptions.MappedKeys.Add(pK_NotificationSubscriptionsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_NotificationSubscriptionsUc).Add(pK_NotificationSubscriptions); + notificationSubscriptionsTable.UniqueConstraints.Add("PK_NotificationSubscriptions", pK_NotificationSubscriptions); + relationalModel.Tables.Add(("NotificationSubscriptions", null), notificationSubscriptionsTable); + var notificationSubscriptionsTableMapping = new TableMapping(notificationSubscription, notificationSubscriptionsTable, true); + notificationSubscriptionsTable.AddTypeMapping(notificationSubscriptionsTableMapping, false); + tableMappings1.Add(notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(notificationSubscriptionIdColumn, notificationSubscription.FindProperty("NotificationSubscriptionId")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(authColumn, notificationSubscription.FindProperty("Auth")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(p256dhColumn, notificationSubscription.FindProperty("P256dh")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(urlColumn, notificationSubscription.FindProperty("Url")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn0, notificationSubscription.FindProperty("UserId")!, notificationSubscriptionsTableMapping); + + var order = FindEntityType("BlazingPizza.Order")!; + + var defaultTableMappings2 = new List>(); + order.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings2); + var blazingPizzaOrderTableBase = new TableBase("BlazingPizza.Order", null, relationalModel); + var createdTimeColumnBase = new ColumnBase("CreatedTime", "TEXT", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("CreatedTime", createdTimeColumnBase); + var deliveryAddressIdColumnBase = new ColumnBase("DeliveryAddressId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("DeliveryAddressId", deliveryAddressIdColumnBase); + var orderIdColumnBase0 = new ColumnBase("OrderId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("OrderId", orderIdColumnBase0); + var userIdColumnBase0 = new ColumnBase("UserId", "TEXT", blazingPizzaOrderTableBase) + { + IsNullable = true + }; + blazingPizzaOrderTableBase.Columns.Add("UserId", userIdColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.Order", blazingPizzaOrderTableBase); + var blazingPizzaOrderMappingBase = new TableMappingBase(order, blazingPizzaOrderTableBase, true); + blazingPizzaOrderTableBase.AddTypeMapping(blazingPizzaOrderMappingBase, false); + defaultTableMappings2.Add(blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase0, order.FindProperty("OrderId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdTimeColumnBase, order.FindProperty("CreatedTime")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deliveryAddressIdColumnBase, order.FindProperty("DeliveryAddressId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase0, order.FindProperty("UserId")!, blazingPizzaOrderMappingBase); + + var tableMappings2 = new List(); + order.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); + var ordersTableMapping0 = new TableMapping(order, ordersTable, true) + { + IsSharedTablePrincipal = true, + }; + ordersTable.AddTypeMapping(ordersTableMapping0, false); + tableMappings2.Add(ordersTableMapping0); + RelationalModel.CreateColumnMapping(orderIdColumn, order.FindProperty("OrderId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(createdTimeColumn, order.FindProperty("CreatedTime")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(deliveryAddressIdColumn, order.FindProperty("DeliveryAddressId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(userIdColumn, order.FindProperty("UserId")!, ordersTableMapping0); + + var pizza = FindEntityType("BlazingPizza.Pizza")!; + + var defaultTableMappings3 = new List>(); + pizza.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings3); + var blazingPizzaPizzaTableBase = new TableBase("BlazingPizza.Pizza", null, relationalModel); + var idColumnBase0 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Id", idColumnBase0); + var orderIdColumnBase1 = new ColumnBase("OrderId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("OrderId", orderIdColumnBase1); + var sizeColumnBase = new ColumnBase("Size", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Size", sizeColumnBase); + var specialIdColumnBase = new ColumnBase("SpecialId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("SpecialId", specialIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Pizza", blazingPizzaPizzaTableBase); + var blazingPizzaPizzaMappingBase = new TableMappingBase(pizza, blazingPizzaPizzaTableBase, true); + blazingPizzaPizzaTableBase.AddTypeMapping(blazingPizzaPizzaMappingBase, false); + defaultTableMappings3.Add(blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, pizza.FindProperty("Id")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase1, pizza.FindProperty("OrderId")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sizeColumnBase, pizza.FindProperty("Size")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)specialIdColumnBase, pizza.FindProperty("SpecialId")!, blazingPizzaPizzaMappingBase); + + var tableMappings3 = new List(); + pizza.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); + var pizzasTable = new Table("Pizzas", null, relationalModel); + var idColumn0 = new Column("Id", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Id", idColumn0); + var orderIdColumn0 = new Column("OrderId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("OrderId", orderIdColumn0); + var sizeColumn = new Column("Size", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Size", sizeColumn); + var specialIdColumn = new Column("SpecialId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("SpecialId", specialIdColumn); + var pK_Pizzas = new UniqueConstraint("PK_Pizzas", pizzasTable, new[] { idColumn0 }); + pizzasTable.PrimaryKey = pK_Pizzas; + var pK_PizzasUc = RelationalModel.GetKey(this, + "BlazingPizza.Pizza", + new[] { "Id" }); + pK_Pizzas.MappedKeys.Add(pK_PizzasUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzasUc).Add(pK_Pizzas); + pizzasTable.UniqueConstraints.Add("PK_Pizzas", pK_Pizzas); + var iX_Pizzas_OrderId = new TableIndex( + "IX_Pizzas_OrderId", pizzasTable, new[] { orderIdColumn0 }, false); + var iX_Pizzas_OrderIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }); + iX_Pizzas_OrderId.MappedIndexes.Add(iX_Pizzas_OrderIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_OrderIdIx).Add(iX_Pizzas_OrderId); + pizzasTable.Indexes.Add("IX_Pizzas_OrderId", iX_Pizzas_OrderId); + var iX_Pizzas_SpecialId = new TableIndex( + "IX_Pizzas_SpecialId", pizzasTable, new[] { specialIdColumn }, false); + var iX_Pizzas_SpecialIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }); + iX_Pizzas_SpecialId.MappedIndexes.Add(iX_Pizzas_SpecialIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_SpecialIdIx).Add(iX_Pizzas_SpecialId); + pizzasTable.Indexes.Add("IX_Pizzas_SpecialId", iX_Pizzas_SpecialId); + relationalModel.Tables.Add(("Pizzas", null), pizzasTable); + var pizzasTableMapping = new TableMapping(pizza, pizzasTable, true); + pizzasTable.AddTypeMapping(pizzasTableMapping, false); + tableMappings3.Add(pizzasTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, pizza.FindProperty("Id")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(orderIdColumn0, pizza.FindProperty("OrderId")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(sizeColumn, pizza.FindProperty("Size")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(specialIdColumn, pizza.FindProperty("SpecialId")!, pizzasTableMapping); + + var pizzaSpecial = FindEntityType("BlazingPizza.PizzaSpecial")!; + + var defaultTableMappings4 = new List>(); + pizzaSpecial.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); + var blazingPizzaPizzaSpecialTableBase = new TableBase("BlazingPizza.PizzaSpecial", null, relationalModel); + var basePriceColumnBase = new ColumnBase("BasePrice", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("BasePrice", basePriceColumnBase); + var descriptionColumnBase = new ColumnBase("Description", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Description", descriptionColumnBase); + var idColumnBase1 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Id", idColumnBase1); + var imageUrlColumnBase = new ColumnBase("ImageUrl", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("ImageUrl", imageUrlColumnBase); + var nameColumnBase0 = new ColumnBase("Name", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Name", nameColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaSpecial", blazingPizzaPizzaSpecialTableBase); + var blazingPizzaPizzaSpecialMappingBase = new TableMappingBase(pizzaSpecial, blazingPizzaPizzaSpecialTableBase, true); + blazingPizzaPizzaSpecialTableBase.AddTypeMapping(blazingPizzaPizzaSpecialMappingBase, false); + defaultTableMappings4.Add(blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, pizzaSpecial.FindProperty("Id")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)basePriceColumnBase, pizzaSpecial.FindProperty("BasePrice")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase, pizzaSpecial.FindProperty("Description")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)imageUrlColumnBase, pizzaSpecial.FindProperty("ImageUrl")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase0, pizzaSpecial.FindProperty("Name")!, blazingPizzaPizzaSpecialMappingBase); + + var tableMappings4 = new List(); + pizzaSpecial.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); + var specialsTable = new Table("Specials", null, relationalModel); + var idColumn1 = new Column("Id", "INTEGER", specialsTable); + specialsTable.Columns.Add("Id", idColumn1); + var basePriceColumn = new Column("BasePrice", "TEXT", specialsTable); + specialsTable.Columns.Add("BasePrice", basePriceColumn); + var descriptionColumn = new Column("Description", "TEXT", specialsTable); + specialsTable.Columns.Add("Description", descriptionColumn); + var imageUrlColumn = new Column("ImageUrl", "TEXT", specialsTable); + specialsTable.Columns.Add("ImageUrl", imageUrlColumn); + var nameColumn0 = new Column("Name", "TEXT", specialsTable); + specialsTable.Columns.Add("Name", nameColumn0); + var pK_Specials = new UniqueConstraint("PK_Specials", specialsTable, new[] { idColumn1 }); + specialsTable.PrimaryKey = pK_Specials; + var pK_SpecialsUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + pK_Specials.MappedKeys.Add(pK_SpecialsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_SpecialsUc).Add(pK_Specials); + specialsTable.UniqueConstraints.Add("PK_Specials", pK_Specials); + relationalModel.Tables.Add(("Specials", null), specialsTable); + var specialsTableMapping = new TableMapping(pizzaSpecial, specialsTable, true); + specialsTable.AddTypeMapping(specialsTableMapping, false); + tableMappings4.Add(specialsTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, pizzaSpecial.FindProperty("Id")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(basePriceColumn, pizzaSpecial.FindProperty("BasePrice")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn, pizzaSpecial.FindProperty("Description")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(imageUrlColumn, pizzaSpecial.FindProperty("ImageUrl")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn0, pizzaSpecial.FindProperty("Name")!, specialsTableMapping); + + var pizzaTopping = FindEntityType("BlazingPizza.PizzaTopping")!; + + var defaultTableMappings5 = new List>(); + pizzaTopping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings5); + var blazingPizzaPizzaToppingTableBase = new TableBase("BlazingPizza.PizzaTopping", null, relationalModel); + var pizzaIdColumnBase = new ColumnBase("PizzaId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("PizzaId", pizzaIdColumnBase); + var toppingIdColumnBase = new ColumnBase("ToppingId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("ToppingId", toppingIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaTopping", blazingPizzaPizzaToppingTableBase); + var blazingPizzaPizzaToppingMappingBase = new TableMappingBase(pizzaTopping, blazingPizzaPizzaToppingTableBase, true); + blazingPizzaPizzaToppingTableBase.AddTypeMapping(blazingPizzaPizzaToppingMappingBase, false); + defaultTableMappings5.Add(blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pizzaIdColumnBase, pizzaTopping.FindProperty("PizzaId")!, blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)toppingIdColumnBase, pizzaTopping.FindProperty("ToppingId")!, blazingPizzaPizzaToppingMappingBase); + + var tableMappings5 = new List(); + pizzaTopping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); + var pizzaToppingTable = new Table("PizzaTopping", null, relationalModel); + var pizzaIdColumn = new Column("PizzaId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("PizzaId", pizzaIdColumn); + var toppingIdColumn = new Column("ToppingId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("ToppingId", toppingIdColumn); + var pK_PizzaTopping = new UniqueConstraint("PK_PizzaTopping", pizzaToppingTable, new[] { pizzaIdColumn, toppingIdColumn }); + pizzaToppingTable.PrimaryKey = pK_PizzaTopping; + var pK_PizzaToppingUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId", "ToppingId" }); + pK_PizzaTopping.MappedKeys.Add(pK_PizzaToppingUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzaToppingUc).Add(pK_PizzaTopping); + pizzaToppingTable.UniqueConstraints.Add("PK_PizzaTopping", pK_PizzaTopping); + var iX_PizzaTopping_ToppingId = new TableIndex( + "IX_PizzaTopping_ToppingId", pizzaToppingTable, new[] { toppingIdColumn }, false); + var iX_PizzaTopping_ToppingIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }); + iX_PizzaTopping_ToppingId.MappedIndexes.Add(iX_PizzaTopping_ToppingIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PizzaTopping_ToppingIdIx).Add(iX_PizzaTopping_ToppingId); + pizzaToppingTable.Indexes.Add("IX_PizzaTopping_ToppingId", iX_PizzaTopping_ToppingId); + relationalModel.Tables.Add(("PizzaTopping", null), pizzaToppingTable); + var pizzaToppingTableMapping = new TableMapping(pizzaTopping, pizzaToppingTable, true); + pizzaToppingTable.AddTypeMapping(pizzaToppingTableMapping, false); + tableMappings5.Add(pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(pizzaIdColumn, pizzaTopping.FindProperty("PizzaId")!, pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(toppingIdColumn, pizzaTopping.FindProperty("ToppingId")!, pizzaToppingTableMapping); + + var pizzaStoreUser = FindEntityType("BlazingPizza.Server.PizzaStoreUser")!; + + var defaultTableMappings6 = new List>(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings6); + var blazingPizzaServerPizzaStoreUserTableBase = new TableBase("BlazingPizza.Server.PizzaStoreUser", null, relationalModel); + var accessFailedCountColumnBase = new ColumnBase("AccessFailedCount", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("AccessFailedCount", accessFailedCountColumnBase); + var concurrencyStampColumnBase = new ColumnBase("ConcurrencyStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase); + var emailColumnBase = new ColumnBase("Email", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Email", emailColumnBase); + var emailConfirmedColumnBase = new ColumnBase("EmailConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("EmailConfirmed", emailConfirmedColumnBase); + var idColumnBase2 = new ColumnBase("Id", "TEXT", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Id", idColumnBase2); + var lockoutEnabledColumnBase = new ColumnBase("LockoutEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnabled", lockoutEnabledColumnBase); + var lockoutEndColumnBase = new ColumnBase("LockoutEnd", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnd", lockoutEndColumnBase); + var normalizedEmailColumnBase = new ColumnBase("NormalizedEmail", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedEmail", normalizedEmailColumnBase); + var normalizedUserNameColumnBase = new ColumnBase("NormalizedUserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedUserName", normalizedUserNameColumnBase); + var passwordHashColumnBase = new ColumnBase("PasswordHash", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PasswordHash", passwordHashColumnBase); + var phoneNumberColumnBase = new ColumnBase("PhoneNumber", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumber", phoneNumberColumnBase); + var phoneNumberConfirmedColumnBase = new ColumnBase("PhoneNumberConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumnBase); + var securityStampColumnBase = new ColumnBase("SecurityStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("SecurityStamp", securityStampColumnBase); + var twoFactorEnabledColumnBase = new ColumnBase("TwoFactorEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumnBase); + var userNameColumnBase = new ColumnBase("UserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("UserName", userNameColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Server.PizzaStoreUser", blazingPizzaServerPizzaStoreUserTableBase); + var blazingPizzaServerPizzaStoreUserMappingBase = new TableMappingBase(pizzaStoreUser, blazingPizzaServerPizzaStoreUserTableBase, true); + blazingPizzaServerPizzaStoreUserTableBase.AddTypeMapping(blazingPizzaServerPizzaStoreUserMappingBase, false); + defaultTableMappings6.Add(blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, pizzaStoreUser.FindProperty("Id")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)accessFailedCountColumnBase, pizzaStoreUser.FindProperty("AccessFailedCount")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailColumnBase, pizzaStoreUser.FindProperty("Email")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailConfirmedColumnBase, pizzaStoreUser.FindProperty("EmailConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEnabledColumnBase, pizzaStoreUser.FindProperty("LockoutEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEndColumnBase, pizzaStoreUser.FindProperty("LockoutEnd")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedEmailColumnBase, pizzaStoreUser.FindProperty("NormalizedEmail")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedUserNameColumnBase, pizzaStoreUser.FindProperty("NormalizedUserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)passwordHashColumnBase, pizzaStoreUser.FindProperty("PasswordHash")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberColumnBase, pizzaStoreUser.FindProperty("PhoneNumber")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberConfirmedColumnBase, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)securityStampColumnBase, pizzaStoreUser.FindProperty("SecurityStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)twoFactorEnabledColumnBase, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userNameColumnBase, pizzaStoreUser.FindProperty("UserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + + var tableMappings6 = new List(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:TableMappings", tableMappings6); + var aspNetUsersTable = new Table("AspNetUsers", null, relationalModel); + var idColumn2 = new Column("Id", "TEXT", aspNetUsersTable); + aspNetUsersTable.Columns.Add("Id", idColumn2); + var accessFailedCountColumn = new Column("AccessFailedCount", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("AccessFailedCount", accessFailedCountColumn); + var concurrencyStampColumn = new Column("ConcurrencyStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn); + var emailColumn = new Column("Email", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("Email", emailColumn); + var emailConfirmedColumn = new Column("EmailConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("EmailConfirmed", emailConfirmedColumn); + var lockoutEnabledColumn = new Column("LockoutEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("LockoutEnabled", lockoutEnabledColumn); + var lockoutEndColumn = new Column("LockoutEnd", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("LockoutEnd", lockoutEndColumn); + var normalizedEmailColumn = new Column("NormalizedEmail", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedEmail", normalizedEmailColumn); + var normalizedUserNameColumn = new Column("NormalizedUserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedUserName", normalizedUserNameColumn); + var passwordHashColumn = new Column("PasswordHash", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PasswordHash", passwordHashColumn); + var phoneNumberColumn = new Column("PhoneNumber", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PhoneNumber", phoneNumberColumn); + var phoneNumberConfirmedColumn = new Column("PhoneNumberConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumn); + var securityStampColumn = new Column("SecurityStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("SecurityStamp", securityStampColumn); + var twoFactorEnabledColumn = new Column("TwoFactorEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumn); + var userNameColumn = new Column("UserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("UserName", userNameColumn); + var pK_AspNetUsers = new UniqueConstraint("PK_AspNetUsers", aspNetUsersTable, new[] { idColumn2 }); + aspNetUsersTable.PrimaryKey = pK_AspNetUsers; + var pK_AspNetUsersUc = RelationalModel.GetKey(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + pK_AspNetUsers.MappedKeys.Add(pK_AspNetUsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUsersUc).Add(pK_AspNetUsers); + aspNetUsersTable.UniqueConstraints.Add("PK_AspNetUsers", pK_AspNetUsers); + var emailIndex = new TableIndex( + "EmailIndex", aspNetUsersTable, new[] { normalizedEmailColumn }, false); + var emailIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedEmail" }); + emailIndex.MappedIndexes.Add(emailIndexIx); + RelationalModel.GetOrCreateTableIndexes(emailIndexIx).Add(emailIndex); + aspNetUsersTable.Indexes.Add("EmailIndex", emailIndex); + var userNameIndex = new TableIndex( + "UserNameIndex", aspNetUsersTable, new[] { normalizedUserNameColumn }, true); + var userNameIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedUserName" }); + userNameIndex.MappedIndexes.Add(userNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(userNameIndexIx).Add(userNameIndex); + aspNetUsersTable.Indexes.Add("UserNameIndex", userNameIndex); + relationalModel.Tables.Add(("AspNetUsers", null), aspNetUsersTable); + var aspNetUsersTableMapping = new TableMapping(pizzaStoreUser, aspNetUsersTable, true); + aspNetUsersTable.AddTypeMapping(aspNetUsersTableMapping, false); + tableMappings6.Add(aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(idColumn2, pizzaStoreUser.FindProperty("Id")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(accessFailedCountColumn, pizzaStoreUser.FindProperty("AccessFailedCount")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailColumn, pizzaStoreUser.FindProperty("Email")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailConfirmedColumn, pizzaStoreUser.FindProperty("EmailConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEnabledColumn, pizzaStoreUser.FindProperty("LockoutEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEndColumn, pizzaStoreUser.FindProperty("LockoutEnd")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedEmailColumn, pizzaStoreUser.FindProperty("NormalizedEmail")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedUserNameColumn, pizzaStoreUser.FindProperty("NormalizedUserName")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(passwordHashColumn, pizzaStoreUser.FindProperty("PasswordHash")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberColumn, pizzaStoreUser.FindProperty("PhoneNumber")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberConfirmedColumn, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(securityStampColumn, pizzaStoreUser.FindProperty("SecurityStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(twoFactorEnabledColumn, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(userNameColumn, pizzaStoreUser.FindProperty("UserName")!, aspNetUsersTableMapping); + + var topping = FindEntityType("BlazingPizza.Topping")!; + + var defaultTableMappings7 = new List>(); + topping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings7); + var blazingPizzaToppingTableBase = new TableBase("BlazingPizza.Topping", null, relationalModel); + var idColumnBase3 = new ColumnBase("Id", "INTEGER", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Id", idColumnBase3); + var nameColumnBase1 = new ColumnBase("Name", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Name", nameColumnBase1); + var priceColumnBase = new ColumnBase("Price", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Price", priceColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Topping", blazingPizzaToppingTableBase); + var blazingPizzaToppingMappingBase = new TableMappingBase(topping, blazingPizzaToppingTableBase, true); + blazingPizzaToppingTableBase.AddTypeMapping(blazingPizzaToppingMappingBase, false); + defaultTableMappings7.Add(blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase3, topping.FindProperty("Id")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase1, topping.FindProperty("Name")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)priceColumnBase, topping.FindProperty("Price")!, blazingPizzaToppingMappingBase); + + var tableMappings7 = new List(); + topping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings7); + var toppingsTable = new Table("Toppings", null, relationalModel); + var idColumn3 = new Column("Id", "INTEGER", toppingsTable); + toppingsTable.Columns.Add("Id", idColumn3); + var nameColumn1 = new Column("Name", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Name", nameColumn1); + var priceColumn = new Column("Price", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Price", priceColumn); + var pK_Toppings = new UniqueConstraint("PK_Toppings", toppingsTable, new[] { idColumn3 }); + toppingsTable.PrimaryKey = pK_Toppings; + var pK_ToppingsUc = RelationalModel.GetKey(this, + "BlazingPizza.Topping", + new[] { "Id" }); + pK_Toppings.MappedKeys.Add(pK_ToppingsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_ToppingsUc).Add(pK_Toppings); + toppingsTable.UniqueConstraints.Add("PK_Toppings", pK_Toppings); + relationalModel.Tables.Add(("Toppings", null), toppingsTable); + var toppingsTableMapping = new TableMapping(topping, toppingsTable, true); + toppingsTable.AddTypeMapping(toppingsTableMapping, false); + tableMappings7.Add(toppingsTableMapping); + RelationalModel.CreateColumnMapping(idColumn3, topping.FindProperty("Id")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn1, topping.FindProperty("Name")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(priceColumn, topping.FindProperty("Price")!, toppingsTableMapping); + + var deviceFlowCodes = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes")!; + + var defaultTableMappings8 = new List>(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings8); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", null, relationalModel); + var clientIdColumnBase = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("ClientId", clientIdColumnBase); + var creationTimeColumnBase = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("CreationTime", creationTimeColumnBase); + var dataColumnBase = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Data", dataColumnBase); + var descriptionColumnBase0 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Description", descriptionColumnBase0); + var deviceCodeColumnBase = new ColumnBase("DeviceCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("DeviceCode", deviceCodeColumnBase); + var expirationColumnBase = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Expiration", expirationColumnBase); + var sessionIdColumnBase = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SessionId", sessionIdColumnBase); + var subjectIdColumnBase = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SubjectId", subjectIdColumnBase); + var userCodeColumnBase = new ColumnBase("UserCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("UserCode", userCodeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase = new TableMappingBase(deviceFlowCodes, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase, false); + defaultTableMappings8.Add(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userCodeColumnBase, deviceFlowCodes.FindProperty("UserCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase, deviceFlowCodes.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase, deviceFlowCodes.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, deviceFlowCodes.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase0, deviceFlowCodes.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deviceCodeColumnBase, deviceFlowCodes.FindProperty("DeviceCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase, deviceFlowCodes.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase, deviceFlowCodes.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase, deviceFlowCodes.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + + var tableMappings8 = new List(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:TableMappings", tableMappings8); + var deviceCodesTable = new Table("DeviceCodes", null, relationalModel); + var userCodeColumn = new Column("UserCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("UserCode", userCodeColumn); + var clientIdColumn = new Column("ClientId", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("ClientId", clientIdColumn); + var creationTimeColumn = new Column("CreationTime", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("CreationTime", creationTimeColumn); + var dataColumn = new Column("Data", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Data", dataColumn); + var descriptionColumn0 = new Column("Description", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("Description", descriptionColumn0); + var deviceCodeColumn = new Column("DeviceCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("DeviceCode", deviceCodeColumn); + var expirationColumn = new Column("Expiration", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Expiration", expirationColumn); + var sessionIdColumn = new Column("SessionId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SessionId", sessionIdColumn); + var subjectIdColumn = new Column("SubjectId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SubjectId", subjectIdColumn); + var pK_DeviceCodes = new UniqueConstraint("PK_DeviceCodes", deviceCodesTable, new[] { userCodeColumn }); + deviceCodesTable.PrimaryKey = pK_DeviceCodes; + var pK_DeviceCodesUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "UserCode" }); + pK_DeviceCodes.MappedKeys.Add(pK_DeviceCodesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_DeviceCodesUc).Add(pK_DeviceCodes); + deviceCodesTable.UniqueConstraints.Add("PK_DeviceCodes", pK_DeviceCodes); + var iX_DeviceCodes_DeviceCode = new TableIndex( + "IX_DeviceCodes_DeviceCode", deviceCodesTable, new[] { deviceCodeColumn }, true); + var iX_DeviceCodes_DeviceCodeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "DeviceCode" }); + iX_DeviceCodes_DeviceCode.MappedIndexes.Add(iX_DeviceCodes_DeviceCodeIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_DeviceCodeIx).Add(iX_DeviceCodes_DeviceCode); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_DeviceCode", iX_DeviceCodes_DeviceCode); + var iX_DeviceCodes_Expiration = new TableIndex( + "IX_DeviceCodes_Expiration", deviceCodesTable, new[] { expirationColumn }, false); + var iX_DeviceCodes_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "Expiration" }); + iX_DeviceCodes_Expiration.MappedIndexes.Add(iX_DeviceCodes_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_ExpirationIx).Add(iX_DeviceCodes_Expiration); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_Expiration", iX_DeviceCodes_Expiration); + relationalModel.Tables.Add(("DeviceCodes", null), deviceCodesTable); + var deviceCodesTableMapping = new TableMapping(deviceFlowCodes, deviceCodesTable, true); + deviceCodesTable.AddTypeMapping(deviceCodesTableMapping, false); + tableMappings8.Add(deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(userCodeColumn, deviceFlowCodes.FindProperty("UserCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn, deviceFlowCodes.FindProperty("ClientId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn, deviceFlowCodes.FindProperty("CreationTime")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, deviceFlowCodes.FindProperty("Data")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn0, deviceFlowCodes.FindProperty("Description")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(deviceCodeColumn, deviceFlowCodes.FindProperty("DeviceCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn, deviceFlowCodes.FindProperty("Expiration")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn, deviceFlowCodes.FindProperty("SessionId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn, deviceFlowCodes.FindProperty("SubjectId")!, deviceCodesTableMapping); + + var key = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.Key")!; + + var defaultTableMappings9 = new List>(); + key.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings9); + var duendeIdentityServerEntityFrameworkEntitiesKeyTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.Key", null, relationalModel); + var algorithmColumnBase = new ColumnBase("Algorithm", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Algorithm", algorithmColumnBase); + var createdColumnBase = new ColumnBase("Created", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Created", createdColumnBase); + var dataColumnBase0 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Data", dataColumnBase0); + var dataProtectedColumnBase = new ColumnBase("DataProtected", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("DataProtected", dataProtectedColumnBase); + var idColumnBase4 = new ColumnBase("Id", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Id", idColumnBase4); + var isX509CertificateColumnBase = new ColumnBase("IsX509Certificate", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("IsX509Certificate", isX509CertificateColumnBase); + var useColumnBase = new ColumnBase("Use", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Use", useColumnBase); + var versionColumnBase = new ColumnBase("Version", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Version", versionColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.Key", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + var duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase = new TableMappingBase(key, duendeIdentityServerEntityFrameworkEntitiesKeyTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase, false); + defaultTableMappings9.Add(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase4, key.FindProperty("Id")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)algorithmColumnBase, key.FindProperty("Algorithm")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdColumnBase, key.FindProperty("Created")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase0, key.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataProtectedColumnBase, key.FindProperty("DataProtected")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)isX509CertificateColumnBase, key.FindProperty("IsX509Certificate")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)useColumnBase, key.FindProperty("Use")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)versionColumnBase, key.FindProperty("Version")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + + var tableMappings9 = new List(); + key.SetRuntimeAnnotation("Relational:TableMappings", tableMappings9); + var keysTable = new Table("Keys", null, relationalModel); + var idColumn4 = new Column("Id", "TEXT", keysTable); + keysTable.Columns.Add("Id", idColumn4); + var algorithmColumn = new Column("Algorithm", "TEXT", keysTable); + keysTable.Columns.Add("Algorithm", algorithmColumn); + var createdColumn = new Column("Created", "TEXT", keysTable); + keysTable.Columns.Add("Created", createdColumn); + var dataColumn0 = new Column("Data", "TEXT", keysTable); + keysTable.Columns.Add("Data", dataColumn0); + var dataProtectedColumn = new Column("DataProtected", "INTEGER", keysTable); + keysTable.Columns.Add("DataProtected", dataProtectedColumn); + var isX509CertificateColumn = new Column("IsX509Certificate", "INTEGER", keysTable); + keysTable.Columns.Add("IsX509Certificate", isX509CertificateColumn); + var useColumn = new Column("Use", "TEXT", keysTable) + { + IsNullable = true + }; + keysTable.Columns.Add("Use", useColumn); + var versionColumn = new Column("Version", "INTEGER", keysTable); + keysTable.Columns.Add("Version", versionColumn); + var pK_Keys = new UniqueConstraint("PK_Keys", keysTable, new[] { idColumn4 }); + keysTable.PrimaryKey = pK_Keys; + var pK_KeysUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Id" }); + pK_Keys.MappedKeys.Add(pK_KeysUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_KeysUc).Add(pK_Keys); + keysTable.UniqueConstraints.Add("PK_Keys", pK_Keys); + var iX_Keys_Use = new TableIndex( + "IX_Keys_Use", keysTable, new[] { useColumn }, false); + var iX_Keys_UseIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Use" }); + iX_Keys_Use.MappedIndexes.Add(iX_Keys_UseIx); + RelationalModel.GetOrCreateTableIndexes(iX_Keys_UseIx).Add(iX_Keys_Use); + keysTable.Indexes.Add("IX_Keys_Use", iX_Keys_Use); + relationalModel.Tables.Add(("Keys", null), keysTable); + var keysTableMapping = new TableMapping(key, keysTable, true); + keysTable.AddTypeMapping(keysTableMapping, false); + tableMappings9.Add(keysTableMapping); + RelationalModel.CreateColumnMapping(idColumn4, key.FindProperty("Id")!, keysTableMapping); + RelationalModel.CreateColumnMapping(algorithmColumn, key.FindProperty("Algorithm")!, keysTableMapping); + RelationalModel.CreateColumnMapping(createdColumn, key.FindProperty("Created")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataColumn0, key.FindProperty("Data")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataProtectedColumn, key.FindProperty("DataProtected")!, keysTableMapping); + RelationalModel.CreateColumnMapping(isX509CertificateColumn, key.FindProperty("IsX509Certificate")!, keysTableMapping); + RelationalModel.CreateColumnMapping(useColumn, key.FindProperty("Use")!, keysTableMapping); + RelationalModel.CreateColumnMapping(versionColumn, key.FindProperty("Version")!, keysTableMapping); + + var persistedGrant = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant")!; + + var defaultTableMappings10 = new List>(); + persistedGrant.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings10); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", null, relationalModel); + var clientIdColumnBase0 = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ClientId", clientIdColumnBase0); + var consumedTimeColumnBase = new ColumnBase("ConsumedTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ConsumedTime", consumedTimeColumnBase); + var creationTimeColumnBase0 = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("CreationTime", creationTimeColumnBase0); + var dataColumnBase1 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Data", dataColumnBase1); + var descriptionColumnBase1 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Description", descriptionColumnBase1); + var expirationColumnBase0 = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Expiration", expirationColumnBase0); + var keyColumnBase = new ColumnBase("Key", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Key", keyColumnBase); + var sessionIdColumnBase0 = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SessionId", sessionIdColumnBase0); + var subjectIdColumnBase0 = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SubjectId", subjectIdColumnBase0); + var typeColumnBase = new ColumnBase("Type", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Type", typeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase = new TableMappingBase(persistedGrant, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase, false); + defaultTableMappings10.Add(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)keyColumnBase, persistedGrant.FindProperty("Key")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase0, persistedGrant.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)consumedTimeColumnBase, persistedGrant.FindProperty("ConsumedTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase0, persistedGrant.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase1, persistedGrant.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase1, persistedGrant.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase0, persistedGrant.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase0, persistedGrant.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase0, persistedGrant.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)typeColumnBase, persistedGrant.FindProperty("Type")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + + var tableMappings10 = new List(); + persistedGrant.SetRuntimeAnnotation("Relational:TableMappings", tableMappings10); + var persistedGrantsTable = new Table("PersistedGrants", null, relationalModel); + var keyColumn = new Column("Key", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Key", keyColumn); + var clientIdColumn0 = new Column("ClientId", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("ClientId", clientIdColumn0); + var consumedTimeColumn = new Column("ConsumedTime", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("ConsumedTime", consumedTimeColumn); + var creationTimeColumn0 = new Column("CreationTime", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("CreationTime", creationTimeColumn0); + var dataColumn1 = new Column("Data", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Data", dataColumn1); + var descriptionColumn1 = new Column("Description", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Description", descriptionColumn1); + var expirationColumn0 = new Column("Expiration", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Expiration", expirationColumn0); + var sessionIdColumn0 = new Column("SessionId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SessionId", sessionIdColumn0); + var subjectIdColumn0 = new Column("SubjectId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SubjectId", subjectIdColumn0); + var typeColumn = new Column("Type", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Type", typeColumn); + var pK_PersistedGrants = new UniqueConstraint("PK_PersistedGrants", persistedGrantsTable, new[] { keyColumn }); + persistedGrantsTable.PrimaryKey = pK_PersistedGrants; + var pK_PersistedGrantsUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Key" }); + pK_PersistedGrants.MappedKeys.Add(pK_PersistedGrantsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PersistedGrantsUc).Add(pK_PersistedGrants); + persistedGrantsTable.UniqueConstraints.Add("PK_PersistedGrants", pK_PersistedGrants); + var iX_PersistedGrants_ConsumedTime = new TableIndex( + "IX_PersistedGrants_ConsumedTime", persistedGrantsTable, new[] { consumedTimeColumn }, false); + var iX_PersistedGrants_ConsumedTimeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "ConsumedTime" }); + iX_PersistedGrants_ConsumedTime.MappedIndexes.Add(iX_PersistedGrants_ConsumedTimeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ConsumedTimeIx).Add(iX_PersistedGrants_ConsumedTime); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_ConsumedTime", iX_PersistedGrants_ConsumedTime); + var iX_PersistedGrants_Expiration = new TableIndex( + "IX_PersistedGrants_Expiration", persistedGrantsTable, new[] { expirationColumn0 }, false); + var iX_PersistedGrants_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Expiration" }); + iX_PersistedGrants_Expiration.MappedIndexes.Add(iX_PersistedGrants_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ExpirationIx).Add(iX_PersistedGrants_Expiration); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_Expiration", iX_PersistedGrants_Expiration); + var iX_PersistedGrants_SubjectId_ClientId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_ClientId_Type", persistedGrantsTable, new[] { subjectIdColumn0, clientIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_ClientId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "ClientId", "Type" }); + iX_PersistedGrants_SubjectId_ClientId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_ClientId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_ClientId_TypeIx).Add(iX_PersistedGrants_SubjectId_ClientId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_ClientId_Type", iX_PersistedGrants_SubjectId_ClientId_Type); + var iX_PersistedGrants_SubjectId_SessionId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_SessionId_Type", persistedGrantsTable, new[] { subjectIdColumn0, sessionIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_SessionId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "SessionId", "Type" }); + iX_PersistedGrants_SubjectId_SessionId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_SessionId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_SessionId_TypeIx).Add(iX_PersistedGrants_SubjectId_SessionId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_SessionId_Type", iX_PersistedGrants_SubjectId_SessionId_Type); + relationalModel.Tables.Add(("PersistedGrants", null), persistedGrantsTable); + var persistedGrantsTableMapping = new TableMapping(persistedGrant, persistedGrantsTable, true); + persistedGrantsTable.AddTypeMapping(persistedGrantsTableMapping, false); + tableMappings10.Add(persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(keyColumn, persistedGrant.FindProperty("Key")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn0, persistedGrant.FindProperty("ClientId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(consumedTimeColumn, persistedGrant.FindProperty("ConsumedTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn0, persistedGrant.FindProperty("CreationTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(dataColumn1, persistedGrant.FindProperty("Data")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn1, persistedGrant.FindProperty("Description")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn0, persistedGrant.FindProperty("Expiration")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn0, persistedGrant.FindProperty("SessionId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn0, persistedGrant.FindProperty("SubjectId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(typeColumn, persistedGrant.FindProperty("Type")!, persistedGrantsTableMapping); + + var identityRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRole")!; + + var defaultTableMappings11 = new List>(); + identityRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings11); + var microsoftAspNetCoreIdentityIdentityRoleTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRole", null, relationalModel); + var concurrencyStampColumnBase0 = new ColumnBase("ConcurrencyStamp", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase0); + var idColumnBase5 = new ColumnBase("Id", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase); + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Id", idColumnBase5); + var nameColumnBase2 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Name", nameColumnBase2); + var normalizedNameColumnBase = new ColumnBase("NormalizedName", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("NormalizedName", normalizedNameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRole", microsoftAspNetCoreIdentityIdentityRoleTableBase); + var microsoftAspNetCoreIdentityIdentityRoleMappingBase = new TableMappingBase(identityRole, microsoftAspNetCoreIdentityIdentityRoleTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleMappingBase, false); + defaultTableMappings11.Add(microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase5, identityRole.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase0, identityRole.FindProperty("ConcurrencyStamp")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase2, identityRole.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedNameColumnBase, identityRole.FindProperty("NormalizedName")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + + var tableMappings11 = new List(); + identityRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings11); + var aspNetRolesTable = new Table("AspNetRoles", null, relationalModel); + var idColumn5 = new Column("Id", "TEXT", aspNetRolesTable); + aspNetRolesTable.Columns.Add("Id", idColumn5); + var concurrencyStampColumn0 = new Column("ConcurrencyStamp", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn0); + var nameColumn2 = new Column("Name", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("Name", nameColumn2); + var normalizedNameColumn = new Column("NormalizedName", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("NormalizedName", normalizedNameColumn); + var pK_AspNetRoles = new UniqueConstraint("PK_AspNetRoles", aspNetRolesTable, new[] { idColumn5 }); + aspNetRolesTable.PrimaryKey = pK_AspNetRoles; + var pK_AspNetRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + pK_AspNetRoles.MappedKeys.Add(pK_AspNetRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRolesUc).Add(pK_AspNetRoles); + aspNetRolesTable.UniqueConstraints.Add("PK_AspNetRoles", pK_AspNetRoles); + var roleNameIndex = new TableIndex( + "RoleNameIndex", aspNetRolesTable, new[] { normalizedNameColumn }, true); + var roleNameIndexIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "NormalizedName" }); + roleNameIndex.MappedIndexes.Add(roleNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(roleNameIndexIx).Add(roleNameIndex); + aspNetRolesTable.Indexes.Add("RoleNameIndex", roleNameIndex); + relationalModel.Tables.Add(("AspNetRoles", null), aspNetRolesTable); + var aspNetRolesTableMapping = new TableMapping(identityRole, aspNetRolesTable, true); + aspNetRolesTable.AddTypeMapping(aspNetRolesTableMapping, false); + tableMappings11.Add(aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(idColumn5, identityRole.FindProperty("Id")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn0, identityRole.FindProperty("ConcurrencyStamp")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(nameColumn2, identityRole.FindProperty("Name")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(normalizedNameColumn, identityRole.FindProperty("NormalizedName")!, aspNetRolesTableMapping); + + var identityRoleClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRoleClaim")!; + + var defaultTableMappings12 = new List>(); + identityRoleClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings12); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRoleClaim", null, relationalModel); + var claimTypeColumnBase = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase); + var claimValueColumnBase = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase); + var idColumnBase6 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("Id", idColumnBase6); + var roleIdColumnBase = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("RoleId", roleIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRoleClaim", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase = new TableMappingBase(identityRoleClaim, microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase, false); + defaultTableMappings12.Add(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase6, identityRoleClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase, identityRoleClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase, identityRoleClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase, identityRoleClaim.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + + var tableMappings12 = new List(); + identityRoleClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings12); + var aspNetRoleClaimsTable = new Table("AspNetRoleClaims", null, relationalModel); + var idColumn6 = new Column("Id", "INTEGER", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("Id", idColumn6); + var claimTypeColumn = new Column("ClaimType", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimType", claimTypeColumn); + var claimValueColumn = new Column("ClaimValue", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimValue", claimValueColumn); + var roleIdColumn = new Column("RoleId", "TEXT", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("RoleId", roleIdColumn); + var pK_AspNetRoleClaims = new UniqueConstraint("PK_AspNetRoleClaims", aspNetRoleClaimsTable, new[] { idColumn6 }); + aspNetRoleClaimsTable.PrimaryKey = pK_AspNetRoleClaims; + var pK_AspNetRoleClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "Id" }); + pK_AspNetRoleClaims.MappedKeys.Add(pK_AspNetRoleClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRoleClaimsUc).Add(pK_AspNetRoleClaims); + aspNetRoleClaimsTable.UniqueConstraints.Add("PK_AspNetRoleClaims", pK_AspNetRoleClaims); + var iX_AspNetRoleClaims_RoleId = new TableIndex( + "IX_AspNetRoleClaims_RoleId", aspNetRoleClaimsTable, new[] { roleIdColumn }, false); + var iX_AspNetRoleClaims_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }); + iX_AspNetRoleClaims_RoleId.MappedIndexes.Add(iX_AspNetRoleClaims_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetRoleClaims_RoleIdIx).Add(iX_AspNetRoleClaims_RoleId); + aspNetRoleClaimsTable.Indexes.Add("IX_AspNetRoleClaims_RoleId", iX_AspNetRoleClaims_RoleId); + relationalModel.Tables.Add(("AspNetRoleClaims", null), aspNetRoleClaimsTable); + var aspNetRoleClaimsTableMapping = new TableMapping(identityRoleClaim, aspNetRoleClaimsTable, true); + aspNetRoleClaimsTable.AddTypeMapping(aspNetRoleClaimsTableMapping, false); + tableMappings12.Add(aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn6, identityRoleClaim.FindProperty("Id")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn, identityRoleClaim.FindProperty("ClaimType")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn, identityRoleClaim.FindProperty("ClaimValue")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn, identityRoleClaim.FindProperty("RoleId")!, aspNetRoleClaimsTableMapping); + + var identityUserClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserClaim")!; + + var defaultTableMappings13 = new List>(); + identityUserClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings13); + var microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserClaim", null, relationalModel); + var claimTypeColumnBase0 = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase0); + var claimValueColumnBase0 = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase0); + var idColumnBase7 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("Id", idColumnBase7); + var userIdColumnBase1 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("UserId", userIdColumnBase1); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserClaim", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase = new TableMappingBase(identityUserClaim, microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase, false); + defaultTableMappings13.Add(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase7, identityUserClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase0, identityUserClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase0, identityUserClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase1, identityUserClaim.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + + var tableMappings13 = new List(); + identityUserClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings13); + var aspNetUserClaimsTable = new Table("AspNetUserClaims", null, relationalModel); + var idColumn7 = new Column("Id", "INTEGER", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("Id", idColumn7); + var claimTypeColumn0 = new Column("ClaimType", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimType", claimTypeColumn0); + var claimValueColumn0 = new Column("ClaimValue", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimValue", claimValueColumn0); + var userIdColumn1 = new Column("UserId", "TEXT", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("UserId", userIdColumn1); + var pK_AspNetUserClaims = new UniqueConstraint("PK_AspNetUserClaims", aspNetUserClaimsTable, new[] { idColumn7 }); + aspNetUserClaimsTable.PrimaryKey = pK_AspNetUserClaims; + var pK_AspNetUserClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "Id" }); + pK_AspNetUserClaims.MappedKeys.Add(pK_AspNetUserClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserClaimsUc).Add(pK_AspNetUserClaims); + aspNetUserClaimsTable.UniqueConstraints.Add("PK_AspNetUserClaims", pK_AspNetUserClaims); + var iX_AspNetUserClaims_UserId = new TableIndex( + "IX_AspNetUserClaims_UserId", aspNetUserClaimsTable, new[] { userIdColumn1 }, false); + var iX_AspNetUserClaims_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }); + iX_AspNetUserClaims_UserId.MappedIndexes.Add(iX_AspNetUserClaims_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserClaims_UserIdIx).Add(iX_AspNetUserClaims_UserId); + aspNetUserClaimsTable.Indexes.Add("IX_AspNetUserClaims_UserId", iX_AspNetUserClaims_UserId); + relationalModel.Tables.Add(("AspNetUserClaims", null), aspNetUserClaimsTable); + var aspNetUserClaimsTableMapping = new TableMapping(identityUserClaim, aspNetUserClaimsTable, true); + aspNetUserClaimsTable.AddTypeMapping(aspNetUserClaimsTableMapping, false); + tableMappings13.Add(aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn7, identityUserClaim.FindProperty("Id")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn0, identityUserClaim.FindProperty("ClaimType")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn0, identityUserClaim.FindProperty("ClaimValue")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn1, identityUserClaim.FindProperty("UserId")!, aspNetUserClaimsTableMapping); + + var identityUserLogin = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserLogin")!; + + var defaultTableMappings14 = new List>(); + identityUserLogin.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings14); + var microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserLogin", null, relationalModel); + var loginProviderColumnBase = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase); + var providerDisplayNameColumnBase = new ColumnBase("ProviderDisplayName", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderDisplayName", providerDisplayNameColumnBase); + var providerKeyColumnBase = new ColumnBase("ProviderKey", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderKey", providerKeyColumnBase); + var userIdColumnBase2 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("UserId", userIdColumnBase2); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserLogin", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase = new TableMappingBase(identityUserLogin, microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase, false); + defaultTableMappings14.Add(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase, identityUserLogin.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerKeyColumnBase, identityUserLogin.FindProperty("ProviderKey")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerDisplayNameColumnBase, identityUserLogin.FindProperty("ProviderDisplayName")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase2, identityUserLogin.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + + var tableMappings14 = new List(); + identityUserLogin.SetRuntimeAnnotation("Relational:TableMappings", tableMappings14); + var aspNetUserLoginsTable = new Table("AspNetUserLogins", null, relationalModel); + var loginProviderColumn = new Column("LoginProvider", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("LoginProvider", loginProviderColumn); + var providerKeyColumn = new Column("ProviderKey", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("ProviderKey", providerKeyColumn); + var providerDisplayNameColumn = new Column("ProviderDisplayName", "TEXT", aspNetUserLoginsTable) + { + IsNullable = true + }; + aspNetUserLoginsTable.Columns.Add("ProviderDisplayName", providerDisplayNameColumn); + var userIdColumn2 = new Column("UserId", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("UserId", userIdColumn2); + var pK_AspNetUserLogins = new UniqueConstraint("PK_AspNetUserLogins", aspNetUserLoginsTable, new[] { loginProviderColumn, providerKeyColumn }); + aspNetUserLoginsTable.PrimaryKey = pK_AspNetUserLogins; + var pK_AspNetUserLoginsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "LoginProvider", "ProviderKey" }); + pK_AspNetUserLogins.MappedKeys.Add(pK_AspNetUserLoginsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserLoginsUc).Add(pK_AspNetUserLogins); + aspNetUserLoginsTable.UniqueConstraints.Add("PK_AspNetUserLogins", pK_AspNetUserLogins); + var iX_AspNetUserLogins_UserId = new TableIndex( + "IX_AspNetUserLogins_UserId", aspNetUserLoginsTable, new[] { userIdColumn2 }, false); + var iX_AspNetUserLogins_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }); + iX_AspNetUserLogins_UserId.MappedIndexes.Add(iX_AspNetUserLogins_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserLogins_UserIdIx).Add(iX_AspNetUserLogins_UserId); + aspNetUserLoginsTable.Indexes.Add("IX_AspNetUserLogins_UserId", iX_AspNetUserLogins_UserId); + relationalModel.Tables.Add(("AspNetUserLogins", null), aspNetUserLoginsTable); + var aspNetUserLoginsTableMapping = new TableMapping(identityUserLogin, aspNetUserLoginsTable, true); + aspNetUserLoginsTable.AddTypeMapping(aspNetUserLoginsTableMapping, false); + tableMappings14.Add(aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn, identityUserLogin.FindProperty("LoginProvider")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerKeyColumn, identityUserLogin.FindProperty("ProviderKey")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerDisplayNameColumn, identityUserLogin.FindProperty("ProviderDisplayName")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn2, identityUserLogin.FindProperty("UserId")!, aspNetUserLoginsTableMapping); + + var identityUserRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserRole")!; + + var defaultTableMappings15 = new List>(); + identityUserRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings15); + var microsoftAspNetCoreIdentityIdentityUserRolestringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserRole", null, relationalModel); + var roleIdColumnBase0 = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("RoleId", roleIdColumnBase0); + var userIdColumnBase3 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("UserId", userIdColumnBase3); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserRole", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + var microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase = new TableMappingBase(identityUserRole, microsoftAspNetCoreIdentityIdentityUserRolestringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase, false); + defaultTableMappings15.Add(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase0, identityUserRole.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase3, identityUserRole.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + + var tableMappings15 = new List(); + identityUserRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings15); + var aspNetUserRolesTable = new Table("AspNetUserRoles", null, relationalModel); + var userIdColumn3 = new Column("UserId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("UserId", userIdColumn3); + var roleIdColumn0 = new Column("RoleId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("RoleId", roleIdColumn0); + var pK_AspNetUserRoles = new UniqueConstraint("PK_AspNetUserRoles", aspNetUserRolesTable, new[] { userIdColumn3, roleIdColumn0 }); + aspNetUserRolesTable.PrimaryKey = pK_AspNetUserRoles; + var pK_AspNetUserRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId", "RoleId" }); + pK_AspNetUserRoles.MappedKeys.Add(pK_AspNetUserRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserRolesUc).Add(pK_AspNetUserRoles); + aspNetUserRolesTable.UniqueConstraints.Add("PK_AspNetUserRoles", pK_AspNetUserRoles); + var iX_AspNetUserRoles_RoleId = new TableIndex( + "IX_AspNetUserRoles_RoleId", aspNetUserRolesTable, new[] { roleIdColumn0 }, false); + var iX_AspNetUserRoles_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }); + iX_AspNetUserRoles_RoleId.MappedIndexes.Add(iX_AspNetUserRoles_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserRoles_RoleIdIx).Add(iX_AspNetUserRoles_RoleId); + aspNetUserRolesTable.Indexes.Add("IX_AspNetUserRoles_RoleId", iX_AspNetUserRoles_RoleId); + relationalModel.Tables.Add(("AspNetUserRoles", null), aspNetUserRolesTable); + var aspNetUserRolesTableMapping = new TableMapping(identityUserRole, aspNetUserRolesTable, true); + aspNetUserRolesTable.AddTypeMapping(aspNetUserRolesTableMapping, false); + tableMappings15.Add(aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn0, identityUserRole.FindProperty("RoleId")!, aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn3, identityUserRole.FindProperty("UserId")!, aspNetUserRolesTableMapping); + + var identityUserToken = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserToken")!; + + var defaultTableMappings16 = new List>(); + identityUserToken.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings16); + var microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserToken", null, relationalModel); + var loginProviderColumnBase0 = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase0); + var nameColumnBase3 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Name", nameColumnBase3); + var userIdColumnBase4 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("UserId", userIdColumnBase4); + var valueColumnBase = new ColumnBase("Value", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Value", valueColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserToken", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase = new TableMappingBase(identityUserToken, microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase, false); + defaultTableMappings16.Add(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase0, identityUserToken.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase3, identityUserToken.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase4, identityUserToken.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueColumnBase, identityUserToken.FindProperty("Value")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + + var tableMappings16 = new List(); + identityUserToken.SetRuntimeAnnotation("Relational:TableMappings", tableMappings16); + var aspNetUserTokensTable = new Table("AspNetUserTokens", null, relationalModel); + var userIdColumn4 = new Column("UserId", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("UserId", userIdColumn4); + var loginProviderColumn0 = new Column("LoginProvider", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("LoginProvider", loginProviderColumn0); + var nameColumn3 = new Column("Name", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("Name", nameColumn3); + var valueColumn = new Column("Value", "TEXT", aspNetUserTokensTable) + { + IsNullable = true + }; + aspNetUserTokensTable.Columns.Add("Value", valueColumn); + var pK_AspNetUserTokens = new UniqueConstraint("PK_AspNetUserTokens", aspNetUserTokensTable, new[] { userIdColumn4, loginProviderColumn0, nameColumn3 }); + aspNetUserTokensTable.PrimaryKey = pK_AspNetUserTokens; + var pK_AspNetUserTokensUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId", "LoginProvider", "Name" }); + pK_AspNetUserTokens.MappedKeys.Add(pK_AspNetUserTokensUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserTokensUc).Add(pK_AspNetUserTokens); + aspNetUserTokensTable.UniqueConstraints.Add("PK_AspNetUserTokens", pK_AspNetUserTokens); + relationalModel.Tables.Add(("AspNetUserTokens", null), aspNetUserTokensTable); + var aspNetUserTokensTableMapping = new TableMapping(identityUserToken, aspNetUserTokensTable, true); + aspNetUserTokensTable.AddTypeMapping(aspNetUserTokensTableMapping, false); + tableMappings16.Add(aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn0, identityUserToken.FindProperty("LoginProvider")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(nameColumn3, identityUserToken.FindProperty("Name")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn4, identityUserToken.FindProperty("UserId")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(valueColumn, identityUserToken.FindProperty("Value")!, aspNetUserTokensTableMapping); + var fK_AspNetRoleClaims_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetRoleClaims_AspNetRoles_RoleId", aspNetRoleClaimsTable, aspNetRolesTable, + new[] { roleIdColumn }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetRoleClaims_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetRoleClaims_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk).Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRoleClaimsTable.ForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + var fK_AspNetUserClaims_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserClaims_AspNetUsers_UserId", aspNetUserClaimsTable, aspNetUsersTable, + new[] { userIdColumn1 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserClaims_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserClaims_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserClaims_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserClaims_AspNetUsers_UserIdFk).Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUserClaimsTable.ForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + var fK_AspNetUserLogins_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserLogins_AspNetUsers_UserId", aspNetUserLoginsTable, aspNetUsersTable, + new[] { userIdColumn2 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserLogins_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserLogins_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserLogins_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserLogins_AspNetUsers_UserIdFk).Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUserLoginsTable.ForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + var fK_AspNetUserRoles_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetRoles_RoleId", aspNetUserRolesTable, aspNetRolesTable, + new[] { roleIdColumn0 }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetRoles_RoleIdFk).Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + var fK_AspNetUserRoles_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetUsers_UserId", aspNetUserRolesTable, aspNetUsersTable, + new[] { userIdColumn3 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetUsers_UserIdFk).Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + var fK_AspNetUserTokens_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserTokens_AspNetUsers_UserId", aspNetUserTokensTable, aspNetUsersTable, + new[] { userIdColumn4 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserTokens_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserTokens_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserTokens_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserTokens_AspNetUsers_UserIdFk).Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUserTokensTable.ForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + var fK_Orders_Address_DeliveryAddressId = new ForeignKeyConstraint( + "FK_Orders_Address_DeliveryAddressId", ordersTable, addressTable, + new[] { deliveryAddressIdColumn }, + addressTable.FindUniqueConstraint("PK_Address")!, ReferentialAction.Cascade); + var fK_Orders_Address_DeliveryAddressIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }, + "BlazingPizza.Address", + new[] { "Id" }); + fK_Orders_Address_DeliveryAddressId.MappedForeignKeys.Add(fK_Orders_Address_DeliveryAddressIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Orders_Address_DeliveryAddressIdFk).Add(fK_Orders_Address_DeliveryAddressId); + ordersTable.ForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + addressTable.ReferencingForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + var fK_Pizzas_Orders_OrderId = new ForeignKeyConstraint( + "FK_Pizzas_Orders_OrderId", pizzasTable, ordersTable, + new[] { orderIdColumn0 }, + ordersTable.FindUniqueConstraint("PK_Orders")!, ReferentialAction.Cascade); + var fK_Pizzas_Orders_OrderIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" }); + fK_Pizzas_Orders_OrderId.MappedForeignKeys.Add(fK_Pizzas_Orders_OrderIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Orders_OrderIdFk).Add(fK_Pizzas_Orders_OrderId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + ordersTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + var fK_Pizzas_Specials_SpecialId = new ForeignKeyConstraint( + "FK_Pizzas_Specials_SpecialId", pizzasTable, specialsTable, + new[] { specialIdColumn }, + specialsTable.FindUniqueConstraint("PK_Specials")!, ReferentialAction.Cascade); + var fK_Pizzas_Specials_SpecialIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + fK_Pizzas_Specials_SpecialId.MappedForeignKeys.Add(fK_Pizzas_Specials_SpecialIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Specials_SpecialIdFk).Add(fK_Pizzas_Specials_SpecialId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + specialsTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + var fK_PizzaTopping_Pizzas_PizzaId = new ForeignKeyConstraint( + "FK_PizzaTopping_Pizzas_PizzaId", pizzaToppingTable, pizzasTable, + new[] { pizzaIdColumn }, + pizzasTable.FindUniqueConstraint("PK_Pizzas")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Pizzas_PizzaIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId" }, + "BlazingPizza.Pizza", + new[] { "Id" }); + fK_PizzaTopping_Pizzas_PizzaId.MappedForeignKeys.Add(fK_PizzaTopping_Pizzas_PizzaIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Pizzas_PizzaIdFk).Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzasTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + var fK_PizzaTopping_Toppings_ToppingId = new ForeignKeyConstraint( + "FK_PizzaTopping_Toppings_ToppingId", pizzaToppingTable, toppingsTable, + new[] { toppingIdColumn }, + toppingsTable.FindUniqueConstraint("PK_Toppings")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Toppings_ToppingIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }, + "BlazingPizza.Topping", + new[] { "Id" }); + fK_PizzaTopping_Toppings_ToppingId.MappedForeignKeys.Add(fK_PizzaTopping_Toppings_ToppingIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Toppings_ToppingIdFk).Add(fK_PizzaTopping_Toppings_ToppingId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + toppingsTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs new file mode 100644 index 00000000..7295425c --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs @@ -0,0 +1,249 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaStoreUserEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Server.PizzaStoreUser", + typeof(PizzaStoreUser), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var accessFailedCount = runtimeEntityType.AddProperty( + "AccessFailedCount", + typeof(int), + propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + accessFailedCount.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var concurrencyStamp = runtimeEntityType.AddProperty( + "ConcurrencyStamp", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var email = runtimeEntityType.AddProperty( + "Email", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + email.TypeMapping = SqliteStringTypeMapping.Default; + + var emailConfirmed = runtimeEntityType.AddProperty( + "EmailConfirmed", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + emailConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var lockoutEnabled = runtimeEntityType.AddProperty( + "LockoutEnabled", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + lockoutEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var lockoutEnd = runtimeEntityType.AddProperty( + "LockoutEnd", + typeof(DateTimeOffset?), + propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + lockoutEnd.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default; + + var normalizedEmail = runtimeEntityType.AddProperty( + "NormalizedEmail", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedEmail.TypeMapping = SqliteStringTypeMapping.Default; + + var normalizedUserName = runtimeEntityType.AddProperty( + "NormalizedUserName", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedUserName.TypeMapping = SqliteStringTypeMapping.Default; + + var passwordHash = runtimeEntityType.AddProperty( + "PasswordHash", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + passwordHash.TypeMapping = SqliteStringTypeMapping.Default; + + var phoneNumber = runtimeEntityType.AddProperty( + "PhoneNumber", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + phoneNumber.TypeMapping = SqliteStringTypeMapping.Default; + + var phoneNumberConfirmed = runtimeEntityType.AddProperty( + "PhoneNumberConfirmed", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + phoneNumberConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var securityStamp = runtimeEntityType.AddProperty( + "SecurityStamp", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + securityStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var twoFactorEnabled = runtimeEntityType.AddProperty( + "TwoFactorEnabled", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + twoFactorEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var userName = runtimeEntityType.AddProperty( + "UserName", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + userName.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { normalizedEmail }); + index.AddAnnotation("Relational:Name", "EmailIndex"); + + var index0 = runtimeEntityType.AddIndex( + new[] { normalizedUserName }, + unique: true); + index0.AddAnnotation("Relational:Name", "UserNameIndex"); + + return runtimeEntityType; + } + + 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", "AspNetUsers"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs new file mode 100644 index 00000000..803ab153 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs @@ -0,0 +1,130 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaToppingEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.PizzaTopping", + typeof(PizzaTopping), + baseEntityType); + + var pizzaId = runtimeEntityType.AddProperty( + "PizzaId", + typeof(int), + propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + pizzaId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var toppingId = runtimeEntityType.AddProperty( + "ToppingId", + typeof(int), + propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + toppingId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { pizzaId, toppingId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { toppingId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PizzaId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var toppings = principalEntityType.AddNavigation("Toppings", + runtimeForeignKey, + onDependent: false, + typeof(List), + propertyInfo: typeof(Pizza).GetProperty("Toppings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ToppingId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var topping = declaringEntityType.AddNavigation("Topping", + runtimeForeignKey, + onDependent: true, + typeof(Topping), + propertyInfo: typeof(PizzaTopping).GetProperty("Topping", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("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", "PizzaTopping"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs new file mode 100644 index 00000000..d3a19507 --- /dev/null +++ b/save-points/08-templated-components/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class ToppingEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Topping", + typeof(Topping), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var price = runtimeEntityType.AddProperty( + "Price", + typeof(decimal), + propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + price.TypeMapping = SqliteDecimalTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Toppings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/AddressEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/AddressEntityType.cs deleted file mode 100644 index 82db81b6..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/AddressEntityType.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class AddressEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Address", - typeof(Address), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var city = runtimeEntityType.AddProperty( - "City", - typeof(string), - propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50); - - var line1 = runtimeEntityType.AddProperty( - "Line1", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var line2 = runtimeEntityType.AddProperty( - "Line2", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var postalCode = runtimeEntityType.AddProperty( - "PostalCode", - typeof(string), - propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 20); - - var region = runtimeEntityType.AddProperty( - "Region", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 20); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Address"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs deleted file mode 100644 index 1dd4563b..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class DeviceFlowCodesEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", - typeof(DeviceFlowCodes), - baseEntityType); - - var userCode = runtimeEntityType.AddProperty( - "UserCode", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 200); - - var clientId = runtimeEntityType.AddProperty( - "ClientId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var creationTime = runtimeEntityType.AddProperty( - "CreationTime", - typeof(DateTime), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50000); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var deviceCode = runtimeEntityType.AddProperty( - "DeviceCode", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var expiration = runtimeEntityType.AddProperty( - "Expiration", - typeof(DateTime?), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var sessionId = runtimeEntityType.AddProperty( - "SessionId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var subjectId = runtimeEntityType.AddProperty( - "SubjectId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var key = runtimeEntityType.AddKey( - new[] { userCode }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { deviceCode }, - unique: true); - - var index0 = runtimeEntityType.AddIndex( - new[] { expiration }); - - return runtimeEntityType; - } - - 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", "DeviceCodes"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs deleted file mode 100644 index 8946b261..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityRoleClaimstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityRoleClaim", - typeof(IdentityRoleClaim), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var claimType = runtimeEntityType.AddProperty( - "ClaimType", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var claimValue = runtimeEntityType.AddProperty( - "ClaimValue", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var roleId = runtimeEntityType.AddProperty( - "RoleId", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { roleId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetRoleClaims"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityRoleEntityType.cs deleted file mode 100644 index 2f1fec2b..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityRoleEntityType.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityRoleEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityRole", - typeof(IdentityRole), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var concurrencyStamp = runtimeEntityType.AddProperty( - "ConcurrencyStamp", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - concurrencyToken: true); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var normalizedName = runtimeEntityType.AddProperty( - "NormalizedName", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { normalizedName }, - unique: true); - index.AddAnnotation("Relational:Name", "RoleNameIndex"); - - return runtimeEntityType; - } - - 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", "AspNetRoles"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs deleted file mode 100644 index 55418a1e..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserClaimstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserClaim", - typeof(IdentityUserClaim), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var claimType = runtimeEntityType.AddProperty( - "ClaimType", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var claimValue = runtimeEntityType.AddProperty( - "ClaimValue", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { userId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserClaims"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs deleted file mode 100644 index 3ca029bd..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserLoginstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserLogin", - typeof(IdentityUserLogin), - baseEntityType); - - var loginProvider = runtimeEntityType.AddProperty( - "LoginProvider", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var providerKey = runtimeEntityType.AddProperty( - "ProviderKey", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var providerDisplayName = runtimeEntityType.AddProperty( - "ProviderDisplayName", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { loginProvider, providerKey }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { userId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserLogins"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs deleted file mode 100644 index 70078d7a..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs +++ /dev/null @@ -1,82 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserRolestringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserRole", - typeof(IdentityUserRole), - baseEntityType); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var roleId = runtimeEntityType.AddProperty( - "RoleId", - typeof(string), - propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var key = runtimeEntityType.AddKey( - new[] { userId, roleId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { roleId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, - 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("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserRoles"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs deleted file mode 100644 index 93ba6d31..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserTokenstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserToken", - typeof(IdentityUserToken), - baseEntityType); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var loginProvider = runtimeEntityType.AddProperty( - "LoginProvider", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var value = runtimeEntityType.AddProperty( - "Value", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { userId, loginProvider, name }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserTokens"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/KeyEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/KeyEntityType.cs deleted file mode 100644 index f6c6b4c7..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/KeyEntityType.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class KeyEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.Key", - typeof(Key), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var algorithm = runtimeEntityType.AddProperty( - "Algorithm", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var created = runtimeEntityType.AddProperty( - "Created", - typeof(DateTime), - propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var dataProtected = runtimeEntityType.AddProperty( - "DataProtected", - typeof(bool), - propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var isX509Certificate = runtimeEntityType.AddProperty( - "IsX509Certificate", - typeof(bool), - propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var use = runtimeEntityType.AddProperty( - "Use", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var version = runtimeEntityType.AddProperty( - "Version", - typeof(int), - propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { use }); - - return runtimeEntityType; - } - - 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", "Keys"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/LatLongEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/LatLongEntityType.cs deleted file mode 100644 index 3fd254bd..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/LatLongEntityType.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class LatLongEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.LatLong", - typeof(LatLong), - baseEntityType); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var latitude = runtimeEntityType.AddProperty( - "Latitude", - typeof(double), - propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var longitude = runtimeEntityType.AddProperty( - "Longitude", - typeof(double), - propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { orderId }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - unique: true, - required: true, - ownership: true); - - var deliveryLocation = principalEntityType.AddNavigation("DeliveryLocation", - runtimeForeignKey, - onDependent: false, - typeof(LatLong), - propertyInfo: typeof(Order).GetProperty("DeliveryLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - eagerLoaded: 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", "Orders"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs deleted file mode 100644 index db236e4c..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class NotificationSubscriptionEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.NotificationSubscription", - typeof(NotificationSubscription), - baseEntityType); - - var notificationSubscriptionId = runtimeEntityType.AddProperty( - "NotificationSubscriptionId", - typeof(int), - propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var auth = runtimeEntityType.AddProperty( - "Auth", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var p256dh = runtimeEntityType.AddProperty( - "P256dh", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var url = runtimeEntityType.AddProperty( - "Url", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { notificationSubscriptionId }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "NotificationSubscriptions"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/OrderEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/OrderEntityType.cs deleted file mode 100644 index 9d9ec6fd..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/OrderEntityType.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class OrderEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Order", - typeof(Order), - baseEntityType); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var createdTime = runtimeEntityType.AddProperty( - "CreatedTime", - typeof(DateTime), - propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var deliveryAddressId = runtimeEntityType.AddProperty( - "DeliveryAddressId", - typeof(int?), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { orderId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { deliveryAddressId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType); - - var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", - runtimeForeignKey, - onDependent: true, - typeof(Address), - propertyInfo: typeof(Order).GetProperty("DeliveryAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("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", "Orders"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/PersistedGrantEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/PersistedGrantEntityType.cs deleted file mode 100644 index 842d53a5..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/PersistedGrantEntityType.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PersistedGrantEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", - typeof(PersistedGrant), - baseEntityType); - - var key = runtimeEntityType.AddProperty( - "Key", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Key", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 200); - - var clientId = runtimeEntityType.AddProperty( - "ClientId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var consumedTime = runtimeEntityType.AddProperty( - "ConsumedTime", - typeof(DateTime?), - propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var creationTime = runtimeEntityType.AddProperty( - "CreationTime", - typeof(DateTime), - propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50000); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var expiration = runtimeEntityType.AddProperty( - "Expiration", - typeof(DateTime?), - propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var sessionId = runtimeEntityType.AddProperty( - "SessionId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var subjectId = runtimeEntityType.AddProperty( - "SubjectId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var type = runtimeEntityType.AddProperty( - "Type", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50); - - var key0 = runtimeEntityType.AddKey( - new[] { key }); - runtimeEntityType.SetPrimaryKey(key0); - - var index = runtimeEntityType.AddIndex( - new[] { consumedTime }); - - var index0 = runtimeEntityType.AddIndex( - new[] { expiration }); - - var index1 = runtimeEntityType.AddIndex( - new[] { subjectId, clientId, type }); - - var index2 = runtimeEntityType.AddIndex( - new[] { subjectId, sessionId, type }); - - return runtimeEntityType; - } - - 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", "PersistedGrants"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaEntityType.cs deleted file mode 100644 index 3a124e63..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaEntityType.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Pizza", - typeof(Pizza), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var size = runtimeEntityType.AddProperty( - "Size", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var specialId = runtimeEntityType.AddProperty( - "SpecialId", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { orderId }); - - var index0 = runtimeEntityType.AddIndex( - new[] { specialId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var pizzas = principalEntityType.AddNavigation("Pizzas", - runtimeForeignKey, - onDependent: false, - typeof(List), - propertyInfo: typeof(Order).GetProperty("Pizzas", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SpecialId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var special = declaringEntityType.AddNavigation("Special", - runtimeForeignKey, - onDependent: true, - typeof(PizzaSpecial), - propertyInfo: typeof(Pizza).GetProperty("Special", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("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", "Pizzas"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs deleted file mode 100644 index e86b0f50..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaSpecialEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.PizzaSpecial", - typeof(PizzaSpecial), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var basePrice = runtimeEntityType.AddProperty( - "BasePrice", - typeof(decimal), - propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var imageUrl = runtimeEntityType.AddProperty( - "ImageUrl", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Specials"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreContextModel.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreContextModel.cs deleted file mode 100644 index 8b516a68..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreContextModel.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - [DbContext(typeof(PizzaStoreContext))] - public partial class PizzaStoreContextModel : RuntimeModel - { - static PizzaStoreContextModel() - { - var model = new PizzaStoreContextModel(); - model.Initialize(); - model.Customize(); - _instance = model; - } - - private static PizzaStoreContextModel _instance; - public static IModel Instance => _instance; - - partial void Initialize(); - - partial void Customize(); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs deleted file mode 100644 index ba42d6b0..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - public partial class PizzaStoreContextModel - { - partial void Initialize() - { - var address = AddressEntityType.Create(this); - var latLong = LatLongEntityType.Create(this); - var notificationSubscription = NotificationSubscriptionEntityType.Create(this); - var order = OrderEntityType.Create(this); - var pizza = PizzaEntityType.Create(this); - var pizzaSpecial = PizzaSpecialEntityType.Create(this); - var pizzaTopping = PizzaToppingEntityType.Create(this); - var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); - var topping = ToppingEntityType.Create(this); - var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); - var key = KeyEntityType.Create(this); - var persistedGrant = PersistedGrantEntityType.Create(this); - var identityRole = IdentityRoleEntityType.Create(this); - var identityRoleClaimstring = IdentityRoleClaimstringEntityType.Create(this); - var identityUserClaimstring = IdentityUserClaimstringEntityType.Create(this); - var identityUserLoginstring = IdentityUserLoginstringEntityType.Create(this); - var identityUserRolestring = IdentityUserRolestringEntityType.Create(this); - var identityUserTokenstring = IdentityUserTokenstringEntityType.Create(this); - - LatLongEntityType.CreateForeignKey1(latLong, order); - OrderEntityType.CreateForeignKey1(order, address); - PizzaEntityType.CreateForeignKey1(pizza, order); - PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); - PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); - PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); - IdentityRoleClaimstringEntityType.CreateForeignKey1(identityRoleClaimstring, identityRole); - IdentityUserClaimstringEntityType.CreateForeignKey1(identityUserClaimstring, pizzaStoreUser); - IdentityUserLoginstringEntityType.CreateForeignKey1(identityUserLoginstring, pizzaStoreUser); - IdentityUserRolestringEntityType.CreateForeignKey1(identityUserRolestring, identityRole); - IdentityUserRolestringEntityType.CreateForeignKey2(identityUserRolestring, pizzaStoreUser); - IdentityUserTokenstringEntityType.CreateForeignKey1(identityUserTokenstring, pizzaStoreUser); - - AddressEntityType.CreateAnnotations(address); - LatLongEntityType.CreateAnnotations(latLong); - NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); - OrderEntityType.CreateAnnotations(order); - PizzaEntityType.CreateAnnotations(pizza); - PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); - PizzaToppingEntityType.CreateAnnotations(pizzaTopping); - PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); - ToppingEntityType.CreateAnnotations(topping); - DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); - KeyEntityType.CreateAnnotations(key); - PersistedGrantEntityType.CreateAnnotations(persistedGrant); - IdentityRoleEntityType.CreateAnnotations(identityRole); - IdentityRoleClaimstringEntityType.CreateAnnotations(identityRoleClaimstring); - IdentityUserClaimstringEntityType.CreateAnnotations(identityUserClaimstring); - IdentityUserLoginstringEntityType.CreateAnnotations(identityUserLoginstring); - IdentityUserRolestringEntityType.CreateAnnotations(identityUserRolestring); - IdentityUserTokenstringEntityType.CreateAnnotations(identityUserTokenstring); - - AddAnnotation("ProductVersion", "7.0.0"); - } - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs deleted file mode 100644 index 18b2d96d..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs +++ /dev/null @@ -1,156 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaStoreUserEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Server.PizzaStoreUser", - typeof(PizzaStoreUser), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var accessFailedCount = runtimeEntityType.AddProperty( - "AccessFailedCount", - typeof(int), - propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var concurrencyStamp = runtimeEntityType.AddProperty( - "ConcurrencyStamp", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - concurrencyToken: true); - - var email = runtimeEntityType.AddProperty( - "Email", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var emailConfirmed = runtimeEntityType.AddProperty( - "EmailConfirmed", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var lockoutEnabled = runtimeEntityType.AddProperty( - "LockoutEnabled", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var lockoutEnd = runtimeEntityType.AddProperty( - "LockoutEnd", - typeof(DateTimeOffset?), - propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var normalizedEmail = runtimeEntityType.AddProperty( - "NormalizedEmail", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var normalizedUserName = runtimeEntityType.AddProperty( - "NormalizedUserName", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var passwordHash = runtimeEntityType.AddProperty( - "PasswordHash", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var phoneNumber = runtimeEntityType.AddProperty( - "PhoneNumber", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var phoneNumberConfirmed = runtimeEntityType.AddProperty( - "PhoneNumberConfirmed", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var securityStamp = runtimeEntityType.AddProperty( - "SecurityStamp", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var twoFactorEnabled = runtimeEntityType.AddProperty( - "TwoFactorEnabled", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var userName = runtimeEntityType.AddProperty( - "UserName", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { normalizedEmail }); - index.AddAnnotation("Relational:Name", "EmailIndex"); - - var index0 = runtimeEntityType.AddIndex( - new[] { normalizedUserName }, - unique: true); - index0.AddAnnotation("Relational:Name", "UserNameIndex"); - - return runtimeEntityType; - } - - 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", "AspNetUsers"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaToppingEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaToppingEntityType.cs deleted file mode 100644 index b97d2a24..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/PizzaToppingEntityType.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaToppingEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.PizzaTopping", - typeof(PizzaTopping), - baseEntityType); - - var pizzaId = runtimeEntityType.AddProperty( - "PizzaId", - typeof(int), - propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var toppingId = runtimeEntityType.AddProperty( - "ToppingId", - typeof(int), - propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var key = runtimeEntityType.AddKey( - new[] { pizzaId, toppingId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { toppingId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PizzaId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var toppings = principalEntityType.AddNavigation("Toppings", - runtimeForeignKey, - onDependent: false, - typeof(List), - propertyInfo: typeof(Pizza).GetProperty("Toppings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ToppingId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var topping = declaringEntityType.AddNavigation("Topping", - runtimeForeignKey, - onDependent: true, - typeof(Topping), - propertyInfo: typeof(PizzaTopping).GetProperty("Topping", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("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", "PizzaTopping"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Models/ToppingEntityType.cs b/save-points/08-templated-components/BlazingPizza.Server/Models/ToppingEntityType.cs deleted file mode 100644 index 9295f9bf..00000000 --- a/save-points/08-templated-components/BlazingPizza.Server/Models/ToppingEntityType.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class ToppingEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Topping", - typeof(Topping), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var price = runtimeEntityType.AddProperty( - "Price", - typeof(decimal), - propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Toppings"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/08-templated-components/BlazingPizza.Server/Program.cs b/save-points/08-templated-components/BlazingPizza.Server/Program.cs index b83debb4..9db9e7ea 100644 --- a/save-points/08-templated-components/BlazingPizza.Server/Program.cs +++ b/save-points/08-templated-components/BlazingPizza.Server/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddDbContext(options => options.UseSqlite("Data Source=pizza.db") - .UseModel(BlazingPizza.Server.Models.PizzaStoreContextModel.Instance)); + .UseModel(BlazingPizza.Server.CompiledModels.PizzaStoreContextModel.Instance)); builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); diff --git a/save-points/08-templated-components/BlazingPizza.Server/SeedData.cs b/save-points/08-templated-components/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/08-templated-components/BlazingPizza.Server/SeedData.cs +++ b/save-points/08-templated-components/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/BlazingPizza.Server.csproj b/save-points/09-progressive-web-app/BlazingPizza.Server/BlazingPizza.Server.csproj index b028c771..3b9de83d 100644 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/AddressEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/AddressEntityType.cs new file mode 100644 index 00000000..f5908d82 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/AddressEntityType.cs @@ -0,0 +1,116 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class AddressEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Address", + typeof(Address), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var city = runtimeEntityType.AddProperty( + "City", + typeof(string), + propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + city.TypeMapping = SqliteStringTypeMapping.Default; + + var line1 = runtimeEntityType.AddProperty( + "Line1", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + line1.TypeMapping = SqliteStringTypeMapping.Default; + + var line2 = runtimeEntityType.AddProperty( + "Line2", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + line2.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var postalCode = runtimeEntityType.AddProperty( + "PostalCode", + typeof(string), + propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + postalCode.TypeMapping = SqliteStringTypeMapping.Default; + + var region = runtimeEntityType.AddProperty( + "Region", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + region.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Address"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs new file mode 100644 index 00000000..6c5ca661 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs @@ -0,0 +1,125 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class DeviceFlowCodesEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + typeof(DeviceFlowCodes), + baseEntityType); + + var userCode = runtimeEntityType.AddProperty( + "UserCode", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 200); + userCode.TypeMapping = SqliteStringTypeMapping.Default; + + var clientId = runtimeEntityType.AddProperty( + "ClientId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; + + var creationTime = runtimeEntityType.AddProperty( + "CreationTime", + typeof(DateTime), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var deviceCode = runtimeEntityType.AddProperty( + "DeviceCode", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + deviceCode.TypeMapping = SqliteStringTypeMapping.Default; + + var expiration = runtimeEntityType.AddProperty( + "Expiration", + typeof(DateTime?), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var sessionId = runtimeEntityType.AddProperty( + "SessionId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; + + var subjectId = runtimeEntityType.AddProperty( + "SubjectId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userCode }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { deviceCode }, + unique: true); + + var index0 = runtimeEntityType.AddIndex( + new[] { expiration }); + + return runtimeEntityType; + } + + 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", "DeviceCodes"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs new file mode 100644 index 00000000..73cabada --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs @@ -0,0 +1,107 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityRoleClaimEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + typeof(IdentityRoleClaim), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var claimType = runtimeEntityType.AddProperty( + "ClaimType", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; + + var claimValue = runtimeEntityType.AddProperty( + "ClaimValue", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; + + var roleId = runtimeEntityType.AddProperty( + "RoleId", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + roleId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { roleId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetRoleClaims"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs new file mode 100644 index 00000000..3f46cdc5 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityRoleEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityRole", + typeof(IdentityRole), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var concurrencyStamp = runtimeEntityType.AddProperty( + "ConcurrencyStamp", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var normalizedName = runtimeEntityType.AddProperty( + "NormalizedName", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedName.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { normalizedName }, + unique: true); + index.AddAnnotation("Relational:Name", "RoleNameIndex"); + + return runtimeEntityType; + } + + 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", "AspNetRoles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs new file mode 100644 index 00000000..5de58bf8 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs @@ -0,0 +1,107 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserClaimEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + typeof(IdentityUserClaim), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var claimType = runtimeEntityType.AddProperty( + "ClaimType", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; + + var claimValue = runtimeEntityType.AddProperty( + "ClaimValue", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { userId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserClaims"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs new file mode 100644 index 00000000..fb868abc --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs @@ -0,0 +1,91 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserLoginEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + typeof(IdentityUserLogin), + baseEntityType); + + var loginProvider = runtimeEntityType.AddProperty( + "LoginProvider", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; + + var providerKey = runtimeEntityType.AddProperty( + "ProviderKey", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + providerKey.TypeMapping = SqliteStringTypeMapping.Default; + + var providerDisplayName = runtimeEntityType.AddProperty( + "ProviderDisplayName", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + providerDisplayName.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { loginProvider, providerKey }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { userId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserLogins"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs new file mode 100644 index 00000000..f22fd836 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs @@ -0,0 +1,85 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserRoleEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserRole", + typeof(IdentityUserRole), + baseEntityType); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var roleId = runtimeEntityType.AddProperty( + "RoleId", + typeof(string), + propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + roleId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userId, roleId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { roleId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, + 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("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserRoles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs new file mode 100644 index 00000000..b4e36069 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs @@ -0,0 +1,89 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserTokenEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserToken", + typeof(IdentityUserToken), + baseEntityType); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var loginProvider = runtimeEntityType.AddProperty( + "LoginProvider", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var value = runtimeEntityType.AddProperty( + "Value", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + value.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userId, loginProvider, name }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserTokens"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/KeyEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/KeyEntityType.cs new file mode 100644 index 00000000..8743240a --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/KeyEntityType.cs @@ -0,0 +1,153 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class KeyEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.Key", + typeof(Key), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var algorithm = runtimeEntityType.AddProperty( + "Algorithm", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + algorithm.TypeMapping = SqliteStringTypeMapping.Default; + + var created = runtimeEntityType.AddProperty( + "Created", + typeof(DateTime), + propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + created.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var dataProtected = runtimeEntityType.AddProperty( + "DataProtected", + typeof(bool), + propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + dataProtected.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var isX509Certificate = runtimeEntityType.AddProperty( + "IsX509Certificate", + typeof(bool), + propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + isX509Certificate.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var use = runtimeEntityType.AddProperty( + "Use", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + use.TypeMapping = SqliteStringTypeMapping.Default; + + var version = runtimeEntityType.AddProperty( + "Version", + typeof(int), + propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + version.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { use }); + + return runtimeEntityType; + } + + 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", "Keys"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs new file mode 100644 index 00000000..657b8093 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs @@ -0,0 +1,130 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class LatLongEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.LatLong", + typeof(LatLong), + baseEntityType); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var latitude = runtimeEntityType.AddProperty( + "Latitude", + typeof(double), + propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + latitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); + + var longitude = runtimeEntityType.AddProperty( + "Longitude", + typeof(double), + propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + longitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); + + var key = runtimeEntityType.AddKey( + new[] { orderId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true, + ownership: true); + + var deliveryLocation = principalEntityType.AddNavigation("DeliveryLocation", + runtimeForeignKey, + onDependent: false, + typeof(LatLong), + propertyInfo: typeof(Order).GetProperty("DeliveryLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + eagerLoaded: 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", "Orders"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs new file mode 100644 index 00000000..891722a1 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs @@ -0,0 +1,99 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class NotificationSubscriptionEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.NotificationSubscription", + typeof(NotificationSubscription), + baseEntityType); + + var notificationSubscriptionId = runtimeEntityType.AddProperty( + "NotificationSubscriptionId", + typeof(int?), + propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw); + notificationSubscriptionId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + keyComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + providerValueComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var auth = runtimeEntityType.AddProperty( + "Auth", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + auth.TypeMapping = SqliteStringTypeMapping.Default; + + var p256dh = runtimeEntityType.AddProperty( + "P256dh", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + p256dh.TypeMapping = SqliteStringTypeMapping.Default; + + var url = runtimeEntityType.AddProperty( + "Url", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + url.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { notificationSubscriptionId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "NotificationSubscriptions"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/OrderEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/OrderEntityType.cs new file mode 100644 index 00000000..bf1e5171 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/OrderEntityType.cs @@ -0,0 +1,126 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class OrderEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Order", + typeof(Order), + baseEntityType); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var createdTime = runtimeEntityType.AddProperty( + "CreatedTime", + typeof(DateTime), + propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + createdTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var deliveryAddressId = runtimeEntityType.AddProperty( + "DeliveryAddressId", + typeof(int), + sentinel: 0); + deliveryAddressId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { orderId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { deliveryAddressId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", + runtimeForeignKey, + onDependent: true, + typeof(Address), + propertyInfo: typeof(Order).GetProperty("DeliveryAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("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", "Orders"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs new file mode 100644 index 00000000..c57731dd --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs @@ -0,0 +1,139 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PersistedGrantEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + typeof(PersistedGrant), + baseEntityType); + + var key = runtimeEntityType.AddProperty( + "Key", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Key", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 200); + key.TypeMapping = SqliteStringTypeMapping.Default; + + var clientId = runtimeEntityType.AddProperty( + "ClientId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; + + var consumedTime = runtimeEntityType.AddProperty( + "ConsumedTime", + typeof(DateTime?), + propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + consumedTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var creationTime = runtimeEntityType.AddProperty( + "CreationTime", + typeof(DateTime), + propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var expiration = runtimeEntityType.AddProperty( + "Expiration", + typeof(DateTime?), + propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var sessionId = runtimeEntityType.AddProperty( + "SessionId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; + + var subjectId = runtimeEntityType.AddProperty( + "SubjectId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; + + var type = runtimeEntityType.AddProperty( + "Type", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + type.TypeMapping = SqliteStringTypeMapping.Default; + + var key0 = runtimeEntityType.AddKey( + new[] { key }); + runtimeEntityType.SetPrimaryKey(key0); + + var index = runtimeEntityType.AddIndex( + new[] { consumedTime }); + + var index0 = runtimeEntityType.AddIndex( + new[] { expiration }); + + var index1 = runtimeEntityType.AddIndex( + new[] { subjectId, clientId, type }); + + var index2 = runtimeEntityType.AddIndex( + new[] { subjectId, sessionId, type }); + + return runtimeEntityType; + } + + 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", "PersistedGrants"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs new file mode 100644 index 00000000..f8ac05e4 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs @@ -0,0 +1,177 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Pizza", + typeof(Pizza), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var size = runtimeEntityType.AddProperty( + "Size", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + size.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var specialId = runtimeEntityType.AddProperty( + "SpecialId", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + specialId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { orderId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { specialId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var pizzas = principalEntityType.AddNavigation("Pizzas", + runtimeForeignKey, + onDependent: false, + typeof(List), + propertyInfo: typeof(Order).GetProperty("Pizzas", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SpecialId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var special = declaringEntityType.AddNavigation("Special", + runtimeForeignKey, + onDependent: true, + typeof(PizzaSpecial), + propertyInfo: typeof(Pizza).GetProperty("Special", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("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", "Pizzas"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs new file mode 100644 index 00000000..693286c8 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs @@ -0,0 +1,97 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaSpecialEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.PizzaSpecial", + typeof(PizzaSpecial), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var basePrice = runtimeEntityType.AddProperty( + "BasePrice", + typeof(decimal), + propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + basePrice.TypeMapping = SqliteDecimalTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var imageUrl = runtimeEntityType.AddProperty( + "ImageUrl", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + imageUrl.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Specials"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs new file mode 100644 index 00000000..b7e36125 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs @@ -0,0 +1,47 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + [DbContext(typeof(PizzaStoreContext))] + public partial class PizzaStoreContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static PizzaStoreContextModel() + { + var model = new PizzaStoreContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = model; + } + + private static PizzaStoreContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs new file mode 100644 index 00000000..0f8d07cb --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs @@ -0,0 +1,1619 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + public partial class PizzaStoreContextModel + { + partial void Initialize() + { + var address = AddressEntityType.Create(this); + var latLong = LatLongEntityType.Create(this); + var notificationSubscription = NotificationSubscriptionEntityType.Create(this); + var order = OrderEntityType.Create(this); + var pizza = PizzaEntityType.Create(this); + var pizzaSpecial = PizzaSpecialEntityType.Create(this); + var pizzaTopping = PizzaToppingEntityType.Create(this); + var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); + var topping = ToppingEntityType.Create(this); + var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); + var key = KeyEntityType.Create(this); + var persistedGrant = PersistedGrantEntityType.Create(this); + var identityRole = IdentityRoleEntityType.Create(this); + var identityRoleClaim = IdentityRoleClaimEntityType.Create(this); + var identityUserClaim = IdentityUserClaimEntityType.Create(this); + var identityUserLogin = IdentityUserLoginEntityType.Create(this); + var identityUserRole = IdentityUserRoleEntityType.Create(this); + var identityUserToken = IdentityUserTokenEntityType.Create(this); + + LatLongEntityType.CreateForeignKey1(latLong, order); + OrderEntityType.CreateForeignKey1(order, address); + PizzaEntityType.CreateForeignKey1(pizza, order); + PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); + PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); + PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); + IdentityRoleClaimEntityType.CreateForeignKey1(identityRoleClaim, identityRole); + IdentityUserClaimEntityType.CreateForeignKey1(identityUserClaim, pizzaStoreUser); + IdentityUserLoginEntityType.CreateForeignKey1(identityUserLogin, pizzaStoreUser); + IdentityUserRoleEntityType.CreateForeignKey1(identityUserRole, identityRole); + IdentityUserRoleEntityType.CreateForeignKey2(identityUserRole, pizzaStoreUser); + IdentityUserTokenEntityType.CreateForeignKey1(identityUserToken, pizzaStoreUser); + + AddressEntityType.CreateAnnotations(address); + LatLongEntityType.CreateAnnotations(latLong); + NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); + OrderEntityType.CreateAnnotations(order); + PizzaEntityType.CreateAnnotations(pizza); + PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); + PizzaToppingEntityType.CreateAnnotations(pizzaTopping); + PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); + ToppingEntityType.CreateAnnotations(topping); + DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); + KeyEntityType.CreateAnnotations(key); + PersistedGrantEntityType.CreateAnnotations(persistedGrant); + IdentityRoleEntityType.CreateAnnotations(identityRole); + IdentityRoleClaimEntityType.CreateAnnotations(identityRoleClaim); + IdentityUserClaimEntityType.CreateAnnotations(identityUserClaim); + IdentityUserLoginEntityType.CreateAnnotations(identityUserLogin); + IdentityUserRoleEntityType.CreateAnnotations(identityUserRole); + IdentityUserTokenEntityType.CreateAnnotations(identityUserToken); + + AddAnnotation("ProductVersion", "8.0.0"); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var address = FindEntityType("BlazingPizza.Address")!; + + var defaultTableMappings = new List>(); + address.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var blazingPizzaAddressTableBase = new TableBase("BlazingPizza.Address", null, relationalModel); + var cityColumnBase = new ColumnBase("City", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("City", cityColumnBase); + var idColumnBase = new ColumnBase("Id", "INTEGER", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Id", idColumnBase); + var line1ColumnBase = new ColumnBase("Line1", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line1", line1ColumnBase); + var line2ColumnBase = new ColumnBase("Line2", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line2", line2ColumnBase); + var nameColumnBase = new ColumnBase("Name", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Name", nameColumnBase); + var postalCodeColumnBase = new ColumnBase("PostalCode", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("PostalCode", postalCodeColumnBase); + var regionColumnBase = new ColumnBase("Region", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Region", regionColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Address", blazingPizzaAddressTableBase); + var blazingPizzaAddressMappingBase = new TableMappingBase(address, blazingPizzaAddressTableBase, true); + blazingPizzaAddressTableBase.AddTypeMapping(blazingPizzaAddressMappingBase, false); + defaultTableMappings.Add(blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, address.FindProperty("Id")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)cityColumnBase, address.FindProperty("City")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line1ColumnBase, address.FindProperty("Line1")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line2ColumnBase, address.FindProperty("Line2")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase, address.FindProperty("Name")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)postalCodeColumnBase, address.FindProperty("PostalCode")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)regionColumnBase, address.FindProperty("Region")!, blazingPizzaAddressMappingBase); + + var tableMappings = new List(); + address.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var addressTable = new Table("Address", null, relationalModel); + var idColumn = new Column("Id", "INTEGER", addressTable); + addressTable.Columns.Add("Id", idColumn); + var cityColumn = new Column("City", "TEXT", addressTable); + addressTable.Columns.Add("City", cityColumn); + var line1Column = new Column("Line1", "TEXT", addressTable); + addressTable.Columns.Add("Line1", line1Column); + var line2Column = new Column("Line2", "TEXT", addressTable); + addressTable.Columns.Add("Line2", line2Column); + var nameColumn = new Column("Name", "TEXT", addressTable); + addressTable.Columns.Add("Name", nameColumn); + var postalCodeColumn = new Column("PostalCode", "TEXT", addressTable); + addressTable.Columns.Add("PostalCode", postalCodeColumn); + var regionColumn = new Column("Region", "TEXT", addressTable); + addressTable.Columns.Add("Region", regionColumn); + var pK_Address = new UniqueConstraint("PK_Address", addressTable, new[] { idColumn }); + addressTable.PrimaryKey = pK_Address; + var pK_AddressUc = RelationalModel.GetKey(this, + "BlazingPizza.Address", + new[] { "Id" }); + pK_Address.MappedKeys.Add(pK_AddressUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AddressUc).Add(pK_Address); + addressTable.UniqueConstraints.Add("PK_Address", pK_Address); + relationalModel.Tables.Add(("Address", null), addressTable); + var addressTableMapping = new TableMapping(address, addressTable, true); + addressTable.AddTypeMapping(addressTableMapping, false); + tableMappings.Add(addressTableMapping); + RelationalModel.CreateColumnMapping(idColumn, address.FindProperty("Id")!, addressTableMapping); + RelationalModel.CreateColumnMapping(cityColumn, address.FindProperty("City")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line1Column, address.FindProperty("Line1")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line2Column, address.FindProperty("Line2")!, addressTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, address.FindProperty("Name")!, addressTableMapping); + RelationalModel.CreateColumnMapping(postalCodeColumn, address.FindProperty("PostalCode")!, addressTableMapping); + RelationalModel.CreateColumnMapping(regionColumn, address.FindProperty("Region")!, addressTableMapping); + + var latLong = FindEntityType("BlazingPizza.LatLong")!; + + var defaultTableMappings0 = new List>(); + latLong.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var blazingPizzaLatLongTableBase = new TableBase("BlazingPizza.LatLong", null, relationalModel); + var latitudeColumnBase = new ColumnBase("Latitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Latitude", latitudeColumnBase); + var longitudeColumnBase = new ColumnBase("Longitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Longitude", longitudeColumnBase); + var orderIdColumnBase = new ColumnBase("OrderId", "INTEGER", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("OrderId", orderIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.LatLong", blazingPizzaLatLongTableBase); + var blazingPizzaLatLongMappingBase = new TableMappingBase(latLong, blazingPizzaLatLongTableBase, true); + blazingPizzaLatLongTableBase.AddTypeMapping(blazingPizzaLatLongMappingBase, false); + defaultTableMappings0.Add(blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase, latLong.FindProperty("OrderId")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)latitudeColumnBase, latLong.FindProperty("Latitude")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)longitudeColumnBase, latLong.FindProperty("Longitude")!, blazingPizzaLatLongMappingBase); + + var tableMappings0 = new List(); + latLong.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var ordersTable = new Table("Orders", null, relationalModel); + var orderIdColumn = new Column("OrderId", "INTEGER", ordersTable); + ordersTable.Columns.Add("OrderId", orderIdColumn); + var createdTimeColumn = new Column("CreatedTime", "TEXT", ordersTable); + ordersTable.Columns.Add("CreatedTime", createdTimeColumn); + var deliveryAddressIdColumn = new Column("DeliveryAddressId", "INTEGER", ordersTable); + ordersTable.Columns.Add("DeliveryAddressId", deliveryAddressIdColumn); + var deliveryLocation_LatitudeColumn = new Column("DeliveryLocation_Latitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Latitude", deliveryLocation_LatitudeColumn); + var deliveryLocation_LongitudeColumn = new Column("DeliveryLocation_Longitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Longitude", deliveryLocation_LongitudeColumn); + var userIdColumn = new Column("UserId", "TEXT", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("UserId", userIdColumn); + var pK_Orders = new UniqueConstraint("PK_Orders", ordersTable, new[] { orderIdColumn }); + ordersTable.PrimaryKey = pK_Orders; + var pK_OrdersUc = RelationalModel.GetKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc).Add(pK_Orders); + var pK_OrdersUc0 = RelationalModel.GetKey(this, + "BlazingPizza.Order", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc0); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc0).Add(pK_Orders); + ordersTable.UniqueConstraints.Add("PK_Orders", pK_Orders); + var iX_Orders_DeliveryAddressId = new TableIndex( + "IX_Orders_DeliveryAddressId", ordersTable, new[] { deliveryAddressIdColumn }, false); + var iX_Orders_DeliveryAddressIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }); + iX_Orders_DeliveryAddressId.MappedIndexes.Add(iX_Orders_DeliveryAddressIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Orders_DeliveryAddressIdIx).Add(iX_Orders_DeliveryAddressId); + ordersTable.Indexes.Add("IX_Orders_DeliveryAddressId", iX_Orders_DeliveryAddressId); + relationalModel.Tables.Add(("Orders", null), ordersTable); + var ordersTableMapping = new TableMapping(latLong, ordersTable, true) + { + IsSharedTablePrincipal = false, + }; + ordersTable.AddTypeMapping(ordersTableMapping, true); + tableMappings0.Add(ordersTableMapping); + ordersTable.AddRowInternalForeignKey(latLong, RelationalModel.GetForeignKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" })); + RelationalModel.CreateColumnMapping(orderIdColumn, latLong.FindProperty("OrderId")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LatitudeColumn, latLong.FindProperty("Latitude")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LongitudeColumn, latLong.FindProperty("Longitude")!, ordersTableMapping); + + var notificationSubscription = FindEntityType("BlazingPizza.NotificationSubscription")!; + + var defaultTableMappings1 = new List>(); + notificationSubscription.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var blazingPizzaNotificationSubscriptionTableBase = new TableBase("BlazingPizza.NotificationSubscription", null, relationalModel); + var authColumnBase = new ColumnBase("Auth", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Auth", authColumnBase); + var notificationSubscriptionIdColumnBase = new ColumnBase("NotificationSubscriptionId", "INTEGER", blazingPizzaNotificationSubscriptionTableBase); + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumnBase); + var p256dhColumnBase = new ColumnBase("P256dh", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("P256dh", p256dhColumnBase); + var urlColumnBase = new ColumnBase("Url", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Url", urlColumnBase); + var userIdColumnBase = new ColumnBase("UserId", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("UserId", userIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.NotificationSubscription", blazingPizzaNotificationSubscriptionTableBase); + var blazingPizzaNotificationSubscriptionMappingBase = new TableMappingBase(notificationSubscription, blazingPizzaNotificationSubscriptionTableBase, true); + blazingPizzaNotificationSubscriptionTableBase.AddTypeMapping(blazingPizzaNotificationSubscriptionMappingBase, false); + defaultTableMappings1.Add(blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)notificationSubscriptionIdColumnBase, notificationSubscription.FindProperty("NotificationSubscriptionId")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)authColumnBase, notificationSubscription.FindProperty("Auth")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)p256dhColumnBase, notificationSubscription.FindProperty("P256dh")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)urlColumnBase, notificationSubscription.FindProperty("Url")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase, notificationSubscription.FindProperty("UserId")!, blazingPizzaNotificationSubscriptionMappingBase); + + var tableMappings1 = new List(); + notificationSubscription.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var notificationSubscriptionsTable = new Table("NotificationSubscriptions", null, relationalModel); + var notificationSubscriptionIdColumn = new Column("NotificationSubscriptionId", "INTEGER", notificationSubscriptionsTable); + notificationSubscriptionsTable.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumn); + var authColumn = new Column("Auth", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Auth", authColumn); + var p256dhColumn = new Column("P256dh", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("P256dh", p256dhColumn); + var urlColumn = new Column("Url", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Url", urlColumn); + var userIdColumn0 = new Column("UserId", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("UserId", userIdColumn0); + var pK_NotificationSubscriptions = new UniqueConstraint("PK_NotificationSubscriptions", notificationSubscriptionsTable, new[] { notificationSubscriptionIdColumn }); + notificationSubscriptionsTable.PrimaryKey = pK_NotificationSubscriptions; + var pK_NotificationSubscriptionsUc = RelationalModel.GetKey(this, + "BlazingPizza.NotificationSubscription", + new[] { "NotificationSubscriptionId" }); + pK_NotificationSubscriptions.MappedKeys.Add(pK_NotificationSubscriptionsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_NotificationSubscriptionsUc).Add(pK_NotificationSubscriptions); + notificationSubscriptionsTable.UniqueConstraints.Add("PK_NotificationSubscriptions", pK_NotificationSubscriptions); + relationalModel.Tables.Add(("NotificationSubscriptions", null), notificationSubscriptionsTable); + var notificationSubscriptionsTableMapping = new TableMapping(notificationSubscription, notificationSubscriptionsTable, true); + notificationSubscriptionsTable.AddTypeMapping(notificationSubscriptionsTableMapping, false); + tableMappings1.Add(notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(notificationSubscriptionIdColumn, notificationSubscription.FindProperty("NotificationSubscriptionId")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(authColumn, notificationSubscription.FindProperty("Auth")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(p256dhColumn, notificationSubscription.FindProperty("P256dh")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(urlColumn, notificationSubscription.FindProperty("Url")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn0, notificationSubscription.FindProperty("UserId")!, notificationSubscriptionsTableMapping); + + var order = FindEntityType("BlazingPizza.Order")!; + + var defaultTableMappings2 = new List>(); + order.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings2); + var blazingPizzaOrderTableBase = new TableBase("BlazingPizza.Order", null, relationalModel); + var createdTimeColumnBase = new ColumnBase("CreatedTime", "TEXT", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("CreatedTime", createdTimeColumnBase); + var deliveryAddressIdColumnBase = new ColumnBase("DeliveryAddressId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("DeliveryAddressId", deliveryAddressIdColumnBase); + var orderIdColumnBase0 = new ColumnBase("OrderId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("OrderId", orderIdColumnBase0); + var userIdColumnBase0 = new ColumnBase("UserId", "TEXT", blazingPizzaOrderTableBase) + { + IsNullable = true + }; + blazingPizzaOrderTableBase.Columns.Add("UserId", userIdColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.Order", blazingPizzaOrderTableBase); + var blazingPizzaOrderMappingBase = new TableMappingBase(order, blazingPizzaOrderTableBase, true); + blazingPizzaOrderTableBase.AddTypeMapping(blazingPizzaOrderMappingBase, false); + defaultTableMappings2.Add(blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase0, order.FindProperty("OrderId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdTimeColumnBase, order.FindProperty("CreatedTime")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deliveryAddressIdColumnBase, order.FindProperty("DeliveryAddressId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase0, order.FindProperty("UserId")!, blazingPizzaOrderMappingBase); + + var tableMappings2 = new List(); + order.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); + var ordersTableMapping0 = new TableMapping(order, ordersTable, true) + { + IsSharedTablePrincipal = true, + }; + ordersTable.AddTypeMapping(ordersTableMapping0, false); + tableMappings2.Add(ordersTableMapping0); + RelationalModel.CreateColumnMapping(orderIdColumn, order.FindProperty("OrderId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(createdTimeColumn, order.FindProperty("CreatedTime")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(deliveryAddressIdColumn, order.FindProperty("DeliveryAddressId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(userIdColumn, order.FindProperty("UserId")!, ordersTableMapping0); + + var pizza = FindEntityType("BlazingPizza.Pizza")!; + + var defaultTableMappings3 = new List>(); + pizza.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings3); + var blazingPizzaPizzaTableBase = new TableBase("BlazingPizza.Pizza", null, relationalModel); + var idColumnBase0 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Id", idColumnBase0); + var orderIdColumnBase1 = new ColumnBase("OrderId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("OrderId", orderIdColumnBase1); + var sizeColumnBase = new ColumnBase("Size", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Size", sizeColumnBase); + var specialIdColumnBase = new ColumnBase("SpecialId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("SpecialId", specialIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Pizza", blazingPizzaPizzaTableBase); + var blazingPizzaPizzaMappingBase = new TableMappingBase(pizza, blazingPizzaPizzaTableBase, true); + blazingPizzaPizzaTableBase.AddTypeMapping(blazingPizzaPizzaMappingBase, false); + defaultTableMappings3.Add(blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, pizza.FindProperty("Id")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase1, pizza.FindProperty("OrderId")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sizeColumnBase, pizza.FindProperty("Size")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)specialIdColumnBase, pizza.FindProperty("SpecialId")!, blazingPizzaPizzaMappingBase); + + var tableMappings3 = new List(); + pizza.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); + var pizzasTable = new Table("Pizzas", null, relationalModel); + var idColumn0 = new Column("Id", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Id", idColumn0); + var orderIdColumn0 = new Column("OrderId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("OrderId", orderIdColumn0); + var sizeColumn = new Column("Size", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Size", sizeColumn); + var specialIdColumn = new Column("SpecialId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("SpecialId", specialIdColumn); + var pK_Pizzas = new UniqueConstraint("PK_Pizzas", pizzasTable, new[] { idColumn0 }); + pizzasTable.PrimaryKey = pK_Pizzas; + var pK_PizzasUc = RelationalModel.GetKey(this, + "BlazingPizza.Pizza", + new[] { "Id" }); + pK_Pizzas.MappedKeys.Add(pK_PizzasUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzasUc).Add(pK_Pizzas); + pizzasTable.UniqueConstraints.Add("PK_Pizzas", pK_Pizzas); + var iX_Pizzas_OrderId = new TableIndex( + "IX_Pizzas_OrderId", pizzasTable, new[] { orderIdColumn0 }, false); + var iX_Pizzas_OrderIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }); + iX_Pizzas_OrderId.MappedIndexes.Add(iX_Pizzas_OrderIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_OrderIdIx).Add(iX_Pizzas_OrderId); + pizzasTable.Indexes.Add("IX_Pizzas_OrderId", iX_Pizzas_OrderId); + var iX_Pizzas_SpecialId = new TableIndex( + "IX_Pizzas_SpecialId", pizzasTable, new[] { specialIdColumn }, false); + var iX_Pizzas_SpecialIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }); + iX_Pizzas_SpecialId.MappedIndexes.Add(iX_Pizzas_SpecialIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_SpecialIdIx).Add(iX_Pizzas_SpecialId); + pizzasTable.Indexes.Add("IX_Pizzas_SpecialId", iX_Pizzas_SpecialId); + relationalModel.Tables.Add(("Pizzas", null), pizzasTable); + var pizzasTableMapping = new TableMapping(pizza, pizzasTable, true); + pizzasTable.AddTypeMapping(pizzasTableMapping, false); + tableMappings3.Add(pizzasTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, pizza.FindProperty("Id")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(orderIdColumn0, pizza.FindProperty("OrderId")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(sizeColumn, pizza.FindProperty("Size")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(specialIdColumn, pizza.FindProperty("SpecialId")!, pizzasTableMapping); + + var pizzaSpecial = FindEntityType("BlazingPizza.PizzaSpecial")!; + + var defaultTableMappings4 = new List>(); + pizzaSpecial.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); + var blazingPizzaPizzaSpecialTableBase = new TableBase("BlazingPizza.PizzaSpecial", null, relationalModel); + var basePriceColumnBase = new ColumnBase("BasePrice", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("BasePrice", basePriceColumnBase); + var descriptionColumnBase = new ColumnBase("Description", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Description", descriptionColumnBase); + var idColumnBase1 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Id", idColumnBase1); + var imageUrlColumnBase = new ColumnBase("ImageUrl", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("ImageUrl", imageUrlColumnBase); + var nameColumnBase0 = new ColumnBase("Name", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Name", nameColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaSpecial", blazingPizzaPizzaSpecialTableBase); + var blazingPizzaPizzaSpecialMappingBase = new TableMappingBase(pizzaSpecial, blazingPizzaPizzaSpecialTableBase, true); + blazingPizzaPizzaSpecialTableBase.AddTypeMapping(blazingPizzaPizzaSpecialMappingBase, false); + defaultTableMappings4.Add(blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, pizzaSpecial.FindProperty("Id")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)basePriceColumnBase, pizzaSpecial.FindProperty("BasePrice")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase, pizzaSpecial.FindProperty("Description")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)imageUrlColumnBase, pizzaSpecial.FindProperty("ImageUrl")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase0, pizzaSpecial.FindProperty("Name")!, blazingPizzaPizzaSpecialMappingBase); + + var tableMappings4 = new List(); + pizzaSpecial.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); + var specialsTable = new Table("Specials", null, relationalModel); + var idColumn1 = new Column("Id", "INTEGER", specialsTable); + specialsTable.Columns.Add("Id", idColumn1); + var basePriceColumn = new Column("BasePrice", "TEXT", specialsTable); + specialsTable.Columns.Add("BasePrice", basePriceColumn); + var descriptionColumn = new Column("Description", "TEXT", specialsTable); + specialsTable.Columns.Add("Description", descriptionColumn); + var imageUrlColumn = new Column("ImageUrl", "TEXT", specialsTable); + specialsTable.Columns.Add("ImageUrl", imageUrlColumn); + var nameColumn0 = new Column("Name", "TEXT", specialsTable); + specialsTable.Columns.Add("Name", nameColumn0); + var pK_Specials = new UniqueConstraint("PK_Specials", specialsTable, new[] { idColumn1 }); + specialsTable.PrimaryKey = pK_Specials; + var pK_SpecialsUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + pK_Specials.MappedKeys.Add(pK_SpecialsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_SpecialsUc).Add(pK_Specials); + specialsTable.UniqueConstraints.Add("PK_Specials", pK_Specials); + relationalModel.Tables.Add(("Specials", null), specialsTable); + var specialsTableMapping = new TableMapping(pizzaSpecial, specialsTable, true); + specialsTable.AddTypeMapping(specialsTableMapping, false); + tableMappings4.Add(specialsTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, pizzaSpecial.FindProperty("Id")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(basePriceColumn, pizzaSpecial.FindProperty("BasePrice")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn, pizzaSpecial.FindProperty("Description")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(imageUrlColumn, pizzaSpecial.FindProperty("ImageUrl")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn0, pizzaSpecial.FindProperty("Name")!, specialsTableMapping); + + var pizzaTopping = FindEntityType("BlazingPizza.PizzaTopping")!; + + var defaultTableMappings5 = new List>(); + pizzaTopping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings5); + var blazingPizzaPizzaToppingTableBase = new TableBase("BlazingPizza.PizzaTopping", null, relationalModel); + var pizzaIdColumnBase = new ColumnBase("PizzaId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("PizzaId", pizzaIdColumnBase); + var toppingIdColumnBase = new ColumnBase("ToppingId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("ToppingId", toppingIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaTopping", blazingPizzaPizzaToppingTableBase); + var blazingPizzaPizzaToppingMappingBase = new TableMappingBase(pizzaTopping, blazingPizzaPizzaToppingTableBase, true); + blazingPizzaPizzaToppingTableBase.AddTypeMapping(blazingPizzaPizzaToppingMappingBase, false); + defaultTableMappings5.Add(blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pizzaIdColumnBase, pizzaTopping.FindProperty("PizzaId")!, blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)toppingIdColumnBase, pizzaTopping.FindProperty("ToppingId")!, blazingPizzaPizzaToppingMappingBase); + + var tableMappings5 = new List(); + pizzaTopping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); + var pizzaToppingTable = new Table("PizzaTopping", null, relationalModel); + var pizzaIdColumn = new Column("PizzaId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("PizzaId", pizzaIdColumn); + var toppingIdColumn = new Column("ToppingId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("ToppingId", toppingIdColumn); + var pK_PizzaTopping = new UniqueConstraint("PK_PizzaTopping", pizzaToppingTable, new[] { pizzaIdColumn, toppingIdColumn }); + pizzaToppingTable.PrimaryKey = pK_PizzaTopping; + var pK_PizzaToppingUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId", "ToppingId" }); + pK_PizzaTopping.MappedKeys.Add(pK_PizzaToppingUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzaToppingUc).Add(pK_PizzaTopping); + pizzaToppingTable.UniqueConstraints.Add("PK_PizzaTopping", pK_PizzaTopping); + var iX_PizzaTopping_ToppingId = new TableIndex( + "IX_PizzaTopping_ToppingId", pizzaToppingTable, new[] { toppingIdColumn }, false); + var iX_PizzaTopping_ToppingIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }); + iX_PizzaTopping_ToppingId.MappedIndexes.Add(iX_PizzaTopping_ToppingIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PizzaTopping_ToppingIdIx).Add(iX_PizzaTopping_ToppingId); + pizzaToppingTable.Indexes.Add("IX_PizzaTopping_ToppingId", iX_PizzaTopping_ToppingId); + relationalModel.Tables.Add(("PizzaTopping", null), pizzaToppingTable); + var pizzaToppingTableMapping = new TableMapping(pizzaTopping, pizzaToppingTable, true); + pizzaToppingTable.AddTypeMapping(pizzaToppingTableMapping, false); + tableMappings5.Add(pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(pizzaIdColumn, pizzaTopping.FindProperty("PizzaId")!, pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(toppingIdColumn, pizzaTopping.FindProperty("ToppingId")!, pizzaToppingTableMapping); + + var pizzaStoreUser = FindEntityType("BlazingPizza.Server.PizzaStoreUser")!; + + var defaultTableMappings6 = new List>(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings6); + var blazingPizzaServerPizzaStoreUserTableBase = new TableBase("BlazingPizza.Server.PizzaStoreUser", null, relationalModel); + var accessFailedCountColumnBase = new ColumnBase("AccessFailedCount", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("AccessFailedCount", accessFailedCountColumnBase); + var concurrencyStampColumnBase = new ColumnBase("ConcurrencyStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase); + var emailColumnBase = new ColumnBase("Email", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Email", emailColumnBase); + var emailConfirmedColumnBase = new ColumnBase("EmailConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("EmailConfirmed", emailConfirmedColumnBase); + var idColumnBase2 = new ColumnBase("Id", "TEXT", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Id", idColumnBase2); + var lockoutEnabledColumnBase = new ColumnBase("LockoutEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnabled", lockoutEnabledColumnBase); + var lockoutEndColumnBase = new ColumnBase("LockoutEnd", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnd", lockoutEndColumnBase); + var normalizedEmailColumnBase = new ColumnBase("NormalizedEmail", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedEmail", normalizedEmailColumnBase); + var normalizedUserNameColumnBase = new ColumnBase("NormalizedUserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedUserName", normalizedUserNameColumnBase); + var passwordHashColumnBase = new ColumnBase("PasswordHash", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PasswordHash", passwordHashColumnBase); + var phoneNumberColumnBase = new ColumnBase("PhoneNumber", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumber", phoneNumberColumnBase); + var phoneNumberConfirmedColumnBase = new ColumnBase("PhoneNumberConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumnBase); + var securityStampColumnBase = new ColumnBase("SecurityStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("SecurityStamp", securityStampColumnBase); + var twoFactorEnabledColumnBase = new ColumnBase("TwoFactorEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumnBase); + var userNameColumnBase = new ColumnBase("UserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("UserName", userNameColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Server.PizzaStoreUser", blazingPizzaServerPizzaStoreUserTableBase); + var blazingPizzaServerPizzaStoreUserMappingBase = new TableMappingBase(pizzaStoreUser, blazingPizzaServerPizzaStoreUserTableBase, true); + blazingPizzaServerPizzaStoreUserTableBase.AddTypeMapping(blazingPizzaServerPizzaStoreUserMappingBase, false); + defaultTableMappings6.Add(blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, pizzaStoreUser.FindProperty("Id")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)accessFailedCountColumnBase, pizzaStoreUser.FindProperty("AccessFailedCount")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailColumnBase, pizzaStoreUser.FindProperty("Email")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailConfirmedColumnBase, pizzaStoreUser.FindProperty("EmailConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEnabledColumnBase, pizzaStoreUser.FindProperty("LockoutEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEndColumnBase, pizzaStoreUser.FindProperty("LockoutEnd")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedEmailColumnBase, pizzaStoreUser.FindProperty("NormalizedEmail")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedUserNameColumnBase, pizzaStoreUser.FindProperty("NormalizedUserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)passwordHashColumnBase, pizzaStoreUser.FindProperty("PasswordHash")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberColumnBase, pizzaStoreUser.FindProperty("PhoneNumber")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberConfirmedColumnBase, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)securityStampColumnBase, pizzaStoreUser.FindProperty("SecurityStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)twoFactorEnabledColumnBase, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userNameColumnBase, pizzaStoreUser.FindProperty("UserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + + var tableMappings6 = new List(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:TableMappings", tableMappings6); + var aspNetUsersTable = new Table("AspNetUsers", null, relationalModel); + var idColumn2 = new Column("Id", "TEXT", aspNetUsersTable); + aspNetUsersTable.Columns.Add("Id", idColumn2); + var accessFailedCountColumn = new Column("AccessFailedCount", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("AccessFailedCount", accessFailedCountColumn); + var concurrencyStampColumn = new Column("ConcurrencyStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn); + var emailColumn = new Column("Email", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("Email", emailColumn); + var emailConfirmedColumn = new Column("EmailConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("EmailConfirmed", emailConfirmedColumn); + var lockoutEnabledColumn = new Column("LockoutEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("LockoutEnabled", lockoutEnabledColumn); + var lockoutEndColumn = new Column("LockoutEnd", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("LockoutEnd", lockoutEndColumn); + var normalizedEmailColumn = new Column("NormalizedEmail", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedEmail", normalizedEmailColumn); + var normalizedUserNameColumn = new Column("NormalizedUserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedUserName", normalizedUserNameColumn); + var passwordHashColumn = new Column("PasswordHash", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PasswordHash", passwordHashColumn); + var phoneNumberColumn = new Column("PhoneNumber", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PhoneNumber", phoneNumberColumn); + var phoneNumberConfirmedColumn = new Column("PhoneNumberConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumn); + var securityStampColumn = new Column("SecurityStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("SecurityStamp", securityStampColumn); + var twoFactorEnabledColumn = new Column("TwoFactorEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumn); + var userNameColumn = new Column("UserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("UserName", userNameColumn); + var pK_AspNetUsers = new UniqueConstraint("PK_AspNetUsers", aspNetUsersTable, new[] { idColumn2 }); + aspNetUsersTable.PrimaryKey = pK_AspNetUsers; + var pK_AspNetUsersUc = RelationalModel.GetKey(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + pK_AspNetUsers.MappedKeys.Add(pK_AspNetUsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUsersUc).Add(pK_AspNetUsers); + aspNetUsersTable.UniqueConstraints.Add("PK_AspNetUsers", pK_AspNetUsers); + var emailIndex = new TableIndex( + "EmailIndex", aspNetUsersTable, new[] { normalizedEmailColumn }, false); + var emailIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedEmail" }); + emailIndex.MappedIndexes.Add(emailIndexIx); + RelationalModel.GetOrCreateTableIndexes(emailIndexIx).Add(emailIndex); + aspNetUsersTable.Indexes.Add("EmailIndex", emailIndex); + var userNameIndex = new TableIndex( + "UserNameIndex", aspNetUsersTable, new[] { normalizedUserNameColumn }, true); + var userNameIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedUserName" }); + userNameIndex.MappedIndexes.Add(userNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(userNameIndexIx).Add(userNameIndex); + aspNetUsersTable.Indexes.Add("UserNameIndex", userNameIndex); + relationalModel.Tables.Add(("AspNetUsers", null), aspNetUsersTable); + var aspNetUsersTableMapping = new TableMapping(pizzaStoreUser, aspNetUsersTable, true); + aspNetUsersTable.AddTypeMapping(aspNetUsersTableMapping, false); + tableMappings6.Add(aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(idColumn2, pizzaStoreUser.FindProperty("Id")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(accessFailedCountColumn, pizzaStoreUser.FindProperty("AccessFailedCount")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailColumn, pizzaStoreUser.FindProperty("Email")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailConfirmedColumn, pizzaStoreUser.FindProperty("EmailConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEnabledColumn, pizzaStoreUser.FindProperty("LockoutEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEndColumn, pizzaStoreUser.FindProperty("LockoutEnd")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedEmailColumn, pizzaStoreUser.FindProperty("NormalizedEmail")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedUserNameColumn, pizzaStoreUser.FindProperty("NormalizedUserName")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(passwordHashColumn, pizzaStoreUser.FindProperty("PasswordHash")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberColumn, pizzaStoreUser.FindProperty("PhoneNumber")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberConfirmedColumn, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(securityStampColumn, pizzaStoreUser.FindProperty("SecurityStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(twoFactorEnabledColumn, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(userNameColumn, pizzaStoreUser.FindProperty("UserName")!, aspNetUsersTableMapping); + + var topping = FindEntityType("BlazingPizza.Topping")!; + + var defaultTableMappings7 = new List>(); + topping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings7); + var blazingPizzaToppingTableBase = new TableBase("BlazingPizza.Topping", null, relationalModel); + var idColumnBase3 = new ColumnBase("Id", "INTEGER", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Id", idColumnBase3); + var nameColumnBase1 = new ColumnBase("Name", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Name", nameColumnBase1); + var priceColumnBase = new ColumnBase("Price", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Price", priceColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Topping", blazingPizzaToppingTableBase); + var blazingPizzaToppingMappingBase = new TableMappingBase(topping, blazingPizzaToppingTableBase, true); + blazingPizzaToppingTableBase.AddTypeMapping(blazingPizzaToppingMappingBase, false); + defaultTableMappings7.Add(blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase3, topping.FindProperty("Id")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase1, topping.FindProperty("Name")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)priceColumnBase, topping.FindProperty("Price")!, blazingPizzaToppingMappingBase); + + var tableMappings7 = new List(); + topping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings7); + var toppingsTable = new Table("Toppings", null, relationalModel); + var idColumn3 = new Column("Id", "INTEGER", toppingsTable); + toppingsTable.Columns.Add("Id", idColumn3); + var nameColumn1 = new Column("Name", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Name", nameColumn1); + var priceColumn = new Column("Price", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Price", priceColumn); + var pK_Toppings = new UniqueConstraint("PK_Toppings", toppingsTable, new[] { idColumn3 }); + toppingsTable.PrimaryKey = pK_Toppings; + var pK_ToppingsUc = RelationalModel.GetKey(this, + "BlazingPizza.Topping", + new[] { "Id" }); + pK_Toppings.MappedKeys.Add(pK_ToppingsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_ToppingsUc).Add(pK_Toppings); + toppingsTable.UniqueConstraints.Add("PK_Toppings", pK_Toppings); + relationalModel.Tables.Add(("Toppings", null), toppingsTable); + var toppingsTableMapping = new TableMapping(topping, toppingsTable, true); + toppingsTable.AddTypeMapping(toppingsTableMapping, false); + tableMappings7.Add(toppingsTableMapping); + RelationalModel.CreateColumnMapping(idColumn3, topping.FindProperty("Id")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn1, topping.FindProperty("Name")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(priceColumn, topping.FindProperty("Price")!, toppingsTableMapping); + + var deviceFlowCodes = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes")!; + + var defaultTableMappings8 = new List>(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings8); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", null, relationalModel); + var clientIdColumnBase = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("ClientId", clientIdColumnBase); + var creationTimeColumnBase = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("CreationTime", creationTimeColumnBase); + var dataColumnBase = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Data", dataColumnBase); + var descriptionColumnBase0 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Description", descriptionColumnBase0); + var deviceCodeColumnBase = new ColumnBase("DeviceCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("DeviceCode", deviceCodeColumnBase); + var expirationColumnBase = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Expiration", expirationColumnBase); + var sessionIdColumnBase = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SessionId", sessionIdColumnBase); + var subjectIdColumnBase = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SubjectId", subjectIdColumnBase); + var userCodeColumnBase = new ColumnBase("UserCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("UserCode", userCodeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase = new TableMappingBase(deviceFlowCodes, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase, false); + defaultTableMappings8.Add(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userCodeColumnBase, deviceFlowCodes.FindProperty("UserCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase, deviceFlowCodes.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase, deviceFlowCodes.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, deviceFlowCodes.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase0, deviceFlowCodes.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deviceCodeColumnBase, deviceFlowCodes.FindProperty("DeviceCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase, deviceFlowCodes.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase, deviceFlowCodes.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase, deviceFlowCodes.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + + var tableMappings8 = new List(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:TableMappings", tableMappings8); + var deviceCodesTable = new Table("DeviceCodes", null, relationalModel); + var userCodeColumn = new Column("UserCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("UserCode", userCodeColumn); + var clientIdColumn = new Column("ClientId", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("ClientId", clientIdColumn); + var creationTimeColumn = new Column("CreationTime", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("CreationTime", creationTimeColumn); + var dataColumn = new Column("Data", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Data", dataColumn); + var descriptionColumn0 = new Column("Description", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("Description", descriptionColumn0); + var deviceCodeColumn = new Column("DeviceCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("DeviceCode", deviceCodeColumn); + var expirationColumn = new Column("Expiration", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Expiration", expirationColumn); + var sessionIdColumn = new Column("SessionId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SessionId", sessionIdColumn); + var subjectIdColumn = new Column("SubjectId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SubjectId", subjectIdColumn); + var pK_DeviceCodes = new UniqueConstraint("PK_DeviceCodes", deviceCodesTable, new[] { userCodeColumn }); + deviceCodesTable.PrimaryKey = pK_DeviceCodes; + var pK_DeviceCodesUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "UserCode" }); + pK_DeviceCodes.MappedKeys.Add(pK_DeviceCodesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_DeviceCodesUc).Add(pK_DeviceCodes); + deviceCodesTable.UniqueConstraints.Add("PK_DeviceCodes", pK_DeviceCodes); + var iX_DeviceCodes_DeviceCode = new TableIndex( + "IX_DeviceCodes_DeviceCode", deviceCodesTable, new[] { deviceCodeColumn }, true); + var iX_DeviceCodes_DeviceCodeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "DeviceCode" }); + iX_DeviceCodes_DeviceCode.MappedIndexes.Add(iX_DeviceCodes_DeviceCodeIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_DeviceCodeIx).Add(iX_DeviceCodes_DeviceCode); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_DeviceCode", iX_DeviceCodes_DeviceCode); + var iX_DeviceCodes_Expiration = new TableIndex( + "IX_DeviceCodes_Expiration", deviceCodesTable, new[] { expirationColumn }, false); + var iX_DeviceCodes_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "Expiration" }); + iX_DeviceCodes_Expiration.MappedIndexes.Add(iX_DeviceCodes_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_ExpirationIx).Add(iX_DeviceCodes_Expiration); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_Expiration", iX_DeviceCodes_Expiration); + relationalModel.Tables.Add(("DeviceCodes", null), deviceCodesTable); + var deviceCodesTableMapping = new TableMapping(deviceFlowCodes, deviceCodesTable, true); + deviceCodesTable.AddTypeMapping(deviceCodesTableMapping, false); + tableMappings8.Add(deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(userCodeColumn, deviceFlowCodes.FindProperty("UserCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn, deviceFlowCodes.FindProperty("ClientId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn, deviceFlowCodes.FindProperty("CreationTime")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, deviceFlowCodes.FindProperty("Data")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn0, deviceFlowCodes.FindProperty("Description")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(deviceCodeColumn, deviceFlowCodes.FindProperty("DeviceCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn, deviceFlowCodes.FindProperty("Expiration")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn, deviceFlowCodes.FindProperty("SessionId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn, deviceFlowCodes.FindProperty("SubjectId")!, deviceCodesTableMapping); + + var key = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.Key")!; + + var defaultTableMappings9 = new List>(); + key.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings9); + var duendeIdentityServerEntityFrameworkEntitiesKeyTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.Key", null, relationalModel); + var algorithmColumnBase = new ColumnBase("Algorithm", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Algorithm", algorithmColumnBase); + var createdColumnBase = new ColumnBase("Created", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Created", createdColumnBase); + var dataColumnBase0 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Data", dataColumnBase0); + var dataProtectedColumnBase = new ColumnBase("DataProtected", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("DataProtected", dataProtectedColumnBase); + var idColumnBase4 = new ColumnBase("Id", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Id", idColumnBase4); + var isX509CertificateColumnBase = new ColumnBase("IsX509Certificate", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("IsX509Certificate", isX509CertificateColumnBase); + var useColumnBase = new ColumnBase("Use", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Use", useColumnBase); + var versionColumnBase = new ColumnBase("Version", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Version", versionColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.Key", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + var duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase = new TableMappingBase(key, duendeIdentityServerEntityFrameworkEntitiesKeyTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase, false); + defaultTableMappings9.Add(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase4, key.FindProperty("Id")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)algorithmColumnBase, key.FindProperty("Algorithm")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdColumnBase, key.FindProperty("Created")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase0, key.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataProtectedColumnBase, key.FindProperty("DataProtected")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)isX509CertificateColumnBase, key.FindProperty("IsX509Certificate")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)useColumnBase, key.FindProperty("Use")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)versionColumnBase, key.FindProperty("Version")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + + var tableMappings9 = new List(); + key.SetRuntimeAnnotation("Relational:TableMappings", tableMappings9); + var keysTable = new Table("Keys", null, relationalModel); + var idColumn4 = new Column("Id", "TEXT", keysTable); + keysTable.Columns.Add("Id", idColumn4); + var algorithmColumn = new Column("Algorithm", "TEXT", keysTable); + keysTable.Columns.Add("Algorithm", algorithmColumn); + var createdColumn = new Column("Created", "TEXT", keysTable); + keysTable.Columns.Add("Created", createdColumn); + var dataColumn0 = new Column("Data", "TEXT", keysTable); + keysTable.Columns.Add("Data", dataColumn0); + var dataProtectedColumn = new Column("DataProtected", "INTEGER", keysTable); + keysTable.Columns.Add("DataProtected", dataProtectedColumn); + var isX509CertificateColumn = new Column("IsX509Certificate", "INTEGER", keysTable); + keysTable.Columns.Add("IsX509Certificate", isX509CertificateColumn); + var useColumn = new Column("Use", "TEXT", keysTable) + { + IsNullable = true + }; + keysTable.Columns.Add("Use", useColumn); + var versionColumn = new Column("Version", "INTEGER", keysTable); + keysTable.Columns.Add("Version", versionColumn); + var pK_Keys = new UniqueConstraint("PK_Keys", keysTable, new[] { idColumn4 }); + keysTable.PrimaryKey = pK_Keys; + var pK_KeysUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Id" }); + pK_Keys.MappedKeys.Add(pK_KeysUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_KeysUc).Add(pK_Keys); + keysTable.UniqueConstraints.Add("PK_Keys", pK_Keys); + var iX_Keys_Use = new TableIndex( + "IX_Keys_Use", keysTable, new[] { useColumn }, false); + var iX_Keys_UseIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Use" }); + iX_Keys_Use.MappedIndexes.Add(iX_Keys_UseIx); + RelationalModel.GetOrCreateTableIndexes(iX_Keys_UseIx).Add(iX_Keys_Use); + keysTable.Indexes.Add("IX_Keys_Use", iX_Keys_Use); + relationalModel.Tables.Add(("Keys", null), keysTable); + var keysTableMapping = new TableMapping(key, keysTable, true); + keysTable.AddTypeMapping(keysTableMapping, false); + tableMappings9.Add(keysTableMapping); + RelationalModel.CreateColumnMapping(idColumn4, key.FindProperty("Id")!, keysTableMapping); + RelationalModel.CreateColumnMapping(algorithmColumn, key.FindProperty("Algorithm")!, keysTableMapping); + RelationalModel.CreateColumnMapping(createdColumn, key.FindProperty("Created")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataColumn0, key.FindProperty("Data")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataProtectedColumn, key.FindProperty("DataProtected")!, keysTableMapping); + RelationalModel.CreateColumnMapping(isX509CertificateColumn, key.FindProperty("IsX509Certificate")!, keysTableMapping); + RelationalModel.CreateColumnMapping(useColumn, key.FindProperty("Use")!, keysTableMapping); + RelationalModel.CreateColumnMapping(versionColumn, key.FindProperty("Version")!, keysTableMapping); + + var persistedGrant = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant")!; + + var defaultTableMappings10 = new List>(); + persistedGrant.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings10); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", null, relationalModel); + var clientIdColumnBase0 = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ClientId", clientIdColumnBase0); + var consumedTimeColumnBase = new ColumnBase("ConsumedTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ConsumedTime", consumedTimeColumnBase); + var creationTimeColumnBase0 = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("CreationTime", creationTimeColumnBase0); + var dataColumnBase1 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Data", dataColumnBase1); + var descriptionColumnBase1 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Description", descriptionColumnBase1); + var expirationColumnBase0 = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Expiration", expirationColumnBase0); + var keyColumnBase = new ColumnBase("Key", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Key", keyColumnBase); + var sessionIdColumnBase0 = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SessionId", sessionIdColumnBase0); + var subjectIdColumnBase0 = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SubjectId", subjectIdColumnBase0); + var typeColumnBase = new ColumnBase("Type", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Type", typeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase = new TableMappingBase(persistedGrant, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase, false); + defaultTableMappings10.Add(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)keyColumnBase, persistedGrant.FindProperty("Key")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase0, persistedGrant.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)consumedTimeColumnBase, persistedGrant.FindProperty("ConsumedTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase0, persistedGrant.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase1, persistedGrant.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase1, persistedGrant.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase0, persistedGrant.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase0, persistedGrant.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase0, persistedGrant.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)typeColumnBase, persistedGrant.FindProperty("Type")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + + var tableMappings10 = new List(); + persistedGrant.SetRuntimeAnnotation("Relational:TableMappings", tableMappings10); + var persistedGrantsTable = new Table("PersistedGrants", null, relationalModel); + var keyColumn = new Column("Key", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Key", keyColumn); + var clientIdColumn0 = new Column("ClientId", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("ClientId", clientIdColumn0); + var consumedTimeColumn = new Column("ConsumedTime", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("ConsumedTime", consumedTimeColumn); + var creationTimeColumn0 = new Column("CreationTime", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("CreationTime", creationTimeColumn0); + var dataColumn1 = new Column("Data", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Data", dataColumn1); + var descriptionColumn1 = new Column("Description", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Description", descriptionColumn1); + var expirationColumn0 = new Column("Expiration", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Expiration", expirationColumn0); + var sessionIdColumn0 = new Column("SessionId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SessionId", sessionIdColumn0); + var subjectIdColumn0 = new Column("SubjectId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SubjectId", subjectIdColumn0); + var typeColumn = new Column("Type", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Type", typeColumn); + var pK_PersistedGrants = new UniqueConstraint("PK_PersistedGrants", persistedGrantsTable, new[] { keyColumn }); + persistedGrantsTable.PrimaryKey = pK_PersistedGrants; + var pK_PersistedGrantsUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Key" }); + pK_PersistedGrants.MappedKeys.Add(pK_PersistedGrantsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PersistedGrantsUc).Add(pK_PersistedGrants); + persistedGrantsTable.UniqueConstraints.Add("PK_PersistedGrants", pK_PersistedGrants); + var iX_PersistedGrants_ConsumedTime = new TableIndex( + "IX_PersistedGrants_ConsumedTime", persistedGrantsTable, new[] { consumedTimeColumn }, false); + var iX_PersistedGrants_ConsumedTimeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "ConsumedTime" }); + iX_PersistedGrants_ConsumedTime.MappedIndexes.Add(iX_PersistedGrants_ConsumedTimeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ConsumedTimeIx).Add(iX_PersistedGrants_ConsumedTime); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_ConsumedTime", iX_PersistedGrants_ConsumedTime); + var iX_PersistedGrants_Expiration = new TableIndex( + "IX_PersistedGrants_Expiration", persistedGrantsTable, new[] { expirationColumn0 }, false); + var iX_PersistedGrants_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Expiration" }); + iX_PersistedGrants_Expiration.MappedIndexes.Add(iX_PersistedGrants_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ExpirationIx).Add(iX_PersistedGrants_Expiration); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_Expiration", iX_PersistedGrants_Expiration); + var iX_PersistedGrants_SubjectId_ClientId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_ClientId_Type", persistedGrantsTable, new[] { subjectIdColumn0, clientIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_ClientId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "ClientId", "Type" }); + iX_PersistedGrants_SubjectId_ClientId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_ClientId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_ClientId_TypeIx).Add(iX_PersistedGrants_SubjectId_ClientId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_ClientId_Type", iX_PersistedGrants_SubjectId_ClientId_Type); + var iX_PersistedGrants_SubjectId_SessionId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_SessionId_Type", persistedGrantsTable, new[] { subjectIdColumn0, sessionIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_SessionId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "SessionId", "Type" }); + iX_PersistedGrants_SubjectId_SessionId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_SessionId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_SessionId_TypeIx).Add(iX_PersistedGrants_SubjectId_SessionId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_SessionId_Type", iX_PersistedGrants_SubjectId_SessionId_Type); + relationalModel.Tables.Add(("PersistedGrants", null), persistedGrantsTable); + var persistedGrantsTableMapping = new TableMapping(persistedGrant, persistedGrantsTable, true); + persistedGrantsTable.AddTypeMapping(persistedGrantsTableMapping, false); + tableMappings10.Add(persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(keyColumn, persistedGrant.FindProperty("Key")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn0, persistedGrant.FindProperty("ClientId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(consumedTimeColumn, persistedGrant.FindProperty("ConsumedTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn0, persistedGrant.FindProperty("CreationTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(dataColumn1, persistedGrant.FindProperty("Data")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn1, persistedGrant.FindProperty("Description")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn0, persistedGrant.FindProperty("Expiration")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn0, persistedGrant.FindProperty("SessionId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn0, persistedGrant.FindProperty("SubjectId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(typeColumn, persistedGrant.FindProperty("Type")!, persistedGrantsTableMapping); + + var identityRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRole")!; + + var defaultTableMappings11 = new List>(); + identityRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings11); + var microsoftAspNetCoreIdentityIdentityRoleTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRole", null, relationalModel); + var concurrencyStampColumnBase0 = new ColumnBase("ConcurrencyStamp", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase0); + var idColumnBase5 = new ColumnBase("Id", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase); + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Id", idColumnBase5); + var nameColumnBase2 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Name", nameColumnBase2); + var normalizedNameColumnBase = new ColumnBase("NormalizedName", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("NormalizedName", normalizedNameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRole", microsoftAspNetCoreIdentityIdentityRoleTableBase); + var microsoftAspNetCoreIdentityIdentityRoleMappingBase = new TableMappingBase(identityRole, microsoftAspNetCoreIdentityIdentityRoleTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleMappingBase, false); + defaultTableMappings11.Add(microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase5, identityRole.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase0, identityRole.FindProperty("ConcurrencyStamp")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase2, identityRole.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedNameColumnBase, identityRole.FindProperty("NormalizedName")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + + var tableMappings11 = new List(); + identityRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings11); + var aspNetRolesTable = new Table("AspNetRoles", null, relationalModel); + var idColumn5 = new Column("Id", "TEXT", aspNetRolesTable); + aspNetRolesTable.Columns.Add("Id", idColumn5); + var concurrencyStampColumn0 = new Column("ConcurrencyStamp", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn0); + var nameColumn2 = new Column("Name", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("Name", nameColumn2); + var normalizedNameColumn = new Column("NormalizedName", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("NormalizedName", normalizedNameColumn); + var pK_AspNetRoles = new UniqueConstraint("PK_AspNetRoles", aspNetRolesTable, new[] { idColumn5 }); + aspNetRolesTable.PrimaryKey = pK_AspNetRoles; + var pK_AspNetRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + pK_AspNetRoles.MappedKeys.Add(pK_AspNetRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRolesUc).Add(pK_AspNetRoles); + aspNetRolesTable.UniqueConstraints.Add("PK_AspNetRoles", pK_AspNetRoles); + var roleNameIndex = new TableIndex( + "RoleNameIndex", aspNetRolesTable, new[] { normalizedNameColumn }, true); + var roleNameIndexIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "NormalizedName" }); + roleNameIndex.MappedIndexes.Add(roleNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(roleNameIndexIx).Add(roleNameIndex); + aspNetRolesTable.Indexes.Add("RoleNameIndex", roleNameIndex); + relationalModel.Tables.Add(("AspNetRoles", null), aspNetRolesTable); + var aspNetRolesTableMapping = new TableMapping(identityRole, aspNetRolesTable, true); + aspNetRolesTable.AddTypeMapping(aspNetRolesTableMapping, false); + tableMappings11.Add(aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(idColumn5, identityRole.FindProperty("Id")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn0, identityRole.FindProperty("ConcurrencyStamp")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(nameColumn2, identityRole.FindProperty("Name")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(normalizedNameColumn, identityRole.FindProperty("NormalizedName")!, aspNetRolesTableMapping); + + var identityRoleClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRoleClaim")!; + + var defaultTableMappings12 = new List>(); + identityRoleClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings12); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRoleClaim", null, relationalModel); + var claimTypeColumnBase = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase); + var claimValueColumnBase = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase); + var idColumnBase6 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("Id", idColumnBase6); + var roleIdColumnBase = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("RoleId", roleIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRoleClaim", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase = new TableMappingBase(identityRoleClaim, microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase, false); + defaultTableMappings12.Add(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase6, identityRoleClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase, identityRoleClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase, identityRoleClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase, identityRoleClaim.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + + var tableMappings12 = new List(); + identityRoleClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings12); + var aspNetRoleClaimsTable = new Table("AspNetRoleClaims", null, relationalModel); + var idColumn6 = new Column("Id", "INTEGER", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("Id", idColumn6); + var claimTypeColumn = new Column("ClaimType", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimType", claimTypeColumn); + var claimValueColumn = new Column("ClaimValue", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimValue", claimValueColumn); + var roleIdColumn = new Column("RoleId", "TEXT", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("RoleId", roleIdColumn); + var pK_AspNetRoleClaims = new UniqueConstraint("PK_AspNetRoleClaims", aspNetRoleClaimsTable, new[] { idColumn6 }); + aspNetRoleClaimsTable.PrimaryKey = pK_AspNetRoleClaims; + var pK_AspNetRoleClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "Id" }); + pK_AspNetRoleClaims.MappedKeys.Add(pK_AspNetRoleClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRoleClaimsUc).Add(pK_AspNetRoleClaims); + aspNetRoleClaimsTable.UniqueConstraints.Add("PK_AspNetRoleClaims", pK_AspNetRoleClaims); + var iX_AspNetRoleClaims_RoleId = new TableIndex( + "IX_AspNetRoleClaims_RoleId", aspNetRoleClaimsTable, new[] { roleIdColumn }, false); + var iX_AspNetRoleClaims_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }); + iX_AspNetRoleClaims_RoleId.MappedIndexes.Add(iX_AspNetRoleClaims_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetRoleClaims_RoleIdIx).Add(iX_AspNetRoleClaims_RoleId); + aspNetRoleClaimsTable.Indexes.Add("IX_AspNetRoleClaims_RoleId", iX_AspNetRoleClaims_RoleId); + relationalModel.Tables.Add(("AspNetRoleClaims", null), aspNetRoleClaimsTable); + var aspNetRoleClaimsTableMapping = new TableMapping(identityRoleClaim, aspNetRoleClaimsTable, true); + aspNetRoleClaimsTable.AddTypeMapping(aspNetRoleClaimsTableMapping, false); + tableMappings12.Add(aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn6, identityRoleClaim.FindProperty("Id")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn, identityRoleClaim.FindProperty("ClaimType")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn, identityRoleClaim.FindProperty("ClaimValue")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn, identityRoleClaim.FindProperty("RoleId")!, aspNetRoleClaimsTableMapping); + + var identityUserClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserClaim")!; + + var defaultTableMappings13 = new List>(); + identityUserClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings13); + var microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserClaim", null, relationalModel); + var claimTypeColumnBase0 = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase0); + var claimValueColumnBase0 = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase0); + var idColumnBase7 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("Id", idColumnBase7); + var userIdColumnBase1 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("UserId", userIdColumnBase1); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserClaim", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase = new TableMappingBase(identityUserClaim, microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase, false); + defaultTableMappings13.Add(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase7, identityUserClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase0, identityUserClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase0, identityUserClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase1, identityUserClaim.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + + var tableMappings13 = new List(); + identityUserClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings13); + var aspNetUserClaimsTable = new Table("AspNetUserClaims", null, relationalModel); + var idColumn7 = new Column("Id", "INTEGER", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("Id", idColumn7); + var claimTypeColumn0 = new Column("ClaimType", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimType", claimTypeColumn0); + var claimValueColumn0 = new Column("ClaimValue", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimValue", claimValueColumn0); + var userIdColumn1 = new Column("UserId", "TEXT", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("UserId", userIdColumn1); + var pK_AspNetUserClaims = new UniqueConstraint("PK_AspNetUserClaims", aspNetUserClaimsTable, new[] { idColumn7 }); + aspNetUserClaimsTable.PrimaryKey = pK_AspNetUserClaims; + var pK_AspNetUserClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "Id" }); + pK_AspNetUserClaims.MappedKeys.Add(pK_AspNetUserClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserClaimsUc).Add(pK_AspNetUserClaims); + aspNetUserClaimsTable.UniqueConstraints.Add("PK_AspNetUserClaims", pK_AspNetUserClaims); + var iX_AspNetUserClaims_UserId = new TableIndex( + "IX_AspNetUserClaims_UserId", aspNetUserClaimsTable, new[] { userIdColumn1 }, false); + var iX_AspNetUserClaims_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }); + iX_AspNetUserClaims_UserId.MappedIndexes.Add(iX_AspNetUserClaims_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserClaims_UserIdIx).Add(iX_AspNetUserClaims_UserId); + aspNetUserClaimsTable.Indexes.Add("IX_AspNetUserClaims_UserId", iX_AspNetUserClaims_UserId); + relationalModel.Tables.Add(("AspNetUserClaims", null), aspNetUserClaimsTable); + var aspNetUserClaimsTableMapping = new TableMapping(identityUserClaim, aspNetUserClaimsTable, true); + aspNetUserClaimsTable.AddTypeMapping(aspNetUserClaimsTableMapping, false); + tableMappings13.Add(aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn7, identityUserClaim.FindProperty("Id")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn0, identityUserClaim.FindProperty("ClaimType")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn0, identityUserClaim.FindProperty("ClaimValue")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn1, identityUserClaim.FindProperty("UserId")!, aspNetUserClaimsTableMapping); + + var identityUserLogin = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserLogin")!; + + var defaultTableMappings14 = new List>(); + identityUserLogin.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings14); + var microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserLogin", null, relationalModel); + var loginProviderColumnBase = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase); + var providerDisplayNameColumnBase = new ColumnBase("ProviderDisplayName", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderDisplayName", providerDisplayNameColumnBase); + var providerKeyColumnBase = new ColumnBase("ProviderKey", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderKey", providerKeyColumnBase); + var userIdColumnBase2 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("UserId", userIdColumnBase2); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserLogin", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase = new TableMappingBase(identityUserLogin, microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase, false); + defaultTableMappings14.Add(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase, identityUserLogin.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerKeyColumnBase, identityUserLogin.FindProperty("ProviderKey")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerDisplayNameColumnBase, identityUserLogin.FindProperty("ProviderDisplayName")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase2, identityUserLogin.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + + var tableMappings14 = new List(); + identityUserLogin.SetRuntimeAnnotation("Relational:TableMappings", tableMappings14); + var aspNetUserLoginsTable = new Table("AspNetUserLogins", null, relationalModel); + var loginProviderColumn = new Column("LoginProvider", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("LoginProvider", loginProviderColumn); + var providerKeyColumn = new Column("ProviderKey", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("ProviderKey", providerKeyColumn); + var providerDisplayNameColumn = new Column("ProviderDisplayName", "TEXT", aspNetUserLoginsTable) + { + IsNullable = true + }; + aspNetUserLoginsTable.Columns.Add("ProviderDisplayName", providerDisplayNameColumn); + var userIdColumn2 = new Column("UserId", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("UserId", userIdColumn2); + var pK_AspNetUserLogins = new UniqueConstraint("PK_AspNetUserLogins", aspNetUserLoginsTable, new[] { loginProviderColumn, providerKeyColumn }); + aspNetUserLoginsTable.PrimaryKey = pK_AspNetUserLogins; + var pK_AspNetUserLoginsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "LoginProvider", "ProviderKey" }); + pK_AspNetUserLogins.MappedKeys.Add(pK_AspNetUserLoginsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserLoginsUc).Add(pK_AspNetUserLogins); + aspNetUserLoginsTable.UniqueConstraints.Add("PK_AspNetUserLogins", pK_AspNetUserLogins); + var iX_AspNetUserLogins_UserId = new TableIndex( + "IX_AspNetUserLogins_UserId", aspNetUserLoginsTable, new[] { userIdColumn2 }, false); + var iX_AspNetUserLogins_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }); + iX_AspNetUserLogins_UserId.MappedIndexes.Add(iX_AspNetUserLogins_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserLogins_UserIdIx).Add(iX_AspNetUserLogins_UserId); + aspNetUserLoginsTable.Indexes.Add("IX_AspNetUserLogins_UserId", iX_AspNetUserLogins_UserId); + relationalModel.Tables.Add(("AspNetUserLogins", null), aspNetUserLoginsTable); + var aspNetUserLoginsTableMapping = new TableMapping(identityUserLogin, aspNetUserLoginsTable, true); + aspNetUserLoginsTable.AddTypeMapping(aspNetUserLoginsTableMapping, false); + tableMappings14.Add(aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn, identityUserLogin.FindProperty("LoginProvider")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerKeyColumn, identityUserLogin.FindProperty("ProviderKey")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerDisplayNameColumn, identityUserLogin.FindProperty("ProviderDisplayName")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn2, identityUserLogin.FindProperty("UserId")!, aspNetUserLoginsTableMapping); + + var identityUserRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserRole")!; + + var defaultTableMappings15 = new List>(); + identityUserRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings15); + var microsoftAspNetCoreIdentityIdentityUserRolestringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserRole", null, relationalModel); + var roleIdColumnBase0 = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("RoleId", roleIdColumnBase0); + var userIdColumnBase3 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("UserId", userIdColumnBase3); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserRole", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + var microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase = new TableMappingBase(identityUserRole, microsoftAspNetCoreIdentityIdentityUserRolestringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase, false); + defaultTableMappings15.Add(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase0, identityUserRole.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase3, identityUserRole.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + + var tableMappings15 = new List(); + identityUserRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings15); + var aspNetUserRolesTable = new Table("AspNetUserRoles", null, relationalModel); + var userIdColumn3 = new Column("UserId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("UserId", userIdColumn3); + var roleIdColumn0 = new Column("RoleId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("RoleId", roleIdColumn0); + var pK_AspNetUserRoles = new UniqueConstraint("PK_AspNetUserRoles", aspNetUserRolesTable, new[] { userIdColumn3, roleIdColumn0 }); + aspNetUserRolesTable.PrimaryKey = pK_AspNetUserRoles; + var pK_AspNetUserRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId", "RoleId" }); + pK_AspNetUserRoles.MappedKeys.Add(pK_AspNetUserRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserRolesUc).Add(pK_AspNetUserRoles); + aspNetUserRolesTable.UniqueConstraints.Add("PK_AspNetUserRoles", pK_AspNetUserRoles); + var iX_AspNetUserRoles_RoleId = new TableIndex( + "IX_AspNetUserRoles_RoleId", aspNetUserRolesTable, new[] { roleIdColumn0 }, false); + var iX_AspNetUserRoles_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }); + iX_AspNetUserRoles_RoleId.MappedIndexes.Add(iX_AspNetUserRoles_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserRoles_RoleIdIx).Add(iX_AspNetUserRoles_RoleId); + aspNetUserRolesTable.Indexes.Add("IX_AspNetUserRoles_RoleId", iX_AspNetUserRoles_RoleId); + relationalModel.Tables.Add(("AspNetUserRoles", null), aspNetUserRolesTable); + var aspNetUserRolesTableMapping = new TableMapping(identityUserRole, aspNetUserRolesTable, true); + aspNetUserRolesTable.AddTypeMapping(aspNetUserRolesTableMapping, false); + tableMappings15.Add(aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn0, identityUserRole.FindProperty("RoleId")!, aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn3, identityUserRole.FindProperty("UserId")!, aspNetUserRolesTableMapping); + + var identityUserToken = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserToken")!; + + var defaultTableMappings16 = new List>(); + identityUserToken.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings16); + var microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserToken", null, relationalModel); + var loginProviderColumnBase0 = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase0); + var nameColumnBase3 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Name", nameColumnBase3); + var userIdColumnBase4 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("UserId", userIdColumnBase4); + var valueColumnBase = new ColumnBase("Value", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Value", valueColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserToken", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase = new TableMappingBase(identityUserToken, microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase, false); + defaultTableMappings16.Add(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase0, identityUserToken.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase3, identityUserToken.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase4, identityUserToken.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueColumnBase, identityUserToken.FindProperty("Value")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + + var tableMappings16 = new List(); + identityUserToken.SetRuntimeAnnotation("Relational:TableMappings", tableMappings16); + var aspNetUserTokensTable = new Table("AspNetUserTokens", null, relationalModel); + var userIdColumn4 = new Column("UserId", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("UserId", userIdColumn4); + var loginProviderColumn0 = new Column("LoginProvider", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("LoginProvider", loginProviderColumn0); + var nameColumn3 = new Column("Name", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("Name", nameColumn3); + var valueColumn = new Column("Value", "TEXT", aspNetUserTokensTable) + { + IsNullable = true + }; + aspNetUserTokensTable.Columns.Add("Value", valueColumn); + var pK_AspNetUserTokens = new UniqueConstraint("PK_AspNetUserTokens", aspNetUserTokensTable, new[] { userIdColumn4, loginProviderColumn0, nameColumn3 }); + aspNetUserTokensTable.PrimaryKey = pK_AspNetUserTokens; + var pK_AspNetUserTokensUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId", "LoginProvider", "Name" }); + pK_AspNetUserTokens.MappedKeys.Add(pK_AspNetUserTokensUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserTokensUc).Add(pK_AspNetUserTokens); + aspNetUserTokensTable.UniqueConstraints.Add("PK_AspNetUserTokens", pK_AspNetUserTokens); + relationalModel.Tables.Add(("AspNetUserTokens", null), aspNetUserTokensTable); + var aspNetUserTokensTableMapping = new TableMapping(identityUserToken, aspNetUserTokensTable, true); + aspNetUserTokensTable.AddTypeMapping(aspNetUserTokensTableMapping, false); + tableMappings16.Add(aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn0, identityUserToken.FindProperty("LoginProvider")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(nameColumn3, identityUserToken.FindProperty("Name")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn4, identityUserToken.FindProperty("UserId")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(valueColumn, identityUserToken.FindProperty("Value")!, aspNetUserTokensTableMapping); + var fK_AspNetRoleClaims_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetRoleClaims_AspNetRoles_RoleId", aspNetRoleClaimsTable, aspNetRolesTable, + new[] { roleIdColumn }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetRoleClaims_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetRoleClaims_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk).Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRoleClaimsTable.ForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + var fK_AspNetUserClaims_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserClaims_AspNetUsers_UserId", aspNetUserClaimsTable, aspNetUsersTable, + new[] { userIdColumn1 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserClaims_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserClaims_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserClaims_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserClaims_AspNetUsers_UserIdFk).Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUserClaimsTable.ForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + var fK_AspNetUserLogins_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserLogins_AspNetUsers_UserId", aspNetUserLoginsTable, aspNetUsersTable, + new[] { userIdColumn2 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserLogins_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserLogins_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserLogins_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserLogins_AspNetUsers_UserIdFk).Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUserLoginsTable.ForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + var fK_AspNetUserRoles_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetRoles_RoleId", aspNetUserRolesTable, aspNetRolesTable, + new[] { roleIdColumn0 }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetRoles_RoleIdFk).Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + var fK_AspNetUserRoles_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetUsers_UserId", aspNetUserRolesTable, aspNetUsersTable, + new[] { userIdColumn3 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetUsers_UserIdFk).Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + var fK_AspNetUserTokens_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserTokens_AspNetUsers_UserId", aspNetUserTokensTable, aspNetUsersTable, + new[] { userIdColumn4 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserTokens_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserTokens_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserTokens_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserTokens_AspNetUsers_UserIdFk).Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUserTokensTable.ForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + var fK_Orders_Address_DeliveryAddressId = new ForeignKeyConstraint( + "FK_Orders_Address_DeliveryAddressId", ordersTable, addressTable, + new[] { deliveryAddressIdColumn }, + addressTable.FindUniqueConstraint("PK_Address")!, ReferentialAction.Cascade); + var fK_Orders_Address_DeliveryAddressIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }, + "BlazingPizza.Address", + new[] { "Id" }); + fK_Orders_Address_DeliveryAddressId.MappedForeignKeys.Add(fK_Orders_Address_DeliveryAddressIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Orders_Address_DeliveryAddressIdFk).Add(fK_Orders_Address_DeliveryAddressId); + ordersTable.ForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + addressTable.ReferencingForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + var fK_Pizzas_Orders_OrderId = new ForeignKeyConstraint( + "FK_Pizzas_Orders_OrderId", pizzasTable, ordersTable, + new[] { orderIdColumn0 }, + ordersTable.FindUniqueConstraint("PK_Orders")!, ReferentialAction.Cascade); + var fK_Pizzas_Orders_OrderIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" }); + fK_Pizzas_Orders_OrderId.MappedForeignKeys.Add(fK_Pizzas_Orders_OrderIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Orders_OrderIdFk).Add(fK_Pizzas_Orders_OrderId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + ordersTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + var fK_Pizzas_Specials_SpecialId = new ForeignKeyConstraint( + "FK_Pizzas_Specials_SpecialId", pizzasTable, specialsTable, + new[] { specialIdColumn }, + specialsTable.FindUniqueConstraint("PK_Specials")!, ReferentialAction.Cascade); + var fK_Pizzas_Specials_SpecialIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + fK_Pizzas_Specials_SpecialId.MappedForeignKeys.Add(fK_Pizzas_Specials_SpecialIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Specials_SpecialIdFk).Add(fK_Pizzas_Specials_SpecialId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + specialsTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + var fK_PizzaTopping_Pizzas_PizzaId = new ForeignKeyConstraint( + "FK_PizzaTopping_Pizzas_PizzaId", pizzaToppingTable, pizzasTable, + new[] { pizzaIdColumn }, + pizzasTable.FindUniqueConstraint("PK_Pizzas")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Pizzas_PizzaIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId" }, + "BlazingPizza.Pizza", + new[] { "Id" }); + fK_PizzaTopping_Pizzas_PizzaId.MappedForeignKeys.Add(fK_PizzaTopping_Pizzas_PizzaIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Pizzas_PizzaIdFk).Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzasTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + var fK_PizzaTopping_Toppings_ToppingId = new ForeignKeyConstraint( + "FK_PizzaTopping_Toppings_ToppingId", pizzaToppingTable, toppingsTable, + new[] { toppingIdColumn }, + toppingsTable.FindUniqueConstraint("PK_Toppings")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Toppings_ToppingIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }, + "BlazingPizza.Topping", + new[] { "Id" }); + fK_PizzaTopping_Toppings_ToppingId.MappedForeignKeys.Add(fK_PizzaTopping_Toppings_ToppingIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Toppings_ToppingIdFk).Add(fK_PizzaTopping_Toppings_ToppingId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + toppingsTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs new file mode 100644 index 00000000..7295425c --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs @@ -0,0 +1,249 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaStoreUserEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Server.PizzaStoreUser", + typeof(PizzaStoreUser), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var accessFailedCount = runtimeEntityType.AddProperty( + "AccessFailedCount", + typeof(int), + propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + accessFailedCount.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var concurrencyStamp = runtimeEntityType.AddProperty( + "ConcurrencyStamp", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var email = runtimeEntityType.AddProperty( + "Email", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + email.TypeMapping = SqliteStringTypeMapping.Default; + + var emailConfirmed = runtimeEntityType.AddProperty( + "EmailConfirmed", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + emailConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var lockoutEnabled = runtimeEntityType.AddProperty( + "LockoutEnabled", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + lockoutEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var lockoutEnd = runtimeEntityType.AddProperty( + "LockoutEnd", + typeof(DateTimeOffset?), + propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + lockoutEnd.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default; + + var normalizedEmail = runtimeEntityType.AddProperty( + "NormalizedEmail", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedEmail.TypeMapping = SqliteStringTypeMapping.Default; + + var normalizedUserName = runtimeEntityType.AddProperty( + "NormalizedUserName", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedUserName.TypeMapping = SqliteStringTypeMapping.Default; + + var passwordHash = runtimeEntityType.AddProperty( + "PasswordHash", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + passwordHash.TypeMapping = SqliteStringTypeMapping.Default; + + var phoneNumber = runtimeEntityType.AddProperty( + "PhoneNumber", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + phoneNumber.TypeMapping = SqliteStringTypeMapping.Default; + + var phoneNumberConfirmed = runtimeEntityType.AddProperty( + "PhoneNumberConfirmed", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + phoneNumberConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var securityStamp = runtimeEntityType.AddProperty( + "SecurityStamp", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + securityStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var twoFactorEnabled = runtimeEntityType.AddProperty( + "TwoFactorEnabled", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + twoFactorEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var userName = runtimeEntityType.AddProperty( + "UserName", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + userName.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { normalizedEmail }); + index.AddAnnotation("Relational:Name", "EmailIndex"); + + var index0 = runtimeEntityType.AddIndex( + new[] { normalizedUserName }, + unique: true); + index0.AddAnnotation("Relational:Name", "UserNameIndex"); + + return runtimeEntityType; + } + + 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", "AspNetUsers"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs new file mode 100644 index 00000000..803ab153 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs @@ -0,0 +1,130 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaToppingEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.PizzaTopping", + typeof(PizzaTopping), + baseEntityType); + + var pizzaId = runtimeEntityType.AddProperty( + "PizzaId", + typeof(int), + propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + pizzaId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var toppingId = runtimeEntityType.AddProperty( + "ToppingId", + typeof(int), + propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + toppingId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { pizzaId, toppingId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { toppingId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PizzaId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var toppings = principalEntityType.AddNavigation("Toppings", + runtimeForeignKey, + onDependent: false, + typeof(List), + propertyInfo: typeof(Pizza).GetProperty("Toppings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ToppingId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var topping = declaringEntityType.AddNavigation("Topping", + runtimeForeignKey, + onDependent: true, + typeof(Topping), + propertyInfo: typeof(PizzaTopping).GetProperty("Topping", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("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", "PizzaTopping"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs new file mode 100644 index 00000000..d3a19507 --- /dev/null +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class ToppingEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Topping", + typeof(Topping), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var price = runtimeEntityType.AddProperty( + "Price", + typeof(decimal), + propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + price.TypeMapping = SqliteDecimalTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Toppings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/AddressEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/AddressEntityType.cs deleted file mode 100644 index 82db81b6..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/AddressEntityType.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class AddressEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Address", - typeof(Address), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var city = runtimeEntityType.AddProperty( - "City", - typeof(string), - propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50); - - var line1 = runtimeEntityType.AddProperty( - "Line1", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var line2 = runtimeEntityType.AddProperty( - "Line2", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var postalCode = runtimeEntityType.AddProperty( - "PostalCode", - typeof(string), - propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 20); - - var region = runtimeEntityType.AddProperty( - "Region", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 20); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Address"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs deleted file mode 100644 index 1dd4563b..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class DeviceFlowCodesEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", - typeof(DeviceFlowCodes), - baseEntityType); - - var userCode = runtimeEntityType.AddProperty( - "UserCode", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 200); - - var clientId = runtimeEntityType.AddProperty( - "ClientId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var creationTime = runtimeEntityType.AddProperty( - "CreationTime", - typeof(DateTime), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50000); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var deviceCode = runtimeEntityType.AddProperty( - "DeviceCode", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var expiration = runtimeEntityType.AddProperty( - "Expiration", - typeof(DateTime?), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var sessionId = runtimeEntityType.AddProperty( - "SessionId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var subjectId = runtimeEntityType.AddProperty( - "SubjectId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var key = runtimeEntityType.AddKey( - new[] { userCode }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { deviceCode }, - unique: true); - - var index0 = runtimeEntityType.AddIndex( - new[] { expiration }); - - return runtimeEntityType; - } - - 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", "DeviceCodes"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs deleted file mode 100644 index 8946b261..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityRoleClaimstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityRoleClaim", - typeof(IdentityRoleClaim), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var claimType = runtimeEntityType.AddProperty( - "ClaimType", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var claimValue = runtimeEntityType.AddProperty( - "ClaimValue", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var roleId = runtimeEntityType.AddProperty( - "RoleId", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { roleId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetRoleClaims"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityRoleEntityType.cs deleted file mode 100644 index 2f1fec2b..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityRoleEntityType.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityRoleEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityRole", - typeof(IdentityRole), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var concurrencyStamp = runtimeEntityType.AddProperty( - "ConcurrencyStamp", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - concurrencyToken: true); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var normalizedName = runtimeEntityType.AddProperty( - "NormalizedName", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { normalizedName }, - unique: true); - index.AddAnnotation("Relational:Name", "RoleNameIndex"); - - return runtimeEntityType; - } - - 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", "AspNetRoles"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs deleted file mode 100644 index 55418a1e..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserClaimstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserClaim", - typeof(IdentityUserClaim), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var claimType = runtimeEntityType.AddProperty( - "ClaimType", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var claimValue = runtimeEntityType.AddProperty( - "ClaimValue", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { userId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserClaims"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs deleted file mode 100644 index 3ca029bd..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserLoginstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserLogin", - typeof(IdentityUserLogin), - baseEntityType); - - var loginProvider = runtimeEntityType.AddProperty( - "LoginProvider", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var providerKey = runtimeEntityType.AddProperty( - "ProviderKey", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var providerDisplayName = runtimeEntityType.AddProperty( - "ProviderDisplayName", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { loginProvider, providerKey }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { userId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserLogins"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs deleted file mode 100644 index 70078d7a..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs +++ /dev/null @@ -1,82 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserRolestringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserRole", - typeof(IdentityUserRole), - baseEntityType); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var roleId = runtimeEntityType.AddProperty( - "RoleId", - typeof(string), - propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var key = runtimeEntityType.AddKey( - new[] { userId, roleId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { roleId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, - 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("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserRoles"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs deleted file mode 100644 index 93ba6d31..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserTokenstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserToken", - typeof(IdentityUserToken), - baseEntityType); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var loginProvider = runtimeEntityType.AddProperty( - "LoginProvider", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var value = runtimeEntityType.AddProperty( - "Value", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { userId, loginProvider, name }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserTokens"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/KeyEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/KeyEntityType.cs deleted file mode 100644 index f6c6b4c7..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/KeyEntityType.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class KeyEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.Key", - typeof(Key), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var algorithm = runtimeEntityType.AddProperty( - "Algorithm", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var created = runtimeEntityType.AddProperty( - "Created", - typeof(DateTime), - propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var dataProtected = runtimeEntityType.AddProperty( - "DataProtected", - typeof(bool), - propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var isX509Certificate = runtimeEntityType.AddProperty( - "IsX509Certificate", - typeof(bool), - propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var use = runtimeEntityType.AddProperty( - "Use", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var version = runtimeEntityType.AddProperty( - "Version", - typeof(int), - propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { use }); - - return runtimeEntityType; - } - - 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", "Keys"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/LatLongEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/LatLongEntityType.cs deleted file mode 100644 index 3fd254bd..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/LatLongEntityType.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class LatLongEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.LatLong", - typeof(LatLong), - baseEntityType); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var latitude = runtimeEntityType.AddProperty( - "Latitude", - typeof(double), - propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var longitude = runtimeEntityType.AddProperty( - "Longitude", - typeof(double), - propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { orderId }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - unique: true, - required: true, - ownership: true); - - var deliveryLocation = principalEntityType.AddNavigation("DeliveryLocation", - runtimeForeignKey, - onDependent: false, - typeof(LatLong), - propertyInfo: typeof(Order).GetProperty("DeliveryLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - eagerLoaded: 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", "Orders"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs deleted file mode 100644 index db236e4c..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class NotificationSubscriptionEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.NotificationSubscription", - typeof(NotificationSubscription), - baseEntityType); - - var notificationSubscriptionId = runtimeEntityType.AddProperty( - "NotificationSubscriptionId", - typeof(int), - propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var auth = runtimeEntityType.AddProperty( - "Auth", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var p256dh = runtimeEntityType.AddProperty( - "P256dh", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var url = runtimeEntityType.AddProperty( - "Url", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { notificationSubscriptionId }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "NotificationSubscriptions"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/OrderEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/OrderEntityType.cs deleted file mode 100644 index 9d9ec6fd..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/OrderEntityType.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class OrderEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Order", - typeof(Order), - baseEntityType); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var createdTime = runtimeEntityType.AddProperty( - "CreatedTime", - typeof(DateTime), - propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var deliveryAddressId = runtimeEntityType.AddProperty( - "DeliveryAddressId", - typeof(int?), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { orderId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { deliveryAddressId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType); - - var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", - runtimeForeignKey, - onDependent: true, - typeof(Address), - propertyInfo: typeof(Order).GetProperty("DeliveryAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("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", "Orders"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PersistedGrantEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PersistedGrantEntityType.cs deleted file mode 100644 index 842d53a5..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PersistedGrantEntityType.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PersistedGrantEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", - typeof(PersistedGrant), - baseEntityType); - - var key = runtimeEntityType.AddProperty( - "Key", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Key", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 200); - - var clientId = runtimeEntityType.AddProperty( - "ClientId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var consumedTime = runtimeEntityType.AddProperty( - "ConsumedTime", - typeof(DateTime?), - propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var creationTime = runtimeEntityType.AddProperty( - "CreationTime", - typeof(DateTime), - propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50000); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var expiration = runtimeEntityType.AddProperty( - "Expiration", - typeof(DateTime?), - propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var sessionId = runtimeEntityType.AddProperty( - "SessionId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var subjectId = runtimeEntityType.AddProperty( - "SubjectId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var type = runtimeEntityType.AddProperty( - "Type", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50); - - var key0 = runtimeEntityType.AddKey( - new[] { key }); - runtimeEntityType.SetPrimaryKey(key0); - - var index = runtimeEntityType.AddIndex( - new[] { consumedTime }); - - var index0 = runtimeEntityType.AddIndex( - new[] { expiration }); - - var index1 = runtimeEntityType.AddIndex( - new[] { subjectId, clientId, type }); - - var index2 = runtimeEntityType.AddIndex( - new[] { subjectId, sessionId, type }); - - return runtimeEntityType; - } - - 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", "PersistedGrants"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaEntityType.cs deleted file mode 100644 index 3a124e63..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaEntityType.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Pizza", - typeof(Pizza), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var size = runtimeEntityType.AddProperty( - "Size", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var specialId = runtimeEntityType.AddProperty( - "SpecialId", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { orderId }); - - var index0 = runtimeEntityType.AddIndex( - new[] { specialId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var pizzas = principalEntityType.AddNavigation("Pizzas", - runtimeForeignKey, - onDependent: false, - typeof(List), - propertyInfo: typeof(Order).GetProperty("Pizzas", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SpecialId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var special = declaringEntityType.AddNavigation("Special", - runtimeForeignKey, - onDependent: true, - typeof(PizzaSpecial), - propertyInfo: typeof(Pizza).GetProperty("Special", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("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", "Pizzas"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs deleted file mode 100644 index e86b0f50..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaSpecialEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.PizzaSpecial", - typeof(PizzaSpecial), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var basePrice = runtimeEntityType.AddProperty( - "BasePrice", - typeof(decimal), - propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var imageUrl = runtimeEntityType.AddProperty( - "ImageUrl", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Specials"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreContextModel.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreContextModel.cs deleted file mode 100644 index 8b516a68..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreContextModel.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - [DbContext(typeof(PizzaStoreContext))] - public partial class PizzaStoreContextModel : RuntimeModel - { - static PizzaStoreContextModel() - { - var model = new PizzaStoreContextModel(); - model.Initialize(); - model.Customize(); - _instance = model; - } - - private static PizzaStoreContextModel _instance; - public static IModel Instance => _instance; - - partial void Initialize(); - - partial void Customize(); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs deleted file mode 100644 index ba42d6b0..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - public partial class PizzaStoreContextModel - { - partial void Initialize() - { - var address = AddressEntityType.Create(this); - var latLong = LatLongEntityType.Create(this); - var notificationSubscription = NotificationSubscriptionEntityType.Create(this); - var order = OrderEntityType.Create(this); - var pizza = PizzaEntityType.Create(this); - var pizzaSpecial = PizzaSpecialEntityType.Create(this); - var pizzaTopping = PizzaToppingEntityType.Create(this); - var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); - var topping = ToppingEntityType.Create(this); - var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); - var key = KeyEntityType.Create(this); - var persistedGrant = PersistedGrantEntityType.Create(this); - var identityRole = IdentityRoleEntityType.Create(this); - var identityRoleClaimstring = IdentityRoleClaimstringEntityType.Create(this); - var identityUserClaimstring = IdentityUserClaimstringEntityType.Create(this); - var identityUserLoginstring = IdentityUserLoginstringEntityType.Create(this); - var identityUserRolestring = IdentityUserRolestringEntityType.Create(this); - var identityUserTokenstring = IdentityUserTokenstringEntityType.Create(this); - - LatLongEntityType.CreateForeignKey1(latLong, order); - OrderEntityType.CreateForeignKey1(order, address); - PizzaEntityType.CreateForeignKey1(pizza, order); - PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); - PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); - PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); - IdentityRoleClaimstringEntityType.CreateForeignKey1(identityRoleClaimstring, identityRole); - IdentityUserClaimstringEntityType.CreateForeignKey1(identityUserClaimstring, pizzaStoreUser); - IdentityUserLoginstringEntityType.CreateForeignKey1(identityUserLoginstring, pizzaStoreUser); - IdentityUserRolestringEntityType.CreateForeignKey1(identityUserRolestring, identityRole); - IdentityUserRolestringEntityType.CreateForeignKey2(identityUserRolestring, pizzaStoreUser); - IdentityUserTokenstringEntityType.CreateForeignKey1(identityUserTokenstring, pizzaStoreUser); - - AddressEntityType.CreateAnnotations(address); - LatLongEntityType.CreateAnnotations(latLong); - NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); - OrderEntityType.CreateAnnotations(order); - PizzaEntityType.CreateAnnotations(pizza); - PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); - PizzaToppingEntityType.CreateAnnotations(pizzaTopping); - PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); - ToppingEntityType.CreateAnnotations(topping); - DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); - KeyEntityType.CreateAnnotations(key); - PersistedGrantEntityType.CreateAnnotations(persistedGrant); - IdentityRoleEntityType.CreateAnnotations(identityRole); - IdentityRoleClaimstringEntityType.CreateAnnotations(identityRoleClaimstring); - IdentityUserClaimstringEntityType.CreateAnnotations(identityUserClaimstring); - IdentityUserLoginstringEntityType.CreateAnnotations(identityUserLoginstring); - IdentityUserRolestringEntityType.CreateAnnotations(identityUserRolestring); - IdentityUserTokenstringEntityType.CreateAnnotations(identityUserTokenstring); - - AddAnnotation("ProductVersion", "7.0.0"); - } - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs deleted file mode 100644 index 18b2d96d..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs +++ /dev/null @@ -1,156 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaStoreUserEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Server.PizzaStoreUser", - typeof(PizzaStoreUser), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var accessFailedCount = runtimeEntityType.AddProperty( - "AccessFailedCount", - typeof(int), - propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var concurrencyStamp = runtimeEntityType.AddProperty( - "ConcurrencyStamp", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - concurrencyToken: true); - - var email = runtimeEntityType.AddProperty( - "Email", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var emailConfirmed = runtimeEntityType.AddProperty( - "EmailConfirmed", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var lockoutEnabled = runtimeEntityType.AddProperty( - "LockoutEnabled", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var lockoutEnd = runtimeEntityType.AddProperty( - "LockoutEnd", - typeof(DateTimeOffset?), - propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var normalizedEmail = runtimeEntityType.AddProperty( - "NormalizedEmail", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var normalizedUserName = runtimeEntityType.AddProperty( - "NormalizedUserName", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var passwordHash = runtimeEntityType.AddProperty( - "PasswordHash", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var phoneNumber = runtimeEntityType.AddProperty( - "PhoneNumber", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var phoneNumberConfirmed = runtimeEntityType.AddProperty( - "PhoneNumberConfirmed", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var securityStamp = runtimeEntityType.AddProperty( - "SecurityStamp", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var twoFactorEnabled = runtimeEntityType.AddProperty( - "TwoFactorEnabled", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var userName = runtimeEntityType.AddProperty( - "UserName", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { normalizedEmail }); - index.AddAnnotation("Relational:Name", "EmailIndex"); - - var index0 = runtimeEntityType.AddIndex( - new[] { normalizedUserName }, - unique: true); - index0.AddAnnotation("Relational:Name", "UserNameIndex"); - - return runtimeEntityType; - } - - 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", "AspNetUsers"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaToppingEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaToppingEntityType.cs deleted file mode 100644 index b97d2a24..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/PizzaToppingEntityType.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaToppingEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.PizzaTopping", - typeof(PizzaTopping), - baseEntityType); - - var pizzaId = runtimeEntityType.AddProperty( - "PizzaId", - typeof(int), - propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var toppingId = runtimeEntityType.AddProperty( - "ToppingId", - typeof(int), - propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var key = runtimeEntityType.AddKey( - new[] { pizzaId, toppingId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { toppingId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PizzaId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var toppings = principalEntityType.AddNavigation("Toppings", - runtimeForeignKey, - onDependent: false, - typeof(List), - propertyInfo: typeof(Pizza).GetProperty("Toppings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ToppingId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var topping = declaringEntityType.AddNavigation("Topping", - runtimeForeignKey, - onDependent: true, - typeof(Topping), - propertyInfo: typeof(PizzaTopping).GetProperty("Topping", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("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", "PizzaTopping"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/ToppingEntityType.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Models/ToppingEntityType.cs deleted file mode 100644 index 9295f9bf..00000000 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Models/ToppingEntityType.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class ToppingEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Topping", - typeof(Topping), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var price = runtimeEntityType.AddProperty( - "Price", - typeof(decimal), - propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Toppings"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/Program.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/Program.cs index b83debb4..9db9e7ea 100644 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/Program.cs +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddDbContext(options => options.UseSqlite("Data Source=pizza.db") - .UseModel(BlazingPizza.Server.Models.PizzaStoreContextModel.Instance)); + .UseModel(BlazingPizza.Server.CompiledModels.PizzaStoreContextModel.Instance)); builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); diff --git a/save-points/09-progressive-web-app/BlazingPizza.Server/SeedData.cs b/save-points/09-progressive-web-app/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/save-points/09-progressive-web-app/BlazingPizza.Server/SeedData.cs +++ b/save-points/09-progressive-web-app/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/src/BlazingPizza.Server/BlazingPizza.Server.csproj b/src/BlazingPizza.Server/BlazingPizza.Server.csproj index b028c771..3b9de83d 100644 --- a/src/BlazingPizza.Server/BlazingPizza.Server.csproj +++ b/src/BlazingPizza.Server/BlazingPizza.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/BlazingPizza.Server/CompiledModels/AddressEntityType.cs b/src/BlazingPizza.Server/CompiledModels/AddressEntityType.cs new file mode 100644 index 00000000..f5908d82 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/AddressEntityType.cs @@ -0,0 +1,116 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class AddressEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Address", + typeof(Address), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var city = runtimeEntityType.AddProperty( + "City", + typeof(string), + propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + city.TypeMapping = SqliteStringTypeMapping.Default; + + var line1 = runtimeEntityType.AddProperty( + "Line1", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + line1.TypeMapping = SqliteStringTypeMapping.Default; + + var line2 = runtimeEntityType.AddProperty( + "Line2", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + line2.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var postalCode = runtimeEntityType.AddProperty( + "PostalCode", + typeof(string), + propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + postalCode.TypeMapping = SqliteStringTypeMapping.Default; + + var region = runtimeEntityType.AddProperty( + "Region", + typeof(string), + propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + region.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Address"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs b/src/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs new file mode 100644 index 00000000..6c5ca661 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/DeviceFlowCodesEntityType.cs @@ -0,0 +1,125 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class DeviceFlowCodesEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + typeof(DeviceFlowCodes), + baseEntityType); + + var userCode = runtimeEntityType.AddProperty( + "UserCode", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 200); + userCode.TypeMapping = SqliteStringTypeMapping.Default; + + var clientId = runtimeEntityType.AddProperty( + "ClientId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; + + var creationTime = runtimeEntityType.AddProperty( + "CreationTime", + typeof(DateTime), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var deviceCode = runtimeEntityType.AddProperty( + "DeviceCode", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + deviceCode.TypeMapping = SqliteStringTypeMapping.Default; + + var expiration = runtimeEntityType.AddProperty( + "Expiration", + typeof(DateTime?), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var sessionId = runtimeEntityType.AddProperty( + "SessionId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; + + var subjectId = runtimeEntityType.AddProperty( + "SubjectId", + typeof(string), + propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userCode }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { deviceCode }, + unique: true); + + var index0 = runtimeEntityType.AddIndex( + new[] { expiration }); + + return runtimeEntityType; + } + + 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", "DeviceCodes"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs b/src/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs new file mode 100644 index 00000000..73cabada --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/IdentityRoleClaimEntityType.cs @@ -0,0 +1,107 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityRoleClaimEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + typeof(IdentityRoleClaim), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var claimType = runtimeEntityType.AddProperty( + "ClaimType", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; + + var claimValue = runtimeEntityType.AddProperty( + "ClaimValue", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; + + var roleId = runtimeEntityType.AddProperty( + "RoleId", + typeof(string), + propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + roleId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { roleId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetRoleClaims"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs b/src/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs new file mode 100644 index 00000000..3f46cdc5 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/IdentityRoleEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityRoleEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityRole", + typeof(IdentityRole), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var concurrencyStamp = runtimeEntityType.AddProperty( + "ConcurrencyStamp", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var normalizedName = runtimeEntityType.AddProperty( + "NormalizedName", + typeof(string), + propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedName.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { normalizedName }, + unique: true); + index.AddAnnotation("Relational:Name", "RoleNameIndex"); + + return runtimeEntityType; + } + + 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", "AspNetRoles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs b/src/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs new file mode 100644 index 00000000..5de58bf8 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/IdentityUserClaimEntityType.cs @@ -0,0 +1,107 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserClaimEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + typeof(IdentityUserClaim), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var claimType = runtimeEntityType.AddProperty( + "ClaimType", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimType.TypeMapping = SqliteStringTypeMapping.Default; + + var claimValue = runtimeEntityType.AddProperty( + "ClaimValue", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + claimValue.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { userId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserClaims"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs b/src/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs new file mode 100644 index 00000000..fb868abc --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/IdentityUserLoginEntityType.cs @@ -0,0 +1,91 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserLoginEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + typeof(IdentityUserLogin), + baseEntityType); + + var loginProvider = runtimeEntityType.AddProperty( + "LoginProvider", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; + + var providerKey = runtimeEntityType.AddProperty( + "ProviderKey", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + providerKey.TypeMapping = SqliteStringTypeMapping.Default; + + var providerDisplayName = runtimeEntityType.AddProperty( + "ProviderDisplayName", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + providerDisplayName.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { loginProvider, providerKey }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { userId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserLogins"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs b/src/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs new file mode 100644 index 00000000..f22fd836 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/IdentityUserRoleEntityType.cs @@ -0,0 +1,85 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserRoleEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserRole", + typeof(IdentityUserRole), + baseEntityType); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var roleId = runtimeEntityType.AddProperty( + "RoleId", + typeof(string), + propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + roleId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userId, roleId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { roleId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, + 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("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserRoles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs b/src/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs new file mode 100644 index 00000000..b4e36069 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/IdentityUserTokenEntityType.cs @@ -0,0 +1,89 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class IdentityUserTokenEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.AspNetCore.Identity.IdentityUserToken", + typeof(IdentityUserToken), + baseEntityType); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var loginProvider = runtimeEntityType.AddProperty( + "LoginProvider", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + loginProvider.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 128); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var value = runtimeEntityType.AddProperty( + "Value", + typeof(string), + propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + value.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { userId, loginProvider, name }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + 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", "AspNetUserTokens"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/KeyEntityType.cs b/src/BlazingPizza.Server/CompiledModels/KeyEntityType.cs new file mode 100644 index 00000000..8743240a --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/KeyEntityType.cs @@ -0,0 +1,153 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class KeyEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.Key", + typeof(Key), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var algorithm = runtimeEntityType.AddProperty( + "Algorithm", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + algorithm.TypeMapping = SqliteStringTypeMapping.Default; + + var created = runtimeEntityType.AddProperty( + "Created", + typeof(DateTime), + propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + created.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var dataProtected = runtimeEntityType.AddProperty( + "DataProtected", + typeof(bool), + propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + dataProtected.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var isX509Certificate = runtimeEntityType.AddProperty( + "IsX509Certificate", + typeof(bool), + propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + isX509Certificate.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var use = runtimeEntityType.AddProperty( + "Use", + typeof(string), + propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + use.TypeMapping = SqliteStringTypeMapping.Default; + + var version = runtimeEntityType.AddProperty( + "Version", + typeof(int), + propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + version.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { use }); + + return runtimeEntityType; + } + + 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", "Keys"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs b/src/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs new file mode 100644 index 00000000..657b8093 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/LatLongEntityType.cs @@ -0,0 +1,130 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class LatLongEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.LatLong", + typeof(LatLong), + baseEntityType); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var latitude = runtimeEntityType.AddProperty( + "Latitude", + typeof(double), + propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + latitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); + + var longitude = runtimeEntityType.AddProperty( + "Longitude", + typeof(double), + propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + longitude.TypeMapping = DoubleTypeMapping.Default.Clone( + comparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + keyComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + providerValueComparer: new ValueComparer( + (double v1, double v2) => v1.Equals(v2), + (double v) => v.GetHashCode(), + (double v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "REAL")); + + var key = runtimeEntityType.AddKey( + new[] { orderId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true, + ownership: true); + + var deliveryLocation = principalEntityType.AddNavigation("DeliveryLocation", + runtimeForeignKey, + onDependent: false, + typeof(LatLong), + propertyInfo: typeof(Order).GetProperty("DeliveryLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + eagerLoaded: 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", "Orders"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs b/src/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs new file mode 100644 index 00000000..891722a1 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/NotificationSubscriptionEntityType.cs @@ -0,0 +1,99 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class NotificationSubscriptionEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.NotificationSubscription", + typeof(NotificationSubscription), + baseEntityType); + + var notificationSubscriptionId = runtimeEntityType.AddProperty( + "NotificationSubscriptionId", + typeof(int?), + propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw); + notificationSubscriptionId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + keyComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + providerValueComparer: new ValueComparer( + (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, + (Nullable v) => v.HasValue ? (int)v : 0, + (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var auth = runtimeEntityType.AddProperty( + "Auth", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + auth.TypeMapping = SqliteStringTypeMapping.Default; + + var p256dh = runtimeEntityType.AddProperty( + "P256dh", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + p256dh.TypeMapping = SqliteStringTypeMapping.Default; + + var url = runtimeEntityType.AddProperty( + "Url", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + url.TypeMapping = SqliteStringTypeMapping.Default; + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { notificationSubscriptionId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "NotificationSubscriptions"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/OrderEntityType.cs b/src/BlazingPizza.Server/CompiledModels/OrderEntityType.cs new file mode 100644 index 00000000..bf1e5171 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/OrderEntityType.cs @@ -0,0 +1,126 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class OrderEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Order", + typeof(Order), + baseEntityType); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var createdTime = runtimeEntityType.AddProperty( + "CreatedTime", + typeof(DateTime), + propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + createdTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var deliveryAddressId = runtimeEntityType.AddProperty( + "DeliveryAddressId", + typeof(int), + sentinel: 0); + deliveryAddressId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + userId.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { orderId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { deliveryAddressId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", + runtimeForeignKey, + onDependent: true, + typeof(Address), + propertyInfo: typeof(Order).GetProperty("DeliveryAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("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", "Orders"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs b/src/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs new file mode 100644 index 00000000..c57731dd --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/PersistedGrantEntityType.cs @@ -0,0 +1,139 @@ +// +using System; +using System.Reflection; +using Duende.IdentityServer.EntityFramework.Entities; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PersistedGrantEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + typeof(PersistedGrant), + baseEntityType); + + var key = runtimeEntityType.AddProperty( + "Key", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Key", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + maxLength: 200); + key.TypeMapping = SqliteStringTypeMapping.Default; + + var clientId = runtimeEntityType.AddProperty( + "ClientId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + clientId.TypeMapping = SqliteStringTypeMapping.Default; + + var consumedTime = runtimeEntityType.AddProperty( + "ConsumedTime", + typeof(DateTime?), + propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + consumedTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var creationTime = runtimeEntityType.AddProperty( + "CreationTime", + typeof(DateTime), + propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + creationTime.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50000); + data.TypeMapping = SqliteStringTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var expiration = runtimeEntityType.AddProperty( + "Expiration", + typeof(DateTime?), + propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + expiration.TypeMapping = SqliteDateTimeTypeMapping.Default; + + var sessionId = runtimeEntityType.AddProperty( + "SessionId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + sessionId.TypeMapping = SqliteStringTypeMapping.Default; + + var subjectId = runtimeEntityType.AddProperty( + "SubjectId", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + subjectId.TypeMapping = SqliteStringTypeMapping.Default; + + var type = runtimeEntityType.AddProperty( + "Type", + typeof(string), + propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + type.TypeMapping = SqliteStringTypeMapping.Default; + + var key0 = runtimeEntityType.AddKey( + new[] { key }); + runtimeEntityType.SetPrimaryKey(key0); + + var index = runtimeEntityType.AddIndex( + new[] { consumedTime }); + + var index0 = runtimeEntityType.AddIndex( + new[] { expiration }); + + var index1 = runtimeEntityType.AddIndex( + new[] { subjectId, clientId, type }); + + var index2 = runtimeEntityType.AddIndex( + new[] { subjectId, sessionId, type }); + + return runtimeEntityType; + } + + 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", "PersistedGrants"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs b/src/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs new file mode 100644 index 00000000..f8ac05e4 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/PizzaEntityType.cs @@ -0,0 +1,177 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Pizza", + typeof(Pizza), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var orderId = runtimeEntityType.AddProperty( + "OrderId", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + orderId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var size = runtimeEntityType.AddProperty( + "Size", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + size.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var specialId = runtimeEntityType.AddProperty( + "SpecialId", + typeof(int), + propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + specialId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { orderId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { specialId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var pizzas = principalEntityType.AddNavigation("Pizzas", + runtimeForeignKey, + onDependent: false, + typeof(List), + propertyInfo: typeof(Order).GetProperty("Pizzas", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SpecialId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var special = declaringEntityType.AddNavigation("Special", + runtimeForeignKey, + onDependent: true, + typeof(PizzaSpecial), + propertyInfo: typeof(Pizza).GetProperty("Special", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("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", "Pizzas"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs b/src/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs new file mode 100644 index 00000000..693286c8 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/PizzaSpecialEntityType.cs @@ -0,0 +1,97 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaSpecialEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.PizzaSpecial", + typeof(PizzaSpecial), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var basePrice = runtimeEntityType.AddProperty( + "BasePrice", + typeof(decimal), + propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + basePrice.TypeMapping = SqliteDecimalTypeMapping.Default; + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + description.TypeMapping = SqliteStringTypeMapping.Default; + + var imageUrl = runtimeEntityType.AddProperty( + "ImageUrl", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + imageUrl.TypeMapping = SqliteStringTypeMapping.Default; + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Specials"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs b/src/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs new file mode 100644 index 00000000..b7e36125 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/PizzaStoreContextModel.cs @@ -0,0 +1,47 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + [DbContext(typeof(PizzaStoreContext))] + public partial class PizzaStoreContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static PizzaStoreContextModel() + { + var model = new PizzaStoreContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = model; + } + + private static PizzaStoreContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs b/src/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs new file mode 100644 index 00000000..0f8d07cb --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/PizzaStoreContextModelBuilder.cs @@ -0,0 +1,1619 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + public partial class PizzaStoreContextModel + { + partial void Initialize() + { + var address = AddressEntityType.Create(this); + var latLong = LatLongEntityType.Create(this); + var notificationSubscription = NotificationSubscriptionEntityType.Create(this); + var order = OrderEntityType.Create(this); + var pizza = PizzaEntityType.Create(this); + var pizzaSpecial = PizzaSpecialEntityType.Create(this); + var pizzaTopping = PizzaToppingEntityType.Create(this); + var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); + var topping = ToppingEntityType.Create(this); + var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); + var key = KeyEntityType.Create(this); + var persistedGrant = PersistedGrantEntityType.Create(this); + var identityRole = IdentityRoleEntityType.Create(this); + var identityRoleClaim = IdentityRoleClaimEntityType.Create(this); + var identityUserClaim = IdentityUserClaimEntityType.Create(this); + var identityUserLogin = IdentityUserLoginEntityType.Create(this); + var identityUserRole = IdentityUserRoleEntityType.Create(this); + var identityUserToken = IdentityUserTokenEntityType.Create(this); + + LatLongEntityType.CreateForeignKey1(latLong, order); + OrderEntityType.CreateForeignKey1(order, address); + PizzaEntityType.CreateForeignKey1(pizza, order); + PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); + PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); + PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); + IdentityRoleClaimEntityType.CreateForeignKey1(identityRoleClaim, identityRole); + IdentityUserClaimEntityType.CreateForeignKey1(identityUserClaim, pizzaStoreUser); + IdentityUserLoginEntityType.CreateForeignKey1(identityUserLogin, pizzaStoreUser); + IdentityUserRoleEntityType.CreateForeignKey1(identityUserRole, identityRole); + IdentityUserRoleEntityType.CreateForeignKey2(identityUserRole, pizzaStoreUser); + IdentityUserTokenEntityType.CreateForeignKey1(identityUserToken, pizzaStoreUser); + + AddressEntityType.CreateAnnotations(address); + LatLongEntityType.CreateAnnotations(latLong); + NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); + OrderEntityType.CreateAnnotations(order); + PizzaEntityType.CreateAnnotations(pizza); + PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); + PizzaToppingEntityType.CreateAnnotations(pizzaTopping); + PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); + ToppingEntityType.CreateAnnotations(topping); + DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); + KeyEntityType.CreateAnnotations(key); + PersistedGrantEntityType.CreateAnnotations(persistedGrant); + IdentityRoleEntityType.CreateAnnotations(identityRole); + IdentityRoleClaimEntityType.CreateAnnotations(identityRoleClaim); + IdentityUserClaimEntityType.CreateAnnotations(identityUserClaim); + IdentityUserLoginEntityType.CreateAnnotations(identityUserLogin); + IdentityUserRoleEntityType.CreateAnnotations(identityUserRole); + IdentityUserTokenEntityType.CreateAnnotations(identityUserToken); + + AddAnnotation("ProductVersion", "8.0.0"); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var address = FindEntityType("BlazingPizza.Address")!; + + var defaultTableMappings = new List>(); + address.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var blazingPizzaAddressTableBase = new TableBase("BlazingPizza.Address", null, relationalModel); + var cityColumnBase = new ColumnBase("City", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("City", cityColumnBase); + var idColumnBase = new ColumnBase("Id", "INTEGER", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Id", idColumnBase); + var line1ColumnBase = new ColumnBase("Line1", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line1", line1ColumnBase); + var line2ColumnBase = new ColumnBase("Line2", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Line2", line2ColumnBase); + var nameColumnBase = new ColumnBase("Name", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Name", nameColumnBase); + var postalCodeColumnBase = new ColumnBase("PostalCode", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("PostalCode", postalCodeColumnBase); + var regionColumnBase = new ColumnBase("Region", "TEXT", blazingPizzaAddressTableBase); + blazingPizzaAddressTableBase.Columns.Add("Region", regionColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Address", blazingPizzaAddressTableBase); + var blazingPizzaAddressMappingBase = new TableMappingBase(address, blazingPizzaAddressTableBase, true); + blazingPizzaAddressTableBase.AddTypeMapping(blazingPizzaAddressMappingBase, false); + defaultTableMappings.Add(blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, address.FindProperty("Id")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)cityColumnBase, address.FindProperty("City")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line1ColumnBase, address.FindProperty("Line1")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)line2ColumnBase, address.FindProperty("Line2")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase, address.FindProperty("Name")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)postalCodeColumnBase, address.FindProperty("PostalCode")!, blazingPizzaAddressMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)regionColumnBase, address.FindProperty("Region")!, blazingPizzaAddressMappingBase); + + var tableMappings = new List(); + address.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var addressTable = new Table("Address", null, relationalModel); + var idColumn = new Column("Id", "INTEGER", addressTable); + addressTable.Columns.Add("Id", idColumn); + var cityColumn = new Column("City", "TEXT", addressTable); + addressTable.Columns.Add("City", cityColumn); + var line1Column = new Column("Line1", "TEXT", addressTable); + addressTable.Columns.Add("Line1", line1Column); + var line2Column = new Column("Line2", "TEXT", addressTable); + addressTable.Columns.Add("Line2", line2Column); + var nameColumn = new Column("Name", "TEXT", addressTable); + addressTable.Columns.Add("Name", nameColumn); + var postalCodeColumn = new Column("PostalCode", "TEXT", addressTable); + addressTable.Columns.Add("PostalCode", postalCodeColumn); + var regionColumn = new Column("Region", "TEXT", addressTable); + addressTable.Columns.Add("Region", regionColumn); + var pK_Address = new UniqueConstraint("PK_Address", addressTable, new[] { idColumn }); + addressTable.PrimaryKey = pK_Address; + var pK_AddressUc = RelationalModel.GetKey(this, + "BlazingPizza.Address", + new[] { "Id" }); + pK_Address.MappedKeys.Add(pK_AddressUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AddressUc).Add(pK_Address); + addressTable.UniqueConstraints.Add("PK_Address", pK_Address); + relationalModel.Tables.Add(("Address", null), addressTable); + var addressTableMapping = new TableMapping(address, addressTable, true); + addressTable.AddTypeMapping(addressTableMapping, false); + tableMappings.Add(addressTableMapping); + RelationalModel.CreateColumnMapping(idColumn, address.FindProperty("Id")!, addressTableMapping); + RelationalModel.CreateColumnMapping(cityColumn, address.FindProperty("City")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line1Column, address.FindProperty("Line1")!, addressTableMapping); + RelationalModel.CreateColumnMapping(line2Column, address.FindProperty("Line2")!, addressTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, address.FindProperty("Name")!, addressTableMapping); + RelationalModel.CreateColumnMapping(postalCodeColumn, address.FindProperty("PostalCode")!, addressTableMapping); + RelationalModel.CreateColumnMapping(regionColumn, address.FindProperty("Region")!, addressTableMapping); + + var latLong = FindEntityType("BlazingPizza.LatLong")!; + + var defaultTableMappings0 = new List>(); + latLong.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var blazingPizzaLatLongTableBase = new TableBase("BlazingPizza.LatLong", null, relationalModel); + var latitudeColumnBase = new ColumnBase("Latitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Latitude", latitudeColumnBase); + var longitudeColumnBase = new ColumnBase("Longitude", "REAL", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("Longitude", longitudeColumnBase); + var orderIdColumnBase = new ColumnBase("OrderId", "INTEGER", blazingPizzaLatLongTableBase); + blazingPizzaLatLongTableBase.Columns.Add("OrderId", orderIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.LatLong", blazingPizzaLatLongTableBase); + var blazingPizzaLatLongMappingBase = new TableMappingBase(latLong, blazingPizzaLatLongTableBase, true); + blazingPizzaLatLongTableBase.AddTypeMapping(blazingPizzaLatLongMappingBase, false); + defaultTableMappings0.Add(blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase, latLong.FindProperty("OrderId")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)latitudeColumnBase, latLong.FindProperty("Latitude")!, blazingPizzaLatLongMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)longitudeColumnBase, latLong.FindProperty("Longitude")!, blazingPizzaLatLongMappingBase); + + var tableMappings0 = new List(); + latLong.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var ordersTable = new Table("Orders", null, relationalModel); + var orderIdColumn = new Column("OrderId", "INTEGER", ordersTable); + ordersTable.Columns.Add("OrderId", orderIdColumn); + var createdTimeColumn = new Column("CreatedTime", "TEXT", ordersTable); + ordersTable.Columns.Add("CreatedTime", createdTimeColumn); + var deliveryAddressIdColumn = new Column("DeliveryAddressId", "INTEGER", ordersTable); + ordersTable.Columns.Add("DeliveryAddressId", deliveryAddressIdColumn); + var deliveryLocation_LatitudeColumn = new Column("DeliveryLocation_Latitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Latitude", deliveryLocation_LatitudeColumn); + var deliveryLocation_LongitudeColumn = new Column("DeliveryLocation_Longitude", "REAL", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("DeliveryLocation_Longitude", deliveryLocation_LongitudeColumn); + var userIdColumn = new Column("UserId", "TEXT", ordersTable) + { + IsNullable = true + }; + ordersTable.Columns.Add("UserId", userIdColumn); + var pK_Orders = new UniqueConstraint("PK_Orders", ordersTable, new[] { orderIdColumn }); + ordersTable.PrimaryKey = pK_Orders; + var pK_OrdersUc = RelationalModel.GetKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc).Add(pK_Orders); + var pK_OrdersUc0 = RelationalModel.GetKey(this, + "BlazingPizza.Order", + new[] { "OrderId" }); + pK_Orders.MappedKeys.Add(pK_OrdersUc0); + RelationalModel.GetOrCreateUniqueConstraints(pK_OrdersUc0).Add(pK_Orders); + ordersTable.UniqueConstraints.Add("PK_Orders", pK_Orders); + var iX_Orders_DeliveryAddressId = new TableIndex( + "IX_Orders_DeliveryAddressId", ordersTable, new[] { deliveryAddressIdColumn }, false); + var iX_Orders_DeliveryAddressIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }); + iX_Orders_DeliveryAddressId.MappedIndexes.Add(iX_Orders_DeliveryAddressIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Orders_DeliveryAddressIdIx).Add(iX_Orders_DeliveryAddressId); + ordersTable.Indexes.Add("IX_Orders_DeliveryAddressId", iX_Orders_DeliveryAddressId); + relationalModel.Tables.Add(("Orders", null), ordersTable); + var ordersTableMapping = new TableMapping(latLong, ordersTable, true) + { + IsSharedTablePrincipal = false, + }; + ordersTable.AddTypeMapping(ordersTableMapping, true); + tableMappings0.Add(ordersTableMapping); + ordersTable.AddRowInternalForeignKey(latLong, RelationalModel.GetForeignKey(this, + "BlazingPizza.LatLong", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" })); + RelationalModel.CreateColumnMapping(orderIdColumn, latLong.FindProperty("OrderId")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LatitudeColumn, latLong.FindProperty("Latitude")!, ordersTableMapping); + RelationalModel.CreateColumnMapping(deliveryLocation_LongitudeColumn, latLong.FindProperty("Longitude")!, ordersTableMapping); + + var notificationSubscription = FindEntityType("BlazingPizza.NotificationSubscription")!; + + var defaultTableMappings1 = new List>(); + notificationSubscription.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var blazingPizzaNotificationSubscriptionTableBase = new TableBase("BlazingPizza.NotificationSubscription", null, relationalModel); + var authColumnBase = new ColumnBase("Auth", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Auth", authColumnBase); + var notificationSubscriptionIdColumnBase = new ColumnBase("NotificationSubscriptionId", "INTEGER", blazingPizzaNotificationSubscriptionTableBase); + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumnBase); + var p256dhColumnBase = new ColumnBase("P256dh", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("P256dh", p256dhColumnBase); + var urlColumnBase = new ColumnBase("Url", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("Url", urlColumnBase); + var userIdColumnBase = new ColumnBase("UserId", "TEXT", blazingPizzaNotificationSubscriptionTableBase) + { + IsNullable = true + }; + blazingPizzaNotificationSubscriptionTableBase.Columns.Add("UserId", userIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.NotificationSubscription", blazingPizzaNotificationSubscriptionTableBase); + var blazingPizzaNotificationSubscriptionMappingBase = new TableMappingBase(notificationSubscription, blazingPizzaNotificationSubscriptionTableBase, true); + blazingPizzaNotificationSubscriptionTableBase.AddTypeMapping(blazingPizzaNotificationSubscriptionMappingBase, false); + defaultTableMappings1.Add(blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)notificationSubscriptionIdColumnBase, notificationSubscription.FindProperty("NotificationSubscriptionId")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)authColumnBase, notificationSubscription.FindProperty("Auth")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)p256dhColumnBase, notificationSubscription.FindProperty("P256dh")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)urlColumnBase, notificationSubscription.FindProperty("Url")!, blazingPizzaNotificationSubscriptionMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase, notificationSubscription.FindProperty("UserId")!, blazingPizzaNotificationSubscriptionMappingBase); + + var tableMappings1 = new List(); + notificationSubscription.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var notificationSubscriptionsTable = new Table("NotificationSubscriptions", null, relationalModel); + var notificationSubscriptionIdColumn = new Column("NotificationSubscriptionId", "INTEGER", notificationSubscriptionsTable); + notificationSubscriptionsTable.Columns.Add("NotificationSubscriptionId", notificationSubscriptionIdColumn); + var authColumn = new Column("Auth", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Auth", authColumn); + var p256dhColumn = new Column("P256dh", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("P256dh", p256dhColumn); + var urlColumn = new Column("Url", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("Url", urlColumn); + var userIdColumn0 = new Column("UserId", "TEXT", notificationSubscriptionsTable) + { + IsNullable = true + }; + notificationSubscriptionsTable.Columns.Add("UserId", userIdColumn0); + var pK_NotificationSubscriptions = new UniqueConstraint("PK_NotificationSubscriptions", notificationSubscriptionsTable, new[] { notificationSubscriptionIdColumn }); + notificationSubscriptionsTable.PrimaryKey = pK_NotificationSubscriptions; + var pK_NotificationSubscriptionsUc = RelationalModel.GetKey(this, + "BlazingPizza.NotificationSubscription", + new[] { "NotificationSubscriptionId" }); + pK_NotificationSubscriptions.MappedKeys.Add(pK_NotificationSubscriptionsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_NotificationSubscriptionsUc).Add(pK_NotificationSubscriptions); + notificationSubscriptionsTable.UniqueConstraints.Add("PK_NotificationSubscriptions", pK_NotificationSubscriptions); + relationalModel.Tables.Add(("NotificationSubscriptions", null), notificationSubscriptionsTable); + var notificationSubscriptionsTableMapping = new TableMapping(notificationSubscription, notificationSubscriptionsTable, true); + notificationSubscriptionsTable.AddTypeMapping(notificationSubscriptionsTableMapping, false); + tableMappings1.Add(notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(notificationSubscriptionIdColumn, notificationSubscription.FindProperty("NotificationSubscriptionId")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(authColumn, notificationSubscription.FindProperty("Auth")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(p256dhColumn, notificationSubscription.FindProperty("P256dh")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(urlColumn, notificationSubscription.FindProperty("Url")!, notificationSubscriptionsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn0, notificationSubscription.FindProperty("UserId")!, notificationSubscriptionsTableMapping); + + var order = FindEntityType("BlazingPizza.Order")!; + + var defaultTableMappings2 = new List>(); + order.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings2); + var blazingPizzaOrderTableBase = new TableBase("BlazingPizza.Order", null, relationalModel); + var createdTimeColumnBase = new ColumnBase("CreatedTime", "TEXT", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("CreatedTime", createdTimeColumnBase); + var deliveryAddressIdColumnBase = new ColumnBase("DeliveryAddressId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("DeliveryAddressId", deliveryAddressIdColumnBase); + var orderIdColumnBase0 = new ColumnBase("OrderId", "INTEGER", blazingPizzaOrderTableBase); + blazingPizzaOrderTableBase.Columns.Add("OrderId", orderIdColumnBase0); + var userIdColumnBase0 = new ColumnBase("UserId", "TEXT", blazingPizzaOrderTableBase) + { + IsNullable = true + }; + blazingPizzaOrderTableBase.Columns.Add("UserId", userIdColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.Order", blazingPizzaOrderTableBase); + var blazingPizzaOrderMappingBase = new TableMappingBase(order, blazingPizzaOrderTableBase, true); + blazingPizzaOrderTableBase.AddTypeMapping(blazingPizzaOrderMappingBase, false); + defaultTableMappings2.Add(blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase0, order.FindProperty("OrderId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdTimeColumnBase, order.FindProperty("CreatedTime")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deliveryAddressIdColumnBase, order.FindProperty("DeliveryAddressId")!, blazingPizzaOrderMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase0, order.FindProperty("UserId")!, blazingPizzaOrderMappingBase); + + var tableMappings2 = new List(); + order.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); + var ordersTableMapping0 = new TableMapping(order, ordersTable, true) + { + IsSharedTablePrincipal = true, + }; + ordersTable.AddTypeMapping(ordersTableMapping0, false); + tableMappings2.Add(ordersTableMapping0); + RelationalModel.CreateColumnMapping(orderIdColumn, order.FindProperty("OrderId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(createdTimeColumn, order.FindProperty("CreatedTime")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(deliveryAddressIdColumn, order.FindProperty("DeliveryAddressId")!, ordersTableMapping0); + RelationalModel.CreateColumnMapping(userIdColumn, order.FindProperty("UserId")!, ordersTableMapping0); + + var pizza = FindEntityType("BlazingPizza.Pizza")!; + + var defaultTableMappings3 = new List>(); + pizza.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings3); + var blazingPizzaPizzaTableBase = new TableBase("BlazingPizza.Pizza", null, relationalModel); + var idColumnBase0 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Id", idColumnBase0); + var orderIdColumnBase1 = new ColumnBase("OrderId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("OrderId", orderIdColumnBase1); + var sizeColumnBase = new ColumnBase("Size", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("Size", sizeColumnBase); + var specialIdColumnBase = new ColumnBase("SpecialId", "INTEGER", blazingPizzaPizzaTableBase); + blazingPizzaPizzaTableBase.Columns.Add("SpecialId", specialIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Pizza", blazingPizzaPizzaTableBase); + var blazingPizzaPizzaMappingBase = new TableMappingBase(pizza, blazingPizzaPizzaTableBase, true); + blazingPizzaPizzaTableBase.AddTypeMapping(blazingPizzaPizzaMappingBase, false); + defaultTableMappings3.Add(blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, pizza.FindProperty("Id")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)orderIdColumnBase1, pizza.FindProperty("OrderId")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sizeColumnBase, pizza.FindProperty("Size")!, blazingPizzaPizzaMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)specialIdColumnBase, pizza.FindProperty("SpecialId")!, blazingPizzaPizzaMappingBase); + + var tableMappings3 = new List(); + pizza.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); + var pizzasTable = new Table("Pizzas", null, relationalModel); + var idColumn0 = new Column("Id", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Id", idColumn0); + var orderIdColumn0 = new Column("OrderId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("OrderId", orderIdColumn0); + var sizeColumn = new Column("Size", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("Size", sizeColumn); + var specialIdColumn = new Column("SpecialId", "INTEGER", pizzasTable); + pizzasTable.Columns.Add("SpecialId", specialIdColumn); + var pK_Pizzas = new UniqueConstraint("PK_Pizzas", pizzasTable, new[] { idColumn0 }); + pizzasTable.PrimaryKey = pK_Pizzas; + var pK_PizzasUc = RelationalModel.GetKey(this, + "BlazingPizza.Pizza", + new[] { "Id" }); + pK_Pizzas.MappedKeys.Add(pK_PizzasUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzasUc).Add(pK_Pizzas); + pizzasTable.UniqueConstraints.Add("PK_Pizzas", pK_Pizzas); + var iX_Pizzas_OrderId = new TableIndex( + "IX_Pizzas_OrderId", pizzasTable, new[] { orderIdColumn0 }, false); + var iX_Pizzas_OrderIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }); + iX_Pizzas_OrderId.MappedIndexes.Add(iX_Pizzas_OrderIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_OrderIdIx).Add(iX_Pizzas_OrderId); + pizzasTable.Indexes.Add("IX_Pizzas_OrderId", iX_Pizzas_OrderId); + var iX_Pizzas_SpecialId = new TableIndex( + "IX_Pizzas_SpecialId", pizzasTable, new[] { specialIdColumn }, false); + var iX_Pizzas_SpecialIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }); + iX_Pizzas_SpecialId.MappedIndexes.Add(iX_Pizzas_SpecialIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_Pizzas_SpecialIdIx).Add(iX_Pizzas_SpecialId); + pizzasTable.Indexes.Add("IX_Pizzas_SpecialId", iX_Pizzas_SpecialId); + relationalModel.Tables.Add(("Pizzas", null), pizzasTable); + var pizzasTableMapping = new TableMapping(pizza, pizzasTable, true); + pizzasTable.AddTypeMapping(pizzasTableMapping, false); + tableMappings3.Add(pizzasTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, pizza.FindProperty("Id")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(orderIdColumn0, pizza.FindProperty("OrderId")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(sizeColumn, pizza.FindProperty("Size")!, pizzasTableMapping); + RelationalModel.CreateColumnMapping(specialIdColumn, pizza.FindProperty("SpecialId")!, pizzasTableMapping); + + var pizzaSpecial = FindEntityType("BlazingPizza.PizzaSpecial")!; + + var defaultTableMappings4 = new List>(); + pizzaSpecial.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); + var blazingPizzaPizzaSpecialTableBase = new TableBase("BlazingPizza.PizzaSpecial", null, relationalModel); + var basePriceColumnBase = new ColumnBase("BasePrice", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("BasePrice", basePriceColumnBase); + var descriptionColumnBase = new ColumnBase("Description", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Description", descriptionColumnBase); + var idColumnBase1 = new ColumnBase("Id", "INTEGER", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Id", idColumnBase1); + var imageUrlColumnBase = new ColumnBase("ImageUrl", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("ImageUrl", imageUrlColumnBase); + var nameColumnBase0 = new ColumnBase("Name", "TEXT", blazingPizzaPizzaSpecialTableBase); + blazingPizzaPizzaSpecialTableBase.Columns.Add("Name", nameColumnBase0); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaSpecial", blazingPizzaPizzaSpecialTableBase); + var blazingPizzaPizzaSpecialMappingBase = new TableMappingBase(pizzaSpecial, blazingPizzaPizzaSpecialTableBase, true); + blazingPizzaPizzaSpecialTableBase.AddTypeMapping(blazingPizzaPizzaSpecialMappingBase, false); + defaultTableMappings4.Add(blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, pizzaSpecial.FindProperty("Id")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)basePriceColumnBase, pizzaSpecial.FindProperty("BasePrice")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase, pizzaSpecial.FindProperty("Description")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)imageUrlColumnBase, pizzaSpecial.FindProperty("ImageUrl")!, blazingPizzaPizzaSpecialMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase0, pizzaSpecial.FindProperty("Name")!, blazingPizzaPizzaSpecialMappingBase); + + var tableMappings4 = new List(); + pizzaSpecial.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); + var specialsTable = new Table("Specials", null, relationalModel); + var idColumn1 = new Column("Id", "INTEGER", specialsTable); + specialsTable.Columns.Add("Id", idColumn1); + var basePriceColumn = new Column("BasePrice", "TEXT", specialsTable); + specialsTable.Columns.Add("BasePrice", basePriceColumn); + var descriptionColumn = new Column("Description", "TEXT", specialsTable); + specialsTable.Columns.Add("Description", descriptionColumn); + var imageUrlColumn = new Column("ImageUrl", "TEXT", specialsTable); + specialsTable.Columns.Add("ImageUrl", imageUrlColumn); + var nameColumn0 = new Column("Name", "TEXT", specialsTable); + specialsTable.Columns.Add("Name", nameColumn0); + var pK_Specials = new UniqueConstraint("PK_Specials", specialsTable, new[] { idColumn1 }); + specialsTable.PrimaryKey = pK_Specials; + var pK_SpecialsUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + pK_Specials.MappedKeys.Add(pK_SpecialsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_SpecialsUc).Add(pK_Specials); + specialsTable.UniqueConstraints.Add("PK_Specials", pK_Specials); + relationalModel.Tables.Add(("Specials", null), specialsTable); + var specialsTableMapping = new TableMapping(pizzaSpecial, specialsTable, true); + specialsTable.AddTypeMapping(specialsTableMapping, false); + tableMappings4.Add(specialsTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, pizzaSpecial.FindProperty("Id")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(basePriceColumn, pizzaSpecial.FindProperty("BasePrice")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn, pizzaSpecial.FindProperty("Description")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(imageUrlColumn, pizzaSpecial.FindProperty("ImageUrl")!, specialsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn0, pizzaSpecial.FindProperty("Name")!, specialsTableMapping); + + var pizzaTopping = FindEntityType("BlazingPizza.PizzaTopping")!; + + var defaultTableMappings5 = new List>(); + pizzaTopping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings5); + var blazingPizzaPizzaToppingTableBase = new TableBase("BlazingPizza.PizzaTopping", null, relationalModel); + var pizzaIdColumnBase = new ColumnBase("PizzaId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("PizzaId", pizzaIdColumnBase); + var toppingIdColumnBase = new ColumnBase("ToppingId", "INTEGER", blazingPizzaPizzaToppingTableBase); + blazingPizzaPizzaToppingTableBase.Columns.Add("ToppingId", toppingIdColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.PizzaTopping", blazingPizzaPizzaToppingTableBase); + var blazingPizzaPizzaToppingMappingBase = new TableMappingBase(pizzaTopping, blazingPizzaPizzaToppingTableBase, true); + blazingPizzaPizzaToppingTableBase.AddTypeMapping(blazingPizzaPizzaToppingMappingBase, false); + defaultTableMappings5.Add(blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pizzaIdColumnBase, pizzaTopping.FindProperty("PizzaId")!, blazingPizzaPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)toppingIdColumnBase, pizzaTopping.FindProperty("ToppingId")!, blazingPizzaPizzaToppingMappingBase); + + var tableMappings5 = new List(); + pizzaTopping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); + var pizzaToppingTable = new Table("PizzaTopping", null, relationalModel); + var pizzaIdColumn = new Column("PizzaId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("PizzaId", pizzaIdColumn); + var toppingIdColumn = new Column("ToppingId", "INTEGER", pizzaToppingTable); + pizzaToppingTable.Columns.Add("ToppingId", toppingIdColumn); + var pK_PizzaTopping = new UniqueConstraint("PK_PizzaTopping", pizzaToppingTable, new[] { pizzaIdColumn, toppingIdColumn }); + pizzaToppingTable.PrimaryKey = pK_PizzaTopping; + var pK_PizzaToppingUc = RelationalModel.GetKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId", "ToppingId" }); + pK_PizzaTopping.MappedKeys.Add(pK_PizzaToppingUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PizzaToppingUc).Add(pK_PizzaTopping); + pizzaToppingTable.UniqueConstraints.Add("PK_PizzaTopping", pK_PizzaTopping); + var iX_PizzaTopping_ToppingId = new TableIndex( + "IX_PizzaTopping_ToppingId", pizzaToppingTable, new[] { toppingIdColumn }, false); + var iX_PizzaTopping_ToppingIdIx = RelationalModel.GetIndex(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }); + iX_PizzaTopping_ToppingId.MappedIndexes.Add(iX_PizzaTopping_ToppingIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PizzaTopping_ToppingIdIx).Add(iX_PizzaTopping_ToppingId); + pizzaToppingTable.Indexes.Add("IX_PizzaTopping_ToppingId", iX_PizzaTopping_ToppingId); + relationalModel.Tables.Add(("PizzaTopping", null), pizzaToppingTable); + var pizzaToppingTableMapping = new TableMapping(pizzaTopping, pizzaToppingTable, true); + pizzaToppingTable.AddTypeMapping(pizzaToppingTableMapping, false); + tableMappings5.Add(pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(pizzaIdColumn, pizzaTopping.FindProperty("PizzaId")!, pizzaToppingTableMapping); + RelationalModel.CreateColumnMapping(toppingIdColumn, pizzaTopping.FindProperty("ToppingId")!, pizzaToppingTableMapping); + + var pizzaStoreUser = FindEntityType("BlazingPizza.Server.PizzaStoreUser")!; + + var defaultTableMappings6 = new List>(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings6); + var blazingPizzaServerPizzaStoreUserTableBase = new TableBase("BlazingPizza.Server.PizzaStoreUser", null, relationalModel); + var accessFailedCountColumnBase = new ColumnBase("AccessFailedCount", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("AccessFailedCount", accessFailedCountColumnBase); + var concurrencyStampColumnBase = new ColumnBase("ConcurrencyStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase); + var emailColumnBase = new ColumnBase("Email", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Email", emailColumnBase); + var emailConfirmedColumnBase = new ColumnBase("EmailConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("EmailConfirmed", emailConfirmedColumnBase); + var idColumnBase2 = new ColumnBase("Id", "TEXT", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("Id", idColumnBase2); + var lockoutEnabledColumnBase = new ColumnBase("LockoutEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnabled", lockoutEnabledColumnBase); + var lockoutEndColumnBase = new ColumnBase("LockoutEnd", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("LockoutEnd", lockoutEndColumnBase); + var normalizedEmailColumnBase = new ColumnBase("NormalizedEmail", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedEmail", normalizedEmailColumnBase); + var normalizedUserNameColumnBase = new ColumnBase("NormalizedUserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("NormalizedUserName", normalizedUserNameColumnBase); + var passwordHashColumnBase = new ColumnBase("PasswordHash", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PasswordHash", passwordHashColumnBase); + var phoneNumberColumnBase = new ColumnBase("PhoneNumber", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumber", phoneNumberColumnBase); + var phoneNumberConfirmedColumnBase = new ColumnBase("PhoneNumberConfirmed", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumnBase); + var securityStampColumnBase = new ColumnBase("SecurityStamp", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("SecurityStamp", securityStampColumnBase); + var twoFactorEnabledColumnBase = new ColumnBase("TwoFactorEnabled", "INTEGER", blazingPizzaServerPizzaStoreUserTableBase); + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumnBase); + var userNameColumnBase = new ColumnBase("UserName", "TEXT", blazingPizzaServerPizzaStoreUserTableBase) + { + IsNullable = true + }; + blazingPizzaServerPizzaStoreUserTableBase.Columns.Add("UserName", userNameColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Server.PizzaStoreUser", blazingPizzaServerPizzaStoreUserTableBase); + var blazingPizzaServerPizzaStoreUserMappingBase = new TableMappingBase(pizzaStoreUser, blazingPizzaServerPizzaStoreUserTableBase, true); + blazingPizzaServerPizzaStoreUserTableBase.AddTypeMapping(blazingPizzaServerPizzaStoreUserMappingBase, false); + defaultTableMappings6.Add(blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, pizzaStoreUser.FindProperty("Id")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)accessFailedCountColumnBase, pizzaStoreUser.FindProperty("AccessFailedCount")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailColumnBase, pizzaStoreUser.FindProperty("Email")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)emailConfirmedColumnBase, pizzaStoreUser.FindProperty("EmailConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEnabledColumnBase, pizzaStoreUser.FindProperty("LockoutEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)lockoutEndColumnBase, pizzaStoreUser.FindProperty("LockoutEnd")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedEmailColumnBase, pizzaStoreUser.FindProperty("NormalizedEmail")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedUserNameColumnBase, pizzaStoreUser.FindProperty("NormalizedUserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)passwordHashColumnBase, pizzaStoreUser.FindProperty("PasswordHash")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberColumnBase, pizzaStoreUser.FindProperty("PhoneNumber")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)phoneNumberConfirmedColumnBase, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)securityStampColumnBase, pizzaStoreUser.FindProperty("SecurityStamp")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)twoFactorEnabledColumnBase, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, blazingPizzaServerPizzaStoreUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userNameColumnBase, pizzaStoreUser.FindProperty("UserName")!, blazingPizzaServerPizzaStoreUserMappingBase); + + var tableMappings6 = new List(); + pizzaStoreUser.SetRuntimeAnnotation("Relational:TableMappings", tableMappings6); + var aspNetUsersTable = new Table("AspNetUsers", null, relationalModel); + var idColumn2 = new Column("Id", "TEXT", aspNetUsersTable); + aspNetUsersTable.Columns.Add("Id", idColumn2); + var accessFailedCountColumn = new Column("AccessFailedCount", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("AccessFailedCount", accessFailedCountColumn); + var concurrencyStampColumn = new Column("ConcurrencyStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn); + var emailColumn = new Column("Email", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("Email", emailColumn); + var emailConfirmedColumn = new Column("EmailConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("EmailConfirmed", emailConfirmedColumn); + var lockoutEnabledColumn = new Column("LockoutEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("LockoutEnabled", lockoutEnabledColumn); + var lockoutEndColumn = new Column("LockoutEnd", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("LockoutEnd", lockoutEndColumn); + var normalizedEmailColumn = new Column("NormalizedEmail", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedEmail", normalizedEmailColumn); + var normalizedUserNameColumn = new Column("NormalizedUserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("NormalizedUserName", normalizedUserNameColumn); + var passwordHashColumn = new Column("PasswordHash", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PasswordHash", passwordHashColumn); + var phoneNumberColumn = new Column("PhoneNumber", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("PhoneNumber", phoneNumberColumn); + var phoneNumberConfirmedColumn = new Column("PhoneNumberConfirmed", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("PhoneNumberConfirmed", phoneNumberConfirmedColumn); + var securityStampColumn = new Column("SecurityStamp", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("SecurityStamp", securityStampColumn); + var twoFactorEnabledColumn = new Column("TwoFactorEnabled", "INTEGER", aspNetUsersTable); + aspNetUsersTable.Columns.Add("TwoFactorEnabled", twoFactorEnabledColumn); + var userNameColumn = new Column("UserName", "TEXT", aspNetUsersTable) + { + IsNullable = true + }; + aspNetUsersTable.Columns.Add("UserName", userNameColumn); + var pK_AspNetUsers = new UniqueConstraint("PK_AspNetUsers", aspNetUsersTable, new[] { idColumn2 }); + aspNetUsersTable.PrimaryKey = pK_AspNetUsers; + var pK_AspNetUsersUc = RelationalModel.GetKey(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + pK_AspNetUsers.MappedKeys.Add(pK_AspNetUsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUsersUc).Add(pK_AspNetUsers); + aspNetUsersTable.UniqueConstraints.Add("PK_AspNetUsers", pK_AspNetUsers); + var emailIndex = new TableIndex( + "EmailIndex", aspNetUsersTable, new[] { normalizedEmailColumn }, false); + var emailIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedEmail" }); + emailIndex.MappedIndexes.Add(emailIndexIx); + RelationalModel.GetOrCreateTableIndexes(emailIndexIx).Add(emailIndex); + aspNetUsersTable.Indexes.Add("EmailIndex", emailIndex); + var userNameIndex = new TableIndex( + "UserNameIndex", aspNetUsersTable, new[] { normalizedUserNameColumn }, true); + var userNameIndexIx = RelationalModel.GetIndex(this, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "NormalizedUserName" }); + userNameIndex.MappedIndexes.Add(userNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(userNameIndexIx).Add(userNameIndex); + aspNetUsersTable.Indexes.Add("UserNameIndex", userNameIndex); + relationalModel.Tables.Add(("AspNetUsers", null), aspNetUsersTable); + var aspNetUsersTableMapping = new TableMapping(pizzaStoreUser, aspNetUsersTable, true); + aspNetUsersTable.AddTypeMapping(aspNetUsersTableMapping, false); + tableMappings6.Add(aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(idColumn2, pizzaStoreUser.FindProperty("Id")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(accessFailedCountColumn, pizzaStoreUser.FindProperty("AccessFailedCount")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn, pizzaStoreUser.FindProperty("ConcurrencyStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailColumn, pizzaStoreUser.FindProperty("Email")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(emailConfirmedColumn, pizzaStoreUser.FindProperty("EmailConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEnabledColumn, pizzaStoreUser.FindProperty("LockoutEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(lockoutEndColumn, pizzaStoreUser.FindProperty("LockoutEnd")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedEmailColumn, pizzaStoreUser.FindProperty("NormalizedEmail")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(normalizedUserNameColumn, pizzaStoreUser.FindProperty("NormalizedUserName")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(passwordHashColumn, pizzaStoreUser.FindProperty("PasswordHash")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberColumn, pizzaStoreUser.FindProperty("PhoneNumber")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(phoneNumberConfirmedColumn, pizzaStoreUser.FindProperty("PhoneNumberConfirmed")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(securityStampColumn, pizzaStoreUser.FindProperty("SecurityStamp")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(twoFactorEnabledColumn, pizzaStoreUser.FindProperty("TwoFactorEnabled")!, aspNetUsersTableMapping); + RelationalModel.CreateColumnMapping(userNameColumn, pizzaStoreUser.FindProperty("UserName")!, aspNetUsersTableMapping); + + var topping = FindEntityType("BlazingPizza.Topping")!; + + var defaultTableMappings7 = new List>(); + topping.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings7); + var blazingPizzaToppingTableBase = new TableBase("BlazingPizza.Topping", null, relationalModel); + var idColumnBase3 = new ColumnBase("Id", "INTEGER", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Id", idColumnBase3); + var nameColumnBase1 = new ColumnBase("Name", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Name", nameColumnBase1); + var priceColumnBase = new ColumnBase("Price", "TEXT", blazingPizzaToppingTableBase); + blazingPizzaToppingTableBase.Columns.Add("Price", priceColumnBase); + relationalModel.DefaultTables.Add("BlazingPizza.Topping", blazingPizzaToppingTableBase); + var blazingPizzaToppingMappingBase = new TableMappingBase(topping, blazingPizzaToppingTableBase, true); + blazingPizzaToppingTableBase.AddTypeMapping(blazingPizzaToppingMappingBase, false); + defaultTableMappings7.Add(blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase3, topping.FindProperty("Id")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase1, topping.FindProperty("Name")!, blazingPizzaToppingMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)priceColumnBase, topping.FindProperty("Price")!, blazingPizzaToppingMappingBase); + + var tableMappings7 = new List(); + topping.SetRuntimeAnnotation("Relational:TableMappings", tableMappings7); + var toppingsTable = new Table("Toppings", null, relationalModel); + var idColumn3 = new Column("Id", "INTEGER", toppingsTable); + toppingsTable.Columns.Add("Id", idColumn3); + var nameColumn1 = new Column("Name", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Name", nameColumn1); + var priceColumn = new Column("Price", "TEXT", toppingsTable); + toppingsTable.Columns.Add("Price", priceColumn); + var pK_Toppings = new UniqueConstraint("PK_Toppings", toppingsTable, new[] { idColumn3 }); + toppingsTable.PrimaryKey = pK_Toppings; + var pK_ToppingsUc = RelationalModel.GetKey(this, + "BlazingPizza.Topping", + new[] { "Id" }); + pK_Toppings.MappedKeys.Add(pK_ToppingsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_ToppingsUc).Add(pK_Toppings); + toppingsTable.UniqueConstraints.Add("PK_Toppings", pK_Toppings); + relationalModel.Tables.Add(("Toppings", null), toppingsTable); + var toppingsTableMapping = new TableMapping(topping, toppingsTable, true); + toppingsTable.AddTypeMapping(toppingsTableMapping, false); + tableMappings7.Add(toppingsTableMapping); + RelationalModel.CreateColumnMapping(idColumn3, topping.FindProperty("Id")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(nameColumn1, topping.FindProperty("Name")!, toppingsTableMapping); + RelationalModel.CreateColumnMapping(priceColumn, topping.FindProperty("Price")!, toppingsTableMapping); + + var deviceFlowCodes = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes")!; + + var defaultTableMappings8 = new List>(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings8); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", null, relationalModel); + var clientIdColumnBase = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("ClientId", clientIdColumnBase); + var creationTimeColumnBase = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("CreationTime", creationTimeColumnBase); + var dataColumnBase = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Data", dataColumnBase); + var descriptionColumnBase0 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Description", descriptionColumnBase0); + var deviceCodeColumnBase = new ColumnBase("DeviceCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("DeviceCode", deviceCodeColumnBase); + var expirationColumnBase = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("Expiration", expirationColumnBase); + var sessionIdColumnBase = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SessionId", sessionIdColumnBase); + var subjectIdColumnBase = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("SubjectId", subjectIdColumnBase); + var userCodeColumnBase = new ColumnBase("UserCode", "TEXT", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.Columns.Add("UserCode", userCodeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase); + var duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase = new TableMappingBase(deviceFlowCodes, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase, false); + defaultTableMappings8.Add(duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userCodeColumnBase, deviceFlowCodes.FindProperty("UserCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase, deviceFlowCodes.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase, deviceFlowCodes.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, deviceFlowCodes.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase0, deviceFlowCodes.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)deviceCodeColumnBase, deviceFlowCodes.FindProperty("DeviceCode")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase, deviceFlowCodes.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase, deviceFlowCodes.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase, deviceFlowCodes.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesDeviceFlowCodesMappingBase); + + var tableMappings8 = new List(); + deviceFlowCodes.SetRuntimeAnnotation("Relational:TableMappings", tableMappings8); + var deviceCodesTable = new Table("DeviceCodes", null, relationalModel); + var userCodeColumn = new Column("UserCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("UserCode", userCodeColumn); + var clientIdColumn = new Column("ClientId", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("ClientId", clientIdColumn); + var creationTimeColumn = new Column("CreationTime", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("CreationTime", creationTimeColumn); + var dataColumn = new Column("Data", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Data", dataColumn); + var descriptionColumn0 = new Column("Description", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("Description", descriptionColumn0); + var deviceCodeColumn = new Column("DeviceCode", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("DeviceCode", deviceCodeColumn); + var expirationColumn = new Column("Expiration", "TEXT", deviceCodesTable); + deviceCodesTable.Columns.Add("Expiration", expirationColumn); + var sessionIdColumn = new Column("SessionId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SessionId", sessionIdColumn); + var subjectIdColumn = new Column("SubjectId", "TEXT", deviceCodesTable) + { + IsNullable = true + }; + deviceCodesTable.Columns.Add("SubjectId", subjectIdColumn); + var pK_DeviceCodes = new UniqueConstraint("PK_DeviceCodes", deviceCodesTable, new[] { userCodeColumn }); + deviceCodesTable.PrimaryKey = pK_DeviceCodes; + var pK_DeviceCodesUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "UserCode" }); + pK_DeviceCodes.MappedKeys.Add(pK_DeviceCodesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_DeviceCodesUc).Add(pK_DeviceCodes); + deviceCodesTable.UniqueConstraints.Add("PK_DeviceCodes", pK_DeviceCodes); + var iX_DeviceCodes_DeviceCode = new TableIndex( + "IX_DeviceCodes_DeviceCode", deviceCodesTable, new[] { deviceCodeColumn }, true); + var iX_DeviceCodes_DeviceCodeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "DeviceCode" }); + iX_DeviceCodes_DeviceCode.MappedIndexes.Add(iX_DeviceCodes_DeviceCodeIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_DeviceCodeIx).Add(iX_DeviceCodes_DeviceCode); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_DeviceCode", iX_DeviceCodes_DeviceCode); + var iX_DeviceCodes_Expiration = new TableIndex( + "IX_DeviceCodes_Expiration", deviceCodesTable, new[] { expirationColumn }, false); + var iX_DeviceCodes_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", + new[] { "Expiration" }); + iX_DeviceCodes_Expiration.MappedIndexes.Add(iX_DeviceCodes_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_DeviceCodes_ExpirationIx).Add(iX_DeviceCodes_Expiration); + deviceCodesTable.Indexes.Add("IX_DeviceCodes_Expiration", iX_DeviceCodes_Expiration); + relationalModel.Tables.Add(("DeviceCodes", null), deviceCodesTable); + var deviceCodesTableMapping = new TableMapping(deviceFlowCodes, deviceCodesTable, true); + deviceCodesTable.AddTypeMapping(deviceCodesTableMapping, false); + tableMappings8.Add(deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(userCodeColumn, deviceFlowCodes.FindProperty("UserCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn, deviceFlowCodes.FindProperty("ClientId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn, deviceFlowCodes.FindProperty("CreationTime")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, deviceFlowCodes.FindProperty("Data")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn0, deviceFlowCodes.FindProperty("Description")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(deviceCodeColumn, deviceFlowCodes.FindProperty("DeviceCode")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn, deviceFlowCodes.FindProperty("Expiration")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn, deviceFlowCodes.FindProperty("SessionId")!, deviceCodesTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn, deviceFlowCodes.FindProperty("SubjectId")!, deviceCodesTableMapping); + + var key = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.Key")!; + + var defaultTableMappings9 = new List>(); + key.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings9); + var duendeIdentityServerEntityFrameworkEntitiesKeyTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.Key", null, relationalModel); + var algorithmColumnBase = new ColumnBase("Algorithm", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Algorithm", algorithmColumnBase); + var createdColumnBase = new ColumnBase("Created", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Created", createdColumnBase); + var dataColumnBase0 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Data", dataColumnBase0); + var dataProtectedColumnBase = new ColumnBase("DataProtected", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("DataProtected", dataProtectedColumnBase); + var idColumnBase4 = new ColumnBase("Id", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Id", idColumnBase4); + var isX509CertificateColumnBase = new ColumnBase("IsX509Certificate", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("IsX509Certificate", isX509CertificateColumnBase); + var useColumnBase = new ColumnBase("Use", "TEXT", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Use", useColumnBase); + var versionColumnBase = new ColumnBase("Version", "INTEGER", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.Columns.Add("Version", versionColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.Key", duendeIdentityServerEntityFrameworkEntitiesKeyTableBase); + var duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase = new TableMappingBase(key, duendeIdentityServerEntityFrameworkEntitiesKeyTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesKeyTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase, false); + defaultTableMappings9.Add(duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase4, key.FindProperty("Id")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)algorithmColumnBase, key.FindProperty("Algorithm")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)createdColumnBase, key.FindProperty("Created")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase0, key.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataProtectedColumnBase, key.FindProperty("DataProtected")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)isX509CertificateColumnBase, key.FindProperty("IsX509Certificate")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)useColumnBase, key.FindProperty("Use")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)versionColumnBase, key.FindProperty("Version")!, duendeIdentityServerEntityFrameworkEntitiesKeyMappingBase); + + var tableMappings9 = new List(); + key.SetRuntimeAnnotation("Relational:TableMappings", tableMappings9); + var keysTable = new Table("Keys", null, relationalModel); + var idColumn4 = new Column("Id", "TEXT", keysTable); + keysTable.Columns.Add("Id", idColumn4); + var algorithmColumn = new Column("Algorithm", "TEXT", keysTable); + keysTable.Columns.Add("Algorithm", algorithmColumn); + var createdColumn = new Column("Created", "TEXT", keysTable); + keysTable.Columns.Add("Created", createdColumn); + var dataColumn0 = new Column("Data", "TEXT", keysTable); + keysTable.Columns.Add("Data", dataColumn0); + var dataProtectedColumn = new Column("DataProtected", "INTEGER", keysTable); + keysTable.Columns.Add("DataProtected", dataProtectedColumn); + var isX509CertificateColumn = new Column("IsX509Certificate", "INTEGER", keysTable); + keysTable.Columns.Add("IsX509Certificate", isX509CertificateColumn); + var useColumn = new Column("Use", "TEXT", keysTable) + { + IsNullable = true + }; + keysTable.Columns.Add("Use", useColumn); + var versionColumn = new Column("Version", "INTEGER", keysTable); + keysTable.Columns.Add("Version", versionColumn); + var pK_Keys = new UniqueConstraint("PK_Keys", keysTable, new[] { idColumn4 }); + keysTable.PrimaryKey = pK_Keys; + var pK_KeysUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Id" }); + pK_Keys.MappedKeys.Add(pK_KeysUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_KeysUc).Add(pK_Keys); + keysTable.UniqueConstraints.Add("PK_Keys", pK_Keys); + var iX_Keys_Use = new TableIndex( + "IX_Keys_Use", keysTable, new[] { useColumn }, false); + var iX_Keys_UseIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.Key", + new[] { "Use" }); + iX_Keys_Use.MappedIndexes.Add(iX_Keys_UseIx); + RelationalModel.GetOrCreateTableIndexes(iX_Keys_UseIx).Add(iX_Keys_Use); + keysTable.Indexes.Add("IX_Keys_Use", iX_Keys_Use); + relationalModel.Tables.Add(("Keys", null), keysTable); + var keysTableMapping = new TableMapping(key, keysTable, true); + keysTable.AddTypeMapping(keysTableMapping, false); + tableMappings9.Add(keysTableMapping); + RelationalModel.CreateColumnMapping(idColumn4, key.FindProperty("Id")!, keysTableMapping); + RelationalModel.CreateColumnMapping(algorithmColumn, key.FindProperty("Algorithm")!, keysTableMapping); + RelationalModel.CreateColumnMapping(createdColumn, key.FindProperty("Created")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataColumn0, key.FindProperty("Data")!, keysTableMapping); + RelationalModel.CreateColumnMapping(dataProtectedColumn, key.FindProperty("DataProtected")!, keysTableMapping); + RelationalModel.CreateColumnMapping(isX509CertificateColumn, key.FindProperty("IsX509Certificate")!, keysTableMapping); + RelationalModel.CreateColumnMapping(useColumn, key.FindProperty("Use")!, keysTableMapping); + RelationalModel.CreateColumnMapping(versionColumn, key.FindProperty("Version")!, keysTableMapping); + + var persistedGrant = FindEntityType("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant")!; + + var defaultTableMappings10 = new List>(); + persistedGrant.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings10); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase = new TableBase("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", null, relationalModel); + var clientIdColumnBase0 = new ColumnBase("ClientId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ClientId", clientIdColumnBase0); + var consumedTimeColumnBase = new ColumnBase("ConsumedTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("ConsumedTime", consumedTimeColumnBase); + var creationTimeColumnBase0 = new ColumnBase("CreationTime", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("CreationTime", creationTimeColumnBase0); + var dataColumnBase1 = new ColumnBase("Data", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Data", dataColumnBase1); + var descriptionColumnBase1 = new ColumnBase("Description", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Description", descriptionColumnBase1); + var expirationColumnBase0 = new ColumnBase("Expiration", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Expiration", expirationColumnBase0); + var keyColumnBase = new ColumnBase("Key", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Key", keyColumnBase); + var sessionIdColumnBase0 = new ColumnBase("SessionId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SessionId", sessionIdColumnBase0); + var subjectIdColumnBase0 = new ColumnBase("SubjectId", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase) + { + IsNullable = true + }; + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("SubjectId", subjectIdColumnBase0); + var typeColumnBase = new ColumnBase("Type", "TEXT", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.Columns.Add("Type", typeColumnBase); + relationalModel.DefaultTables.Add("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase); + var duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase = new TableMappingBase(persistedGrant, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase, true); + duendeIdentityServerEntityFrameworkEntitiesPersistedGrantTableBase.AddTypeMapping(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase, false); + defaultTableMappings10.Add(duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)keyColumnBase, persistedGrant.FindProperty("Key")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)clientIdColumnBase0, persistedGrant.FindProperty("ClientId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)consumedTimeColumnBase, persistedGrant.FindProperty("ConsumedTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)creationTimeColumnBase0, persistedGrant.FindProperty("CreationTime")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase1, persistedGrant.FindProperty("Data")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)descriptionColumnBase1, persistedGrant.FindProperty("Description")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)expirationColumnBase0, persistedGrant.FindProperty("Expiration")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)sessionIdColumnBase0, persistedGrant.FindProperty("SessionId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)subjectIdColumnBase0, persistedGrant.FindProperty("SubjectId")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)typeColumnBase, persistedGrant.FindProperty("Type")!, duendeIdentityServerEntityFrameworkEntitiesPersistedGrantMappingBase); + + var tableMappings10 = new List(); + persistedGrant.SetRuntimeAnnotation("Relational:TableMappings", tableMappings10); + var persistedGrantsTable = new Table("PersistedGrants", null, relationalModel); + var keyColumn = new Column("Key", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Key", keyColumn); + var clientIdColumn0 = new Column("ClientId", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("ClientId", clientIdColumn0); + var consumedTimeColumn = new Column("ConsumedTime", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("ConsumedTime", consumedTimeColumn); + var creationTimeColumn0 = new Column("CreationTime", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("CreationTime", creationTimeColumn0); + var dataColumn1 = new Column("Data", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Data", dataColumn1); + var descriptionColumn1 = new Column("Description", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Description", descriptionColumn1); + var expirationColumn0 = new Column("Expiration", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("Expiration", expirationColumn0); + var sessionIdColumn0 = new Column("SessionId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SessionId", sessionIdColumn0); + var subjectIdColumn0 = new Column("SubjectId", "TEXT", persistedGrantsTable) + { + IsNullable = true + }; + persistedGrantsTable.Columns.Add("SubjectId", subjectIdColumn0); + var typeColumn = new Column("Type", "TEXT", persistedGrantsTable); + persistedGrantsTable.Columns.Add("Type", typeColumn); + var pK_PersistedGrants = new UniqueConstraint("PK_PersistedGrants", persistedGrantsTable, new[] { keyColumn }); + persistedGrantsTable.PrimaryKey = pK_PersistedGrants; + var pK_PersistedGrantsUc = RelationalModel.GetKey(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Key" }); + pK_PersistedGrants.MappedKeys.Add(pK_PersistedGrantsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_PersistedGrantsUc).Add(pK_PersistedGrants); + persistedGrantsTable.UniqueConstraints.Add("PK_PersistedGrants", pK_PersistedGrants); + var iX_PersistedGrants_ConsumedTime = new TableIndex( + "IX_PersistedGrants_ConsumedTime", persistedGrantsTable, new[] { consumedTimeColumn }, false); + var iX_PersistedGrants_ConsumedTimeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "ConsumedTime" }); + iX_PersistedGrants_ConsumedTime.MappedIndexes.Add(iX_PersistedGrants_ConsumedTimeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ConsumedTimeIx).Add(iX_PersistedGrants_ConsumedTime); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_ConsumedTime", iX_PersistedGrants_ConsumedTime); + var iX_PersistedGrants_Expiration = new TableIndex( + "IX_PersistedGrants_Expiration", persistedGrantsTable, new[] { expirationColumn0 }, false); + var iX_PersistedGrants_ExpirationIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "Expiration" }); + iX_PersistedGrants_Expiration.MappedIndexes.Add(iX_PersistedGrants_ExpirationIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_ExpirationIx).Add(iX_PersistedGrants_Expiration); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_Expiration", iX_PersistedGrants_Expiration); + var iX_PersistedGrants_SubjectId_ClientId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_ClientId_Type", persistedGrantsTable, new[] { subjectIdColumn0, clientIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_ClientId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "ClientId", "Type" }); + iX_PersistedGrants_SubjectId_ClientId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_ClientId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_ClientId_TypeIx).Add(iX_PersistedGrants_SubjectId_ClientId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_ClientId_Type", iX_PersistedGrants_SubjectId_ClientId_Type); + var iX_PersistedGrants_SubjectId_SessionId_Type = new TableIndex( + "IX_PersistedGrants_SubjectId_SessionId_Type", persistedGrantsTable, new[] { subjectIdColumn0, sessionIdColumn0, typeColumn }, false); + var iX_PersistedGrants_SubjectId_SessionId_TypeIx = RelationalModel.GetIndex(this, + "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", + new[] { "SubjectId", "SessionId", "Type" }); + iX_PersistedGrants_SubjectId_SessionId_Type.MappedIndexes.Add(iX_PersistedGrants_SubjectId_SessionId_TypeIx); + RelationalModel.GetOrCreateTableIndexes(iX_PersistedGrants_SubjectId_SessionId_TypeIx).Add(iX_PersistedGrants_SubjectId_SessionId_Type); + persistedGrantsTable.Indexes.Add("IX_PersistedGrants_SubjectId_SessionId_Type", iX_PersistedGrants_SubjectId_SessionId_Type); + relationalModel.Tables.Add(("PersistedGrants", null), persistedGrantsTable); + var persistedGrantsTableMapping = new TableMapping(persistedGrant, persistedGrantsTable, true); + persistedGrantsTable.AddTypeMapping(persistedGrantsTableMapping, false); + tableMappings10.Add(persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(keyColumn, persistedGrant.FindProperty("Key")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(clientIdColumn0, persistedGrant.FindProperty("ClientId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(consumedTimeColumn, persistedGrant.FindProperty("ConsumedTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(creationTimeColumn0, persistedGrant.FindProperty("CreationTime")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(dataColumn1, persistedGrant.FindProperty("Data")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(descriptionColumn1, persistedGrant.FindProperty("Description")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(expirationColumn0, persistedGrant.FindProperty("Expiration")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(sessionIdColumn0, persistedGrant.FindProperty("SessionId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(subjectIdColumn0, persistedGrant.FindProperty("SubjectId")!, persistedGrantsTableMapping); + RelationalModel.CreateColumnMapping(typeColumn, persistedGrant.FindProperty("Type")!, persistedGrantsTableMapping); + + var identityRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRole")!; + + var defaultTableMappings11 = new List>(); + identityRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings11); + var microsoftAspNetCoreIdentityIdentityRoleTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRole", null, relationalModel); + var concurrencyStampColumnBase0 = new ColumnBase("ConcurrencyStamp", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("ConcurrencyStamp", concurrencyStampColumnBase0); + var idColumnBase5 = new ColumnBase("Id", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase); + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Id", idColumnBase5); + var nameColumnBase2 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("Name", nameColumnBase2); + var normalizedNameColumnBase = new ColumnBase("NormalizedName", "TEXT", microsoftAspNetCoreIdentityIdentityRoleTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleTableBase.Columns.Add("NormalizedName", normalizedNameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRole", microsoftAspNetCoreIdentityIdentityRoleTableBase); + var microsoftAspNetCoreIdentityIdentityRoleMappingBase = new TableMappingBase(identityRole, microsoftAspNetCoreIdentityIdentityRoleTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleMappingBase, false); + defaultTableMappings11.Add(microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase5, identityRole.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)concurrencyStampColumnBase0, identityRole.FindProperty("ConcurrencyStamp")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase2, identityRole.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)normalizedNameColumnBase, identityRole.FindProperty("NormalizedName")!, microsoftAspNetCoreIdentityIdentityRoleMappingBase); + + var tableMappings11 = new List(); + identityRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings11); + var aspNetRolesTable = new Table("AspNetRoles", null, relationalModel); + var idColumn5 = new Column("Id", "TEXT", aspNetRolesTable); + aspNetRolesTable.Columns.Add("Id", idColumn5); + var concurrencyStampColumn0 = new Column("ConcurrencyStamp", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("ConcurrencyStamp", concurrencyStampColumn0); + var nameColumn2 = new Column("Name", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("Name", nameColumn2); + var normalizedNameColumn = new Column("NormalizedName", "TEXT", aspNetRolesTable) + { + IsNullable = true + }; + aspNetRolesTable.Columns.Add("NormalizedName", normalizedNameColumn); + var pK_AspNetRoles = new UniqueConstraint("PK_AspNetRoles", aspNetRolesTable, new[] { idColumn5 }); + aspNetRolesTable.PrimaryKey = pK_AspNetRoles; + var pK_AspNetRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + pK_AspNetRoles.MappedKeys.Add(pK_AspNetRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRolesUc).Add(pK_AspNetRoles); + aspNetRolesTable.UniqueConstraints.Add("PK_AspNetRoles", pK_AspNetRoles); + var roleNameIndex = new TableIndex( + "RoleNameIndex", aspNetRolesTable, new[] { normalizedNameColumn }, true); + var roleNameIndexIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "NormalizedName" }); + roleNameIndex.MappedIndexes.Add(roleNameIndexIx); + RelationalModel.GetOrCreateTableIndexes(roleNameIndexIx).Add(roleNameIndex); + aspNetRolesTable.Indexes.Add("RoleNameIndex", roleNameIndex); + relationalModel.Tables.Add(("AspNetRoles", null), aspNetRolesTable); + var aspNetRolesTableMapping = new TableMapping(identityRole, aspNetRolesTable, true); + aspNetRolesTable.AddTypeMapping(aspNetRolesTableMapping, false); + tableMappings11.Add(aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(idColumn5, identityRole.FindProperty("Id")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(concurrencyStampColumn0, identityRole.FindProperty("ConcurrencyStamp")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(nameColumn2, identityRole.FindProperty("Name")!, aspNetRolesTableMapping); + RelationalModel.CreateColumnMapping(normalizedNameColumn, identityRole.FindProperty("NormalizedName")!, aspNetRolesTableMapping); + + var identityRoleClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityRoleClaim")!; + + var defaultTableMappings12 = new List>(); + identityRoleClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings12); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityRoleClaim", null, relationalModel); + var claimTypeColumnBase = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase); + var claimValueColumnBase = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase); + var idColumnBase6 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("Id", idColumnBase6); + var roleIdColumnBase = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.Columns.Add("RoleId", roleIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityRoleClaim", microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase = new TableMappingBase(identityRoleClaim, microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityRoleClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase, false); + defaultTableMappings12.Add(microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase6, identityRoleClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase, identityRoleClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase, identityRoleClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase, identityRoleClaim.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityRoleClaimstringMappingBase); + + var tableMappings12 = new List(); + identityRoleClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings12); + var aspNetRoleClaimsTable = new Table("AspNetRoleClaims", null, relationalModel); + var idColumn6 = new Column("Id", "INTEGER", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("Id", idColumn6); + var claimTypeColumn = new Column("ClaimType", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimType", claimTypeColumn); + var claimValueColumn = new Column("ClaimValue", "TEXT", aspNetRoleClaimsTable) + { + IsNullable = true + }; + aspNetRoleClaimsTable.Columns.Add("ClaimValue", claimValueColumn); + var roleIdColumn = new Column("RoleId", "TEXT", aspNetRoleClaimsTable); + aspNetRoleClaimsTable.Columns.Add("RoleId", roleIdColumn); + var pK_AspNetRoleClaims = new UniqueConstraint("PK_AspNetRoleClaims", aspNetRoleClaimsTable, new[] { idColumn6 }); + aspNetRoleClaimsTable.PrimaryKey = pK_AspNetRoleClaims; + var pK_AspNetRoleClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "Id" }); + pK_AspNetRoleClaims.MappedKeys.Add(pK_AspNetRoleClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetRoleClaimsUc).Add(pK_AspNetRoleClaims); + aspNetRoleClaimsTable.UniqueConstraints.Add("PK_AspNetRoleClaims", pK_AspNetRoleClaims); + var iX_AspNetRoleClaims_RoleId = new TableIndex( + "IX_AspNetRoleClaims_RoleId", aspNetRoleClaimsTable, new[] { roleIdColumn }, false); + var iX_AspNetRoleClaims_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }); + iX_AspNetRoleClaims_RoleId.MappedIndexes.Add(iX_AspNetRoleClaims_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetRoleClaims_RoleIdIx).Add(iX_AspNetRoleClaims_RoleId); + aspNetRoleClaimsTable.Indexes.Add("IX_AspNetRoleClaims_RoleId", iX_AspNetRoleClaims_RoleId); + relationalModel.Tables.Add(("AspNetRoleClaims", null), aspNetRoleClaimsTable); + var aspNetRoleClaimsTableMapping = new TableMapping(identityRoleClaim, aspNetRoleClaimsTable, true); + aspNetRoleClaimsTable.AddTypeMapping(aspNetRoleClaimsTableMapping, false); + tableMappings12.Add(aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn6, identityRoleClaim.FindProperty("Id")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn, identityRoleClaim.FindProperty("ClaimType")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn, identityRoleClaim.FindProperty("ClaimValue")!, aspNetRoleClaimsTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn, identityRoleClaim.FindProperty("RoleId")!, aspNetRoleClaimsTableMapping); + + var identityUserClaim = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserClaim")!; + + var defaultTableMappings13 = new List>(); + identityUserClaim.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings13); + var microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserClaim", null, relationalModel); + var claimTypeColumnBase0 = new ColumnBase("ClaimType", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimType", claimTypeColumnBase0); + var claimValueColumnBase0 = new ColumnBase("ClaimValue", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("ClaimValue", claimValueColumnBase0); + var idColumnBase7 = new ColumnBase("Id", "INTEGER", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("Id", idColumnBase7); + var userIdColumnBase1 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.Columns.Add("UserId", userIdColumnBase1); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserClaim", microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase = new TableMappingBase(identityUserClaim, microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserClaimstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase, false); + defaultTableMappings13.Add(microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase7, identityUserClaim.FindProperty("Id")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimTypeColumnBase0, identityUserClaim.FindProperty("ClaimType")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)claimValueColumnBase0, identityUserClaim.FindProperty("ClaimValue")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase1, identityUserClaim.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserClaimstringMappingBase); + + var tableMappings13 = new List(); + identityUserClaim.SetRuntimeAnnotation("Relational:TableMappings", tableMappings13); + var aspNetUserClaimsTable = new Table("AspNetUserClaims", null, relationalModel); + var idColumn7 = new Column("Id", "INTEGER", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("Id", idColumn7); + var claimTypeColumn0 = new Column("ClaimType", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimType", claimTypeColumn0); + var claimValueColumn0 = new Column("ClaimValue", "TEXT", aspNetUserClaimsTable) + { + IsNullable = true + }; + aspNetUserClaimsTable.Columns.Add("ClaimValue", claimValueColumn0); + var userIdColumn1 = new Column("UserId", "TEXT", aspNetUserClaimsTable); + aspNetUserClaimsTable.Columns.Add("UserId", userIdColumn1); + var pK_AspNetUserClaims = new UniqueConstraint("PK_AspNetUserClaims", aspNetUserClaimsTable, new[] { idColumn7 }); + aspNetUserClaimsTable.PrimaryKey = pK_AspNetUserClaims; + var pK_AspNetUserClaimsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "Id" }); + pK_AspNetUserClaims.MappedKeys.Add(pK_AspNetUserClaimsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserClaimsUc).Add(pK_AspNetUserClaims); + aspNetUserClaimsTable.UniqueConstraints.Add("PK_AspNetUserClaims", pK_AspNetUserClaims); + var iX_AspNetUserClaims_UserId = new TableIndex( + "IX_AspNetUserClaims_UserId", aspNetUserClaimsTable, new[] { userIdColumn1 }, false); + var iX_AspNetUserClaims_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }); + iX_AspNetUserClaims_UserId.MappedIndexes.Add(iX_AspNetUserClaims_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserClaims_UserIdIx).Add(iX_AspNetUserClaims_UserId); + aspNetUserClaimsTable.Indexes.Add("IX_AspNetUserClaims_UserId", iX_AspNetUserClaims_UserId); + relationalModel.Tables.Add(("AspNetUserClaims", null), aspNetUserClaimsTable); + var aspNetUserClaimsTableMapping = new TableMapping(identityUserClaim, aspNetUserClaimsTable, true); + aspNetUserClaimsTable.AddTypeMapping(aspNetUserClaimsTableMapping, false); + tableMappings13.Add(aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(idColumn7, identityUserClaim.FindProperty("Id")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimTypeColumn0, identityUserClaim.FindProperty("ClaimType")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(claimValueColumn0, identityUserClaim.FindProperty("ClaimValue")!, aspNetUserClaimsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn1, identityUserClaim.FindProperty("UserId")!, aspNetUserClaimsTableMapping); + + var identityUserLogin = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserLogin")!; + + var defaultTableMappings14 = new List>(); + identityUserLogin.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings14); + var microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserLogin", null, relationalModel); + var loginProviderColumnBase = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase); + var providerDisplayNameColumnBase = new ColumnBase("ProviderDisplayName", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderDisplayName", providerDisplayNameColumnBase); + var providerKeyColumnBase = new ColumnBase("ProviderKey", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("ProviderKey", providerKeyColumnBase); + var userIdColumnBase2 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.Columns.Add("UserId", userIdColumnBase2); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserLogin", microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase = new TableMappingBase(identityUserLogin, microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserLoginstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase, false); + defaultTableMappings14.Add(microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase, identityUserLogin.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerKeyColumnBase, identityUserLogin.FindProperty("ProviderKey")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)providerDisplayNameColumnBase, identityUserLogin.FindProperty("ProviderDisplayName")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase2, identityUserLogin.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserLoginstringMappingBase); + + var tableMappings14 = new List(); + identityUserLogin.SetRuntimeAnnotation("Relational:TableMappings", tableMappings14); + var aspNetUserLoginsTable = new Table("AspNetUserLogins", null, relationalModel); + var loginProviderColumn = new Column("LoginProvider", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("LoginProvider", loginProviderColumn); + var providerKeyColumn = new Column("ProviderKey", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("ProviderKey", providerKeyColumn); + var providerDisplayNameColumn = new Column("ProviderDisplayName", "TEXT", aspNetUserLoginsTable) + { + IsNullable = true + }; + aspNetUserLoginsTable.Columns.Add("ProviderDisplayName", providerDisplayNameColumn); + var userIdColumn2 = new Column("UserId", "TEXT", aspNetUserLoginsTable); + aspNetUserLoginsTable.Columns.Add("UserId", userIdColumn2); + var pK_AspNetUserLogins = new UniqueConstraint("PK_AspNetUserLogins", aspNetUserLoginsTable, new[] { loginProviderColumn, providerKeyColumn }); + aspNetUserLoginsTable.PrimaryKey = pK_AspNetUserLogins; + var pK_AspNetUserLoginsUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "LoginProvider", "ProviderKey" }); + pK_AspNetUserLogins.MappedKeys.Add(pK_AspNetUserLoginsUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserLoginsUc).Add(pK_AspNetUserLogins); + aspNetUserLoginsTable.UniqueConstraints.Add("PK_AspNetUserLogins", pK_AspNetUserLogins); + var iX_AspNetUserLogins_UserId = new TableIndex( + "IX_AspNetUserLogins_UserId", aspNetUserLoginsTable, new[] { userIdColumn2 }, false); + var iX_AspNetUserLogins_UserIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }); + iX_AspNetUserLogins_UserId.MappedIndexes.Add(iX_AspNetUserLogins_UserIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserLogins_UserIdIx).Add(iX_AspNetUserLogins_UserId); + aspNetUserLoginsTable.Indexes.Add("IX_AspNetUserLogins_UserId", iX_AspNetUserLogins_UserId); + relationalModel.Tables.Add(("AspNetUserLogins", null), aspNetUserLoginsTable); + var aspNetUserLoginsTableMapping = new TableMapping(identityUserLogin, aspNetUserLoginsTable, true); + aspNetUserLoginsTable.AddTypeMapping(aspNetUserLoginsTableMapping, false); + tableMappings14.Add(aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn, identityUserLogin.FindProperty("LoginProvider")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerKeyColumn, identityUserLogin.FindProperty("ProviderKey")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(providerDisplayNameColumn, identityUserLogin.FindProperty("ProviderDisplayName")!, aspNetUserLoginsTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn2, identityUserLogin.FindProperty("UserId")!, aspNetUserLoginsTableMapping); + + var identityUserRole = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserRole")!; + + var defaultTableMappings15 = new List>(); + identityUserRole.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings15); + var microsoftAspNetCoreIdentityIdentityUserRolestringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserRole", null, relationalModel); + var roleIdColumnBase0 = new ColumnBase("RoleId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("RoleId", roleIdColumnBase0); + var userIdColumnBase3 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.Columns.Add("UserId", userIdColumnBase3); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserRole", microsoftAspNetCoreIdentityIdentityUserRolestringTableBase); + var microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase = new TableMappingBase(identityUserRole, microsoftAspNetCoreIdentityIdentityUserRolestringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserRolestringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase, false); + defaultTableMappings15.Add(microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)roleIdColumnBase0, identityUserRole.FindProperty("RoleId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase3, identityUserRole.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserRolestringMappingBase); + + var tableMappings15 = new List(); + identityUserRole.SetRuntimeAnnotation("Relational:TableMappings", tableMappings15); + var aspNetUserRolesTable = new Table("AspNetUserRoles", null, relationalModel); + var userIdColumn3 = new Column("UserId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("UserId", userIdColumn3); + var roleIdColumn0 = new Column("RoleId", "TEXT", aspNetUserRolesTable); + aspNetUserRolesTable.Columns.Add("RoleId", roleIdColumn0); + var pK_AspNetUserRoles = new UniqueConstraint("PK_AspNetUserRoles", aspNetUserRolesTable, new[] { userIdColumn3, roleIdColumn0 }); + aspNetUserRolesTable.PrimaryKey = pK_AspNetUserRoles; + var pK_AspNetUserRolesUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId", "RoleId" }); + pK_AspNetUserRoles.MappedKeys.Add(pK_AspNetUserRolesUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserRolesUc).Add(pK_AspNetUserRoles); + aspNetUserRolesTable.UniqueConstraints.Add("PK_AspNetUserRoles", pK_AspNetUserRoles); + var iX_AspNetUserRoles_RoleId = new TableIndex( + "IX_AspNetUserRoles_RoleId", aspNetUserRolesTable, new[] { roleIdColumn0 }, false); + var iX_AspNetUserRoles_RoleIdIx = RelationalModel.GetIndex(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }); + iX_AspNetUserRoles_RoleId.MappedIndexes.Add(iX_AspNetUserRoles_RoleIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_AspNetUserRoles_RoleIdIx).Add(iX_AspNetUserRoles_RoleId); + aspNetUserRolesTable.Indexes.Add("IX_AspNetUserRoles_RoleId", iX_AspNetUserRoles_RoleId); + relationalModel.Tables.Add(("AspNetUserRoles", null), aspNetUserRolesTable); + var aspNetUserRolesTableMapping = new TableMapping(identityUserRole, aspNetUserRolesTable, true); + aspNetUserRolesTable.AddTypeMapping(aspNetUserRolesTableMapping, false); + tableMappings15.Add(aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(roleIdColumn0, identityUserRole.FindProperty("RoleId")!, aspNetUserRolesTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn3, identityUserRole.FindProperty("UserId")!, aspNetUserRolesTableMapping); + + var identityUserToken = FindEntityType("Microsoft.AspNetCore.Identity.IdentityUserToken")!; + + var defaultTableMappings16 = new List>(); + identityUserToken.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings16); + var microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase = new TableBase("Microsoft.AspNetCore.Identity.IdentityUserToken", null, relationalModel); + var loginProviderColumnBase0 = new ColumnBase("LoginProvider", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("LoginProvider", loginProviderColumnBase0); + var nameColumnBase3 = new ColumnBase("Name", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Name", nameColumnBase3); + var userIdColumnBase4 = new ColumnBase("UserId", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("UserId", userIdColumnBase4); + var valueColumnBase = new ColumnBase("Value", "TEXT", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase) + { + IsNullable = true + }; + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.Columns.Add("Value", valueColumnBase); + relationalModel.DefaultTables.Add("Microsoft.AspNetCore.Identity.IdentityUserToken", microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase); + var microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase = new TableMappingBase(identityUserToken, microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase, true); + microsoftAspNetCoreIdentityIdentityUserTokenstringTableBase.AddTypeMapping(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase, false); + defaultTableMappings16.Add(microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)loginProviderColumnBase0, identityUserToken.FindProperty("LoginProvider")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)nameColumnBase3, identityUserToken.FindProperty("Name")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)userIdColumnBase4, identityUserToken.FindProperty("UserId")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueColumnBase, identityUserToken.FindProperty("Value")!, microsoftAspNetCoreIdentityIdentityUserTokenstringMappingBase); + + var tableMappings16 = new List(); + identityUserToken.SetRuntimeAnnotation("Relational:TableMappings", tableMappings16); + var aspNetUserTokensTable = new Table("AspNetUserTokens", null, relationalModel); + var userIdColumn4 = new Column("UserId", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("UserId", userIdColumn4); + var loginProviderColumn0 = new Column("LoginProvider", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("LoginProvider", loginProviderColumn0); + var nameColumn3 = new Column("Name", "TEXT", aspNetUserTokensTable); + aspNetUserTokensTable.Columns.Add("Name", nameColumn3); + var valueColumn = new Column("Value", "TEXT", aspNetUserTokensTable) + { + IsNullable = true + }; + aspNetUserTokensTable.Columns.Add("Value", valueColumn); + var pK_AspNetUserTokens = new UniqueConstraint("PK_AspNetUserTokens", aspNetUserTokensTable, new[] { userIdColumn4, loginProviderColumn0, nameColumn3 }); + aspNetUserTokensTable.PrimaryKey = pK_AspNetUserTokens; + var pK_AspNetUserTokensUc = RelationalModel.GetKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId", "LoginProvider", "Name" }); + pK_AspNetUserTokens.MappedKeys.Add(pK_AspNetUserTokensUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_AspNetUserTokensUc).Add(pK_AspNetUserTokens); + aspNetUserTokensTable.UniqueConstraints.Add("PK_AspNetUserTokens", pK_AspNetUserTokens); + relationalModel.Tables.Add(("AspNetUserTokens", null), aspNetUserTokensTable); + var aspNetUserTokensTableMapping = new TableMapping(identityUserToken, aspNetUserTokensTable, true); + aspNetUserTokensTable.AddTypeMapping(aspNetUserTokensTableMapping, false); + tableMappings16.Add(aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(loginProviderColumn0, identityUserToken.FindProperty("LoginProvider")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(nameColumn3, identityUserToken.FindProperty("Name")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(userIdColumn4, identityUserToken.FindProperty("UserId")!, aspNetUserTokensTableMapping); + RelationalModel.CreateColumnMapping(valueColumn, identityUserToken.FindProperty("Value")!, aspNetUserTokensTableMapping); + var fK_AspNetRoleClaims_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetRoleClaims_AspNetRoles_RoleId", aspNetRoleClaimsTable, aspNetRolesTable, + new[] { roleIdColumn }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetRoleClaims_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityRoleClaim", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetRoleClaims_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetRoleClaims_AspNetRoles_RoleIdFk).Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRoleClaimsTable.ForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetRoleClaims_AspNetRoles_RoleId); + var fK_AspNetUserClaims_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserClaims_AspNetUsers_UserId", aspNetUserClaimsTable, aspNetUsersTable, + new[] { userIdColumn1 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserClaims_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserClaim", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserClaims_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserClaims_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserClaims_AspNetUsers_UserIdFk).Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUserClaimsTable.ForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserClaims_AspNetUsers_UserId); + var fK_AspNetUserLogins_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserLogins_AspNetUsers_UserId", aspNetUserLoginsTable, aspNetUsersTable, + new[] { userIdColumn2 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserLogins_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserLogin", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserLogins_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserLogins_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserLogins_AspNetUsers_UserIdFk).Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUserLoginsTable.ForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserLogins_AspNetUsers_UserId); + var fK_AspNetUserRoles_AspNetRoles_RoleId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetRoles_RoleId", aspNetUserRolesTable, aspNetRolesTable, + new[] { roleIdColumn0 }, + aspNetRolesTable.FindUniqueConstraint("PK_AspNetRoles")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetRoles_RoleIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "RoleId" }, + "Microsoft.AspNetCore.Identity.IdentityRole", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetRoles_RoleId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetRoles_RoleIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetRoles_RoleIdFk).Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + aspNetRolesTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetRoles_RoleId); + var fK_AspNetUserRoles_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserRoles_AspNetUsers_UserId", aspNetUserRolesTable, aspNetUsersTable, + new[] { userIdColumn3 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserRoles_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserRole", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserRoles_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserRoles_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserRoles_AspNetUsers_UserIdFk).Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUserRolesTable.ForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserRoles_AspNetUsers_UserId); + var fK_AspNetUserTokens_AspNetUsers_UserId = new ForeignKeyConstraint( + "FK_AspNetUserTokens_AspNetUsers_UserId", aspNetUserTokensTable, aspNetUsersTable, + new[] { userIdColumn4 }, + aspNetUsersTable.FindUniqueConstraint("PK_AspNetUsers")!, ReferentialAction.Cascade); + var fK_AspNetUserTokens_AspNetUsers_UserIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.AspNetCore.Identity.IdentityUserToken", + new[] { "UserId" }, + "BlazingPizza.Server.PizzaStoreUser", + new[] { "Id" }); + fK_AspNetUserTokens_AspNetUsers_UserId.MappedForeignKeys.Add(fK_AspNetUserTokens_AspNetUsers_UserIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_AspNetUserTokens_AspNetUsers_UserIdFk).Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUserTokensTable.ForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + aspNetUsersTable.ReferencingForeignKeyConstraints.Add(fK_AspNetUserTokens_AspNetUsers_UserId); + var fK_Orders_Address_DeliveryAddressId = new ForeignKeyConstraint( + "FK_Orders_Address_DeliveryAddressId", ordersTable, addressTable, + new[] { deliveryAddressIdColumn }, + addressTable.FindUniqueConstraint("PK_Address")!, ReferentialAction.Cascade); + var fK_Orders_Address_DeliveryAddressIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Order", + new[] { "DeliveryAddressId" }, + "BlazingPizza.Address", + new[] { "Id" }); + fK_Orders_Address_DeliveryAddressId.MappedForeignKeys.Add(fK_Orders_Address_DeliveryAddressIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Orders_Address_DeliveryAddressIdFk).Add(fK_Orders_Address_DeliveryAddressId); + ordersTable.ForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + addressTable.ReferencingForeignKeyConstraints.Add(fK_Orders_Address_DeliveryAddressId); + var fK_Pizzas_Orders_OrderId = new ForeignKeyConstraint( + "FK_Pizzas_Orders_OrderId", pizzasTable, ordersTable, + new[] { orderIdColumn0 }, + ordersTable.FindUniqueConstraint("PK_Orders")!, ReferentialAction.Cascade); + var fK_Pizzas_Orders_OrderIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "OrderId" }, + "BlazingPizza.Order", + new[] { "OrderId" }); + fK_Pizzas_Orders_OrderId.MappedForeignKeys.Add(fK_Pizzas_Orders_OrderIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Orders_OrderIdFk).Add(fK_Pizzas_Orders_OrderId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + ordersTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Orders_OrderId); + var fK_Pizzas_Specials_SpecialId = new ForeignKeyConstraint( + "FK_Pizzas_Specials_SpecialId", pizzasTable, specialsTable, + new[] { specialIdColumn }, + specialsTable.FindUniqueConstraint("PK_Specials")!, ReferentialAction.Cascade); + var fK_Pizzas_Specials_SpecialIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.Pizza", + new[] { "SpecialId" }, + "BlazingPizza.PizzaSpecial", + new[] { "Id" }); + fK_Pizzas_Specials_SpecialId.MappedForeignKeys.Add(fK_Pizzas_Specials_SpecialIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_Pizzas_Specials_SpecialIdFk).Add(fK_Pizzas_Specials_SpecialId); + pizzasTable.ForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + specialsTable.ReferencingForeignKeyConstraints.Add(fK_Pizzas_Specials_SpecialId); + var fK_PizzaTopping_Pizzas_PizzaId = new ForeignKeyConstraint( + "FK_PizzaTopping_Pizzas_PizzaId", pizzaToppingTable, pizzasTable, + new[] { pizzaIdColumn }, + pizzasTable.FindUniqueConstraint("PK_Pizzas")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Pizzas_PizzaIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "PizzaId" }, + "BlazingPizza.Pizza", + new[] { "Id" }); + fK_PizzaTopping_Pizzas_PizzaId.MappedForeignKeys.Add(fK_PizzaTopping_Pizzas_PizzaIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Pizzas_PizzaIdFk).Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + pizzasTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Pizzas_PizzaId); + var fK_PizzaTopping_Toppings_ToppingId = new ForeignKeyConstraint( + "FK_PizzaTopping_Toppings_ToppingId", pizzaToppingTable, toppingsTable, + new[] { toppingIdColumn }, + toppingsTable.FindUniqueConstraint("PK_Toppings")!, ReferentialAction.Cascade); + var fK_PizzaTopping_Toppings_ToppingIdFk = RelationalModel.GetForeignKey(this, + "BlazingPizza.PizzaTopping", + new[] { "ToppingId" }, + "BlazingPizza.Topping", + new[] { "Id" }); + fK_PizzaTopping_Toppings_ToppingId.MappedForeignKeys.Add(fK_PizzaTopping_Toppings_ToppingIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PizzaTopping_Toppings_ToppingIdFk).Add(fK_PizzaTopping_Toppings_ToppingId); + pizzaToppingTable.ForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + toppingsTable.ReferencingForeignKeyConstraints.Add(fK_PizzaTopping_Toppings_ToppingId); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs b/src/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs new file mode 100644 index 00000000..7295425c --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/PizzaStoreUserEntityType.cs @@ -0,0 +1,249 @@ +// +using System; +using System.Reflection; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaStoreUserEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Server.PizzaStoreUser", + typeof(PizzaStoreUser), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.TypeMapping = SqliteStringTypeMapping.Default; + + var accessFailedCount = runtimeEntityType.AddProperty( + "AccessFailedCount", + typeof(int), + propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + accessFailedCount.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var concurrencyStamp = runtimeEntityType.AddProperty( + "ConcurrencyStamp", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + concurrencyToken: true); + concurrencyStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var email = runtimeEntityType.AddProperty( + "Email", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + email.TypeMapping = SqliteStringTypeMapping.Default; + + var emailConfirmed = runtimeEntityType.AddProperty( + "EmailConfirmed", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + emailConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var lockoutEnabled = runtimeEntityType.AddProperty( + "LockoutEnabled", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + lockoutEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var lockoutEnd = runtimeEntityType.AddProperty( + "LockoutEnd", + typeof(DateTimeOffset?), + propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + lockoutEnd.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default; + + var normalizedEmail = runtimeEntityType.AddProperty( + "NormalizedEmail", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedEmail.TypeMapping = SqliteStringTypeMapping.Default; + + var normalizedUserName = runtimeEntityType.AddProperty( + "NormalizedUserName", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + normalizedUserName.TypeMapping = SqliteStringTypeMapping.Default; + + var passwordHash = runtimeEntityType.AddProperty( + "PasswordHash", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + passwordHash.TypeMapping = SqliteStringTypeMapping.Default; + + var phoneNumber = runtimeEntityType.AddProperty( + "PhoneNumber", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + phoneNumber.TypeMapping = SqliteStringTypeMapping.Default; + + var phoneNumberConfirmed = runtimeEntityType.AddProperty( + "PhoneNumberConfirmed", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + phoneNumberConfirmed.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var securityStamp = runtimeEntityType.AddProperty( + "SecurityStamp", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + securityStamp.TypeMapping = SqliteStringTypeMapping.Default; + + var twoFactorEnabled = runtimeEntityType.AddProperty( + "TwoFactorEnabled", + typeof(bool), + propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + twoFactorEnabled.TypeMapping = BoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + keyComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + providerValueComparer: new ValueComparer( + (bool v1, bool v2) => v1 == v2, + (bool v) => v.GetHashCode(), + (bool v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var userName = runtimeEntityType.AddProperty( + "UserName", + typeof(string), + propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + userName.TypeMapping = SqliteStringTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { normalizedEmail }); + index.AddAnnotation("Relational:Name", "EmailIndex"); + + var index0 = runtimeEntityType.AddIndex( + new[] { normalizedUserName }, + unique: true); + index0.AddAnnotation("Relational:Name", "UserNameIndex"); + + return runtimeEntityType; + } + + 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", "AspNetUsers"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs b/src/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs new file mode 100644 index 00000000..803ab153 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/PizzaToppingEntityType.cs @@ -0,0 +1,130 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class PizzaToppingEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.PizzaTopping", + typeof(PizzaTopping), + baseEntityType); + + var pizzaId = runtimeEntityType.AddProperty( + "PizzaId", + typeof(int), + propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + pizzaId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var toppingId = runtimeEntityType.AddProperty( + "ToppingId", + typeof(int), + propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + toppingId.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var key = runtimeEntityType.AddKey( + new[] { pizzaId, toppingId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { toppingId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PizzaId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var toppings = principalEntityType.AddNavigation("Toppings", + runtimeForeignKey, + onDependent: false, + typeof(List), + propertyInfo: typeof(Pizza).GetProperty("Toppings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ToppingId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var topping = declaringEntityType.AddNavigation("Topping", + runtimeForeignKey, + onDependent: true, + typeof(Topping), + propertyInfo: typeof(PizzaTopping).GetProperty("Topping", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PizzaTopping).GetField("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", "PizzaTopping"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs b/src/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs new file mode 100644 index 00000000..d3a19507 --- /dev/null +++ b/src/BlazingPizza.Server/CompiledModels/ToppingEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace BlazingPizza.Server.CompiledModels +{ + internal partial class ToppingEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "BlazingPizza.Topping", + typeof(Topping), + baseEntityType); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.TypeMapping = IntTypeMapping.Default.Clone( + comparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + keyComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + providerValueComparer: new ValueComparer( + (int v1, int v2) => v1 == v2, + (int v) => v, + (int v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "INTEGER")); + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + name.TypeMapping = SqliteStringTypeMapping.Default; + + var price = runtimeEntityType.AddProperty( + "Price", + typeof(decimal), + propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + price.TypeMapping = SqliteDecimalTypeMapping.Default; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + 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", "Toppings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/BlazingPizza.Server/Models/AddressEntityType.cs b/src/BlazingPizza.Server/Models/AddressEntityType.cs deleted file mode 100644 index 82db81b6..00000000 --- a/src/BlazingPizza.Server/Models/AddressEntityType.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class AddressEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Address", - typeof(Address), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Address).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var city = runtimeEntityType.AddProperty( - "City", - typeof(string), - propertyInfo: typeof(Address).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50); - - var line1 = runtimeEntityType.AddProperty( - "Line1", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Line1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var line2 = runtimeEntityType.AddProperty( - "Line2", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Line2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var postalCode = runtimeEntityType.AddProperty( - "PostalCode", - typeof(string), - propertyInfo: typeof(Address).GetProperty("PostalCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 20); - - var region = runtimeEntityType.AddProperty( - "Region", - typeof(string), - propertyInfo: typeof(Address).GetProperty("Region", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Address).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 20); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Address"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs b/src/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs deleted file mode 100644 index 1dd4563b..00000000 --- a/src/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class DeviceFlowCodesEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", - typeof(DeviceFlowCodes), - baseEntityType); - - var userCode = runtimeEntityType.AddProperty( - "UserCode", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("UserCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 200); - - var clientId = runtimeEntityType.AddProperty( - "ClientId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var creationTime = runtimeEntityType.AddProperty( - "CreationTime", - typeof(DateTime), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50000); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var deviceCode = runtimeEntityType.AddProperty( - "DeviceCode", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("DeviceCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var expiration = runtimeEntityType.AddProperty( - "Expiration", - typeof(DateTime?), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var sessionId = runtimeEntityType.AddProperty( - "SessionId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var subjectId = runtimeEntityType.AddProperty( - "SubjectId", - typeof(string), - propertyInfo: typeof(DeviceFlowCodes).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(DeviceFlowCodes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var key = runtimeEntityType.AddKey( - new[] { userCode }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { deviceCode }, - unique: true); - - var index0 = runtimeEntityType.AddIndex( - new[] { expiration }); - - return runtimeEntityType; - } - - 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", "DeviceCodes"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs deleted file mode 100644 index 8946b261..00000000 --- a/src/BlazingPizza.Server/Models/IdentityRoleClaimstringEntityType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityRoleClaimstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityRoleClaim", - typeof(IdentityRoleClaim), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var claimType = runtimeEntityType.AddProperty( - "ClaimType", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var claimValue = runtimeEntityType.AddProperty( - "ClaimValue", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var roleId = runtimeEntityType.AddProperty( - "RoleId", - typeof(string), - propertyInfo: typeof(IdentityRoleClaim).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRoleClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { roleId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetRoleClaims"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/IdentityRoleEntityType.cs b/src/BlazingPizza.Server/Models/IdentityRoleEntityType.cs deleted file mode 100644 index 2f1fec2b..00000000 --- a/src/BlazingPizza.Server/Models/IdentityRoleEntityType.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityRoleEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityRole", - typeof(IdentityRole), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var concurrencyStamp = runtimeEntityType.AddProperty( - "ConcurrencyStamp", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - concurrencyToken: true); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var normalizedName = runtimeEntityType.AddProperty( - "NormalizedName", - typeof(string), - propertyInfo: typeof(IdentityRole).GetProperty("NormalizedName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { normalizedName }, - unique: true); - index.AddAnnotation("Relational:Name", "RoleNameIndex"); - - return runtimeEntityType; - } - - 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", "AspNetRoles"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs deleted file mode 100644 index 55418a1e..00000000 --- a/src/BlazingPizza.Server/Models/IdentityUserClaimstringEntityType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserClaimstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserClaim", - typeof(IdentityUserClaim), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(IdentityUserClaim).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var claimType = runtimeEntityType.AddProperty( - "ClaimType", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var claimValue = runtimeEntityType.AddProperty( - "ClaimValue", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("ClaimValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserClaim).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserClaim).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { userId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserClaims"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs deleted file mode 100644 index 3ca029bd..00000000 --- a/src/BlazingPizza.Server/Models/IdentityUserLoginstringEntityType.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserLoginstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserLogin", - typeof(IdentityUserLogin), - baseEntityType); - - var loginProvider = runtimeEntityType.AddProperty( - "LoginProvider", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var providerKey = runtimeEntityType.AddProperty( - "ProviderKey", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderKey", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var providerDisplayName = runtimeEntityType.AddProperty( - "ProviderDisplayName", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("ProviderDisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserLogin).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserLogin).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { loginProvider, providerKey }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { userId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserLogins"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs deleted file mode 100644 index 70078d7a..00000000 --- a/src/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs +++ /dev/null @@ -1,82 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserRolestringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserRole", - typeof(IdentityUserRole), - baseEntityType); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserRole).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var roleId = runtimeEntityType.AddProperty( - "RoleId", - typeof(string), - propertyInfo: typeof(IdentityUserRole).GetProperty("RoleId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserRole).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var key = runtimeEntityType.AddKey( - new[] { userId, roleId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { roleId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RoleId") }, - 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("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserRoles"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs b/src/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs deleted file mode 100644 index 93ba6d31..00000000 --- a/src/BlazingPizza.Server/Models/IdentityUserTokenstringEntityType.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class IdentityUserTokenstringEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Microsoft.AspNetCore.Identity.IdentityUserToken", - typeof(IdentityUserToken), - baseEntityType); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var loginProvider = runtimeEntityType.AddProperty( - "LoginProvider", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("LoginProvider", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 128); - - var value = runtimeEntityType.AddProperty( - "Value", - typeof(string), - propertyInfo: typeof(IdentityUserToken).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUserToken).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { userId, loginProvider, name }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("UserId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - 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", "AspNetUserTokens"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/KeyEntityType.cs b/src/BlazingPizza.Server/Models/KeyEntityType.cs deleted file mode 100644 index f6c6b4c7..00000000 --- a/src/BlazingPizza.Server/Models/KeyEntityType.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class KeyEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.Key", - typeof(Key), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var algorithm = runtimeEntityType.AddProperty( - "Algorithm", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Algorithm", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 100); - - var created = runtimeEntityType.AddProperty( - "Created", - typeof(DateTime), - propertyInfo: typeof(Key).GetProperty("Created", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var dataProtected = runtimeEntityType.AddProperty( - "DataProtected", - typeof(bool), - propertyInfo: typeof(Key).GetProperty("DataProtected", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var isX509Certificate = runtimeEntityType.AddProperty( - "IsX509Certificate", - typeof(bool), - propertyInfo: typeof(Key).GetProperty("IsX509Certificate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var use = runtimeEntityType.AddProperty( - "Use", - typeof(string), - propertyInfo: typeof(Key).GetProperty("Use", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var version = runtimeEntityType.AddProperty( - "Version", - typeof(int), - propertyInfo: typeof(Key).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Key).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { use }); - - return runtimeEntityType; - } - - 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", "Keys"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/LatLongEntityType.cs b/src/BlazingPizza.Server/Models/LatLongEntityType.cs deleted file mode 100644 index 3fd254bd..00000000 --- a/src/BlazingPizza.Server/Models/LatLongEntityType.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class LatLongEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.LatLong", - typeof(LatLong), - baseEntityType); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var latitude = runtimeEntityType.AddProperty( - "Latitude", - typeof(double), - propertyInfo: typeof(LatLong).GetProperty("Latitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var longitude = runtimeEntityType.AddProperty( - "Longitude", - typeof(double), - propertyInfo: typeof(LatLong).GetProperty("Longitude", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(LatLong).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { orderId }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - unique: true, - required: true, - ownership: true); - - var deliveryLocation = principalEntityType.AddNavigation("DeliveryLocation", - runtimeForeignKey, - onDependent: false, - typeof(LatLong), - propertyInfo: typeof(Order).GetProperty("DeliveryLocation", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - eagerLoaded: 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", "Orders"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs b/src/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs deleted file mode 100644 index db236e4c..00000000 --- a/src/BlazingPizza.Server/Models/NotificationSubscriptionEntityType.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class NotificationSubscriptionEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.NotificationSubscription", - typeof(NotificationSubscription), - baseEntityType); - - var notificationSubscriptionId = runtimeEntityType.AddProperty( - "NotificationSubscriptionId", - typeof(int), - propertyInfo: typeof(NotificationSubscription).GetProperty("NotificationSubscriptionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var auth = runtimeEntityType.AddProperty( - "Auth", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("Auth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var p256dh = runtimeEntityType.AddProperty( - "P256dh", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("P256dh", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var url = runtimeEntityType.AddProperty( - "Url", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("Url", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(NotificationSubscription).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(NotificationSubscription).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { notificationSubscriptionId }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "NotificationSubscriptions"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/OrderEntityType.cs b/src/BlazingPizza.Server/Models/OrderEntityType.cs deleted file mode 100644 index 9d9ec6fd..00000000 --- a/src/BlazingPizza.Server/Models/OrderEntityType.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class OrderEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Order", - typeof(Order), - baseEntityType); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - propertyInfo: typeof(Order).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var createdTime = runtimeEntityType.AddProperty( - "CreatedTime", - typeof(DateTime), - propertyInfo: typeof(Order).GetProperty("CreatedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var deliveryAddressId = runtimeEntityType.AddProperty( - "DeliveryAddressId", - typeof(int?), - nullable: true); - - var userId = runtimeEntityType.AddProperty( - "UserId", - typeof(string), - propertyInfo: typeof(Order).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { orderId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { deliveryAddressId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DeliveryAddressId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType); - - var deliveryAddress = declaringEntityType.AddNavigation("DeliveryAddress", - runtimeForeignKey, - onDependent: true, - typeof(Address), - propertyInfo: typeof(Order).GetProperty("DeliveryAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("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", "Orders"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/PersistedGrantEntityType.cs b/src/BlazingPizza.Server/Models/PersistedGrantEntityType.cs deleted file mode 100644 index 842d53a5..00000000 --- a/src/BlazingPizza.Server/Models/PersistedGrantEntityType.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -using System; -using System.Reflection; -using Duende.IdentityServer.EntityFramework.Entities; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PersistedGrantEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", - typeof(PersistedGrant), - baseEntityType); - - var key = runtimeEntityType.AddProperty( - "Key", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Key", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw, - maxLength: 200); - - var clientId = runtimeEntityType.AddProperty( - "ClientId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("ClientId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 200); - - var consumedTime = runtimeEntityType.AddProperty( - "ConsumedTime", - typeof(DateTime?), - propertyInfo: typeof(PersistedGrant).GetProperty("ConsumedTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var creationTime = runtimeEntityType.AddProperty( - "CreationTime", - typeof(DateTime), - propertyInfo: typeof(PersistedGrant).GetProperty("CreationTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var data = runtimeEntityType.AddProperty( - "Data", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Data", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50000); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var expiration = runtimeEntityType.AddProperty( - "Expiration", - typeof(DateTime?), - propertyInfo: typeof(PersistedGrant).GetProperty("Expiration", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var sessionId = runtimeEntityType.AddProperty( - "SessionId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("SessionId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 100); - - var subjectId = runtimeEntityType.AddProperty( - "SubjectId", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("SubjectId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 200); - - var type = runtimeEntityType.AddProperty( - "Type", - typeof(string), - propertyInfo: typeof(PersistedGrant).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PersistedGrant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - maxLength: 50); - - var key0 = runtimeEntityType.AddKey( - new[] { key }); - runtimeEntityType.SetPrimaryKey(key0); - - var index = runtimeEntityType.AddIndex( - new[] { consumedTime }); - - var index0 = runtimeEntityType.AddIndex( - new[] { expiration }); - - var index1 = runtimeEntityType.AddIndex( - new[] { subjectId, clientId, type }); - - var index2 = runtimeEntityType.AddIndex( - new[] { subjectId, sessionId, type }); - - return runtimeEntityType; - } - - 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", "PersistedGrants"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/PizzaEntityType.cs b/src/BlazingPizza.Server/Models/PizzaEntityType.cs deleted file mode 100644 index 3a124e63..00000000 --- a/src/BlazingPizza.Server/Models/PizzaEntityType.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Pizza", - typeof(Pizza), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var orderId = runtimeEntityType.AddProperty( - "OrderId", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("OrderId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var size = runtimeEntityType.AddProperty( - "Size", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("Size", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var specialId = runtimeEntityType.AddProperty( - "SpecialId", - typeof(int), - propertyInfo: typeof(Pizza).GetProperty("SpecialId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { orderId }); - - var index0 = runtimeEntityType.AddIndex( - new[] { specialId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrderId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("OrderId") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var pizzas = principalEntityType.AddNavigation("Pizzas", - runtimeForeignKey, - onDependent: false, - typeof(List), - propertyInfo: typeof(Order).GetProperty("Pizzas", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Order).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SpecialId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var special = declaringEntityType.AddNavigation("Special", - runtimeForeignKey, - onDependent: true, - typeof(PizzaSpecial), - propertyInfo: typeof(Pizza).GetProperty("Special", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("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", "Pizzas"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs b/src/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs deleted file mode 100644 index e86b0f50..00000000 --- a/src/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaSpecialEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.PizzaSpecial", - typeof(PizzaSpecial), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(PizzaSpecial).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var basePrice = runtimeEntityType.AddProperty( - "BasePrice", - typeof(decimal), - propertyInfo: typeof(PizzaSpecial).GetProperty("BasePrice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var description = runtimeEntityType.AddProperty( - "Description", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var imageUrl = runtimeEntityType.AddProperty( - "ImageUrl", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("ImageUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(PizzaSpecial).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaSpecial).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Specials"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/PizzaStoreContextModel.cs b/src/BlazingPizza.Server/Models/PizzaStoreContextModel.cs deleted file mode 100644 index 8b516a68..00000000 --- a/src/BlazingPizza.Server/Models/PizzaStoreContextModel.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - [DbContext(typeof(PizzaStoreContext))] - public partial class PizzaStoreContextModel : RuntimeModel - { - static PizzaStoreContextModel() - { - var model = new PizzaStoreContextModel(); - model.Initialize(); - model.Customize(); - _instance = model; - } - - private static PizzaStoreContextModel _instance; - public static IModel Instance => _instance; - - partial void Initialize(); - - partial void Customize(); - } -} diff --git a/src/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs b/src/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs deleted file mode 100644 index ba42d6b0..00000000 --- a/src/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - public partial class PizzaStoreContextModel - { - partial void Initialize() - { - var address = AddressEntityType.Create(this); - var latLong = LatLongEntityType.Create(this); - var notificationSubscription = NotificationSubscriptionEntityType.Create(this); - var order = OrderEntityType.Create(this); - var pizza = PizzaEntityType.Create(this); - var pizzaSpecial = PizzaSpecialEntityType.Create(this); - var pizzaTopping = PizzaToppingEntityType.Create(this); - var pizzaStoreUser = PizzaStoreUserEntityType.Create(this); - var topping = ToppingEntityType.Create(this); - var deviceFlowCodes = DeviceFlowCodesEntityType.Create(this); - var key = KeyEntityType.Create(this); - var persistedGrant = PersistedGrantEntityType.Create(this); - var identityRole = IdentityRoleEntityType.Create(this); - var identityRoleClaimstring = IdentityRoleClaimstringEntityType.Create(this); - var identityUserClaimstring = IdentityUserClaimstringEntityType.Create(this); - var identityUserLoginstring = IdentityUserLoginstringEntityType.Create(this); - var identityUserRolestring = IdentityUserRolestringEntityType.Create(this); - var identityUserTokenstring = IdentityUserTokenstringEntityType.Create(this); - - LatLongEntityType.CreateForeignKey1(latLong, order); - OrderEntityType.CreateForeignKey1(order, address); - PizzaEntityType.CreateForeignKey1(pizza, order); - PizzaEntityType.CreateForeignKey2(pizza, pizzaSpecial); - PizzaToppingEntityType.CreateForeignKey1(pizzaTopping, pizza); - PizzaToppingEntityType.CreateForeignKey2(pizzaTopping, topping); - IdentityRoleClaimstringEntityType.CreateForeignKey1(identityRoleClaimstring, identityRole); - IdentityUserClaimstringEntityType.CreateForeignKey1(identityUserClaimstring, pizzaStoreUser); - IdentityUserLoginstringEntityType.CreateForeignKey1(identityUserLoginstring, pizzaStoreUser); - IdentityUserRolestringEntityType.CreateForeignKey1(identityUserRolestring, identityRole); - IdentityUserRolestringEntityType.CreateForeignKey2(identityUserRolestring, pizzaStoreUser); - IdentityUserTokenstringEntityType.CreateForeignKey1(identityUserTokenstring, pizzaStoreUser); - - AddressEntityType.CreateAnnotations(address); - LatLongEntityType.CreateAnnotations(latLong); - NotificationSubscriptionEntityType.CreateAnnotations(notificationSubscription); - OrderEntityType.CreateAnnotations(order); - PizzaEntityType.CreateAnnotations(pizza); - PizzaSpecialEntityType.CreateAnnotations(pizzaSpecial); - PizzaToppingEntityType.CreateAnnotations(pizzaTopping); - PizzaStoreUserEntityType.CreateAnnotations(pizzaStoreUser); - ToppingEntityType.CreateAnnotations(topping); - DeviceFlowCodesEntityType.CreateAnnotations(deviceFlowCodes); - KeyEntityType.CreateAnnotations(key); - PersistedGrantEntityType.CreateAnnotations(persistedGrant); - IdentityRoleEntityType.CreateAnnotations(identityRole); - IdentityRoleClaimstringEntityType.CreateAnnotations(identityRoleClaimstring); - IdentityUserClaimstringEntityType.CreateAnnotations(identityUserClaimstring); - IdentityUserLoginstringEntityType.CreateAnnotations(identityUserLoginstring); - IdentityUserRolestringEntityType.CreateAnnotations(identityUserRolestring); - IdentityUserTokenstringEntityType.CreateAnnotations(identityUserTokenstring); - - AddAnnotation("ProductVersion", "7.0.0"); - } - } -} diff --git a/src/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs b/src/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs deleted file mode 100644 index 18b2d96d..00000000 --- a/src/BlazingPizza.Server/Models/PizzaStoreUserEntityType.cs +++ /dev/null @@ -1,156 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaStoreUserEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Server.PizzaStoreUser", - typeof(PizzaStoreUser), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var accessFailedCount = runtimeEntityType.AddProperty( - "AccessFailedCount", - typeof(int), - propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var concurrencyStamp = runtimeEntityType.AddProperty( - "ConcurrencyStamp", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - concurrencyToken: true); - - var email = runtimeEntityType.AddProperty( - "Email", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var emailConfirmed = runtimeEntityType.AddProperty( - "EmailConfirmed", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var lockoutEnabled = runtimeEntityType.AddProperty( - "LockoutEnabled", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var lockoutEnd = runtimeEntityType.AddProperty( - "LockoutEnd", - typeof(DateTimeOffset?), - propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var normalizedEmail = runtimeEntityType.AddProperty( - "NormalizedEmail", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var normalizedUserName = runtimeEntityType.AddProperty( - "NormalizedUserName", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var passwordHash = runtimeEntityType.AddProperty( - "PasswordHash", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var phoneNumber = runtimeEntityType.AddProperty( - "PhoneNumber", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var phoneNumberConfirmed = runtimeEntityType.AddProperty( - "PhoneNumberConfirmed", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var securityStamp = runtimeEntityType.AddProperty( - "SecurityStamp", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var twoFactorEnabled = runtimeEntityType.AddProperty( - "TwoFactorEnabled", - typeof(bool), - propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var userName = runtimeEntityType.AddProperty( - "UserName", - typeof(string), - propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true, - maxLength: 256); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { normalizedEmail }); - index.AddAnnotation("Relational:Name", "EmailIndex"); - - var index0 = runtimeEntityType.AddIndex( - new[] { normalizedUserName }, - unique: true); - index0.AddAnnotation("Relational:Name", "UserNameIndex"); - - return runtimeEntityType; - } - - 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", "AspNetUsers"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/PizzaToppingEntityType.cs b/src/BlazingPizza.Server/Models/PizzaToppingEntityType.cs deleted file mode 100644 index b97d2a24..00000000 --- a/src/BlazingPizza.Server/Models/PizzaToppingEntityType.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class PizzaToppingEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.PizzaTopping", - typeof(PizzaTopping), - baseEntityType); - - var pizzaId = runtimeEntityType.AddProperty( - "PizzaId", - typeof(int), - propertyInfo: typeof(PizzaTopping).GetProperty("PizzaId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var toppingId = runtimeEntityType.AddProperty( - "ToppingId", - typeof(int), - propertyInfo: typeof(PizzaTopping).GetProperty("ToppingId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - afterSaveBehavior: PropertySaveBehavior.Throw); - - var key = runtimeEntityType.AddKey( - new[] { pizzaId, toppingId }); - runtimeEntityType.SetPrimaryKey(key); - - var index = runtimeEntityType.AddIndex( - new[] { toppingId }); - - return runtimeEntityType; - } - - public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PizzaId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var toppings = principalEntityType.AddNavigation("Toppings", - runtimeForeignKey, - onDependent: false, - typeof(List), - propertyInfo: typeof(Pizza).GetProperty("Toppings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Pizza).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ToppingId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.Cascade, - required: true); - - var topping = declaringEntityType.AddNavigation("Topping", - runtimeForeignKey, - onDependent: true, - typeof(Topping), - propertyInfo: typeof(PizzaTopping).GetProperty("Topping", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(PizzaTopping).GetField("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", "PizzaTopping"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Models/ToppingEntityType.cs b/src/BlazingPizza.Server/Models/ToppingEntityType.cs deleted file mode 100644 index 9295f9bf..00000000 --- a/src/BlazingPizza.Server/Models/ToppingEntityType.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -using System; -using System.Reflection; -using Microsoft.EntityFrameworkCore.Metadata; - -#pragma warning disable 219, 612, 618 -#nullable disable - -namespace BlazingPizza.Server.Models -{ - internal partial class ToppingEntityType - { - public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) - { - var runtimeEntityType = model.AddEntityType( - "BlazingPizza.Topping", - typeof(Topping), - baseEntityType); - - var id = runtimeEntityType.AddProperty( - "Id", - typeof(int), - propertyInfo: typeof(Topping).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - valueGenerated: ValueGenerated.OnAdd, - afterSaveBehavior: PropertySaveBehavior.Throw); - - var name = runtimeEntityType.AddProperty( - "Name", - typeof(string), - propertyInfo: typeof(Topping).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - - var price = runtimeEntityType.AddProperty( - "Price", - typeof(decimal), - propertyInfo: typeof(Topping).GetProperty("Price", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Topping).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - var key = runtimeEntityType.AddKey( - new[] { id }); - runtimeEntityType.SetPrimaryKey(key); - - return runtimeEntityType; - } - - 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", "Toppings"); - runtimeEntityType.AddAnnotation("Relational:ViewName", null); - runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - - Customize(runtimeEntityType); - } - - static partial void Customize(RuntimeEntityType runtimeEntityType); - } -} diff --git a/src/BlazingPizza.Server/Program.cs b/src/BlazingPizza.Server/Program.cs index b83debb4..8cdb85d6 100644 --- a/src/BlazingPizza.Server/Program.cs +++ b/src/BlazingPizza.Server/Program.cs @@ -1,4 +1,5 @@ using BlazingPizza.Server; +using BlazingPizza.Server.CompiledModels; using Microsoft.AspNetCore.Authentication; using Microsoft.EntityFrameworkCore; @@ -12,7 +13,7 @@ builder.Services.AddDbContext(options => options.UseSqlite("Data Source=pizza.db") - .UseModel(BlazingPizza.Server.Models.PizzaStoreContextModel.Instance)); + .UseModel(PizzaStoreContextModel.Instance)); builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores(); diff --git a/src/BlazingPizza.Server/SeedData.cs b/src/BlazingPizza.Server/SeedData.cs index f02e2b77..436ded27 100644 --- a/src/BlazingPizza.Server/SeedData.cs +++ b/src/BlazingPizza.Server/SeedData.cs @@ -8,111 +8,133 @@ public static void Initialize(PizzaStoreContext db) { new Topping() { + Id=1, Name = "Extra cheese", Price = 2.50m, }, new Topping() { + Id=2, Name = "American bacon", Price = 2.99m, }, new Topping() { + Id=3, Name = "British bacon", Price = 2.99m, }, new Topping() { + Id=4, Name = "Canadian bacon", Price = 2.99m, }, new Topping() { + Id=5, Name = "Tea and crumpets", Price = 5.00m }, new Topping() { + Id=6, Name = "Fresh-baked scones", Price = 4.50m, }, new Topping() { + Id=7, Name = "Bell peppers", Price = 1.00m, }, new Topping() { + Id=8, Name = "Onions", Price = 1.00m, }, new Topping() { + Id=9, Name = "Mushrooms", Price = 1.00m, }, new Topping() { + Id=10, Name = "Pepperoni", Price = 1.00m, }, new Topping() { + Id=11, Name = "Duck sausage", Price = 3.20m, }, new Topping() { + Id=12, Name = "Venison meatballs", Price = 2.50m, }, new Topping() { + Id=13, Name = "Served on a silver platter", Price = 250.99m, }, new Topping() { + Id=14, Name = "Lobster on top", Price = 64.50m, }, new Topping() { + Id=15, Name = "Sturgeon caviar", Price = 101.75m, }, new Topping() { + Id=16, Name = "Artichoke hearts", Price = 3.40m, }, new Topping() { + Id=17, Name = "Fresh tomatoes", Price = 1.50m, }, new Topping() { + Id=18, Name = "Basil", Price = 1.50m, }, new Topping() { + Id=19, Name = "Steak (medium-rare)", Price = 8.50m, }, new Topping() { + Id=20, Name = "Blazing hot peppers", Price = 4.20m, }, new Topping() { + Id=21, Name = "Buffalo chicken", Price = 5.00m, }, new Topping() { + Id=22, Name = "Blue cheese", Price = 2.50m, }, diff --git a/src/BlazingPizza.Shared/Topping.cs b/src/BlazingPizza.Shared/Topping.cs index 29b9e790..87cd29f0 100644 --- a/src/BlazingPizza.Shared/Topping.cs +++ b/src/BlazingPizza.Shared/Topping.cs @@ -2,6 +2,7 @@ public class Topping { + public int Id { get; set; } public string Name { get; set; } = string.Empty; diff --git a/src/BlazingPizza.sln b/src/BlazingPizza.sln index 0f195a94..e685e0d3 100644 --- a/src/BlazingPizza.sln +++ b/src/BlazingPizza.sln @@ -13,9 +13,6 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazingComponents", "BlazingComponents\BlazingComponents.csproj", "{4C4132E7-D096-42DA-9C3D-C444B42C3889}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F9424A4A-0D8F-4320-8063-4D835522DDA5}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution