// <auto-generated />
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;
using Microsoft.EntityFrameworkCore.Update.Internal;

#pragma warning disable 219, 612, 618
#nullable disable

namespace TestNamespace
{
    public partial class DbContextModel
    {
        private DbContextModel()
            : base(skipDetectChanges: false, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 3)
        {
        }

        partial void Initialize()
        {
            var dependentBase = DependentBaseEntityType.Create(this);
            var principalBase = PrincipalBaseEntityType.Create(this);
            var principalDerived = PrincipalDerivedEntityType.Create(this, principalBase);

            DependentBaseEntityType.CreateForeignKey1(dependentBase, principalDerived);
            PrincipalBaseEntityType.CreateForeignKey1(principalBase, principalBase);
            PrincipalBaseEntityType.CreateForeignKey2(principalBase, principalDerived);

            DependentBaseEntityType.CreateAnnotations(dependentBase);
            PrincipalBaseEntityType.CreateAnnotations(principalBase);
            PrincipalDerivedEntityType.CreateAnnotations(principalDerived);

            AddAnnotation("Relational:DefaultSchema", "TPC");
            AddAnnotation("Relational:MaxIdentifierLength", 128);
            AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
            AddRuntimeAnnotation("Relational:RelationalModelFactory", () => CreateRelationalModel());
        }

        private IRelationalModel CreateRelationalModel()
        {
            var relationalModel = new RelationalModel(this);

            var dependentBase = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>")!;

            var defaultTableMappings = new List<TableMappingBase<ColumnMappingBase>>();
            dependentBase.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings);
            var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>", null, relationalModel);
            var idColumnBase = new ColumnBase<ColumnMappingBase>("Id", "tinyint", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("Id", idColumnBase);
            var principalIdColumnBase = new ColumnBase<ColumnMappingBase>("PrincipalId", "bigint", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("PrincipalId", principalIdColumnBase);
            relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase);
            var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase = new TableMappingBase<ColumnMappingBase>(dependentBase, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase, null);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase, false);
            defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)idColumnBase, dependentBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)principalIdColumnBase, dependentBase.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);

            var tableMappings = new List<TableMapping>();
            dependentBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings);
            var dependentBasebyteTable = new Table("DependentBase<byte?>", "TPC", relationalModel);
            var idColumn = new Column("Id", "tinyint", dependentBasebyteTable);
            dependentBasebyteTable.Columns.Add("Id", idColumn);
            idColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<byte>(idColumn);
            var principalIdColumn = new Column("PrincipalId", "bigint", dependentBasebyteTable)
            {
                IsNullable = true
            };
            dependentBasebyteTable.Columns.Add("PrincipalId", principalIdColumn);
            principalIdColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<long>(principalIdColumn);
            relationalModel.Tables.Add(("DependentBase<byte?>", "TPC"), dependentBasebyteTable);
            var dependentBasebyteTableMapping = new TableMapping(dependentBase, dependentBasebyteTable, null);
            dependentBasebyteTable.AddTypeMapping(dependentBasebyteTableMapping, false);
            tableMappings.Add(dependentBasebyteTableMapping);
            RelationalModel.CreateColumnMapping(idColumn, dependentBase.FindProperty("Id")!, dependentBasebyteTableMapping);
            RelationalModel.CreateColumnMapping(principalIdColumn, dependentBase.FindProperty("PrincipalId")!, dependentBasebyteTableMapping);
            var pK_DependentBasebyte = new UniqueConstraint("PK_DependentBase<byte?>", dependentBasebyteTable, new[] { idColumn });
            dependentBasebyteTable.PrimaryKey = pK_DependentBasebyte;
            pK_DependentBasebyte.SetRowKeyValueFactory(new SimpleRowKeyValueFactory<byte>(pK_DependentBasebyte));
            var pK_DependentBasebyteKey = RelationalModel.GetKey(this,
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>",
                new[] { "Id" });
            pK_DependentBasebyte.MappedKeys.Add(pK_DependentBasebyteKey);
            RelationalModel.GetOrCreateUniqueConstraints(pK_DependentBasebyteKey).Add(pK_DependentBasebyte);
            dependentBasebyteTable.UniqueConstraints.Add("PK_DependentBase<byte?>", pK_DependentBasebyte);
            var iX_DependentBasebyte_PrincipalId = new TableIndex(
            "IX_DependentBase<byte?>_PrincipalId", dependentBasebyteTable, new[] { principalIdColumn }, true);
            iX_DependentBasebyte_PrincipalId.SetRowIndexValueFactory(new SimpleRowIndexValueFactory<long>(iX_DependentBasebyte_PrincipalId));
            var iX_DependentBasebyte_PrincipalIdIx = RelationalModel.GetIndex(this,
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>",
                new[] { "PrincipalId" });
            iX_DependentBasebyte_PrincipalId.MappedIndexes.Add(iX_DependentBasebyte_PrincipalIdIx);
            RelationalModel.GetOrCreateTableIndexes(iX_DependentBasebyte_PrincipalIdIx).Add(iX_DependentBasebyte_PrincipalId);
            dependentBasebyteTable.Indexes.Add("IX_DependentBase<byte?>_PrincipalId", iX_DependentBasebyte_PrincipalId);

            var principalBase = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase")!;

            var defaultTableMappings0 = new List<TableMappingBase<ColumnMappingBase>>();
            principalBase.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0);
            var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", null, relationalModel);
            var enum1ColumnBase = new ColumnBase<ColumnMappingBase>("Enum1", "int", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("Enum1", enum1ColumnBase);
            var enum2ColumnBase = new ColumnBase<ColumnMappingBase>("Enum2", "int", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("Enum2", enum2ColumnBase);
            var flagsEnum1ColumnBase = new ColumnBase<ColumnMappingBase>("FlagsEnum1", "int", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("FlagsEnum1", flagsEnum1ColumnBase);
            var flagsEnum2ColumnBase = new ColumnBase<ColumnMappingBase>("FlagsEnum2", "int", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("FlagsEnum2", flagsEnum2ColumnBase);
            var idColumnBase0 = new ColumnBase<ColumnMappingBase>("Id", "bigint", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("Id", idColumnBase0);
            var principalBaseIdColumnBase = new ColumnBase<ColumnMappingBase>("PrincipalBaseId", "bigint", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("PrincipalBaseId", principalBaseIdColumnBase);
            var principalDerivedDependentBasebyteIdColumnBase = new ColumnBase<ColumnMappingBase>("PrincipalDerived<DependentBase<byte?>>Id", "bigint", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("PrincipalDerived<DependentBase<byte?>>Id", principalDerivedDependentBasebyteIdColumnBase);
            var refTypeArrayColumnBase = new ColumnBase<ColumnMappingBase>("RefTypeArray", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("RefTypeArray", refTypeArrayColumnBase);
            var refTypeEnumerableColumnBase = new ColumnBase<ColumnMappingBase>("RefTypeEnumerable", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("RefTypeEnumerable", refTypeEnumerableColumnBase);
            var refTypeIListColumnBase = new ColumnBase<ColumnMappingBase>("RefTypeIList", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("RefTypeIList", refTypeIListColumnBase);
            var refTypeListColumnBase = new ColumnBase<ColumnMappingBase>("RefTypeList", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("RefTypeList", refTypeListColumnBase);
            var valueTypeArrayColumnBase = new ColumnBase<ColumnMappingBase>("ValueTypeArray", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("ValueTypeArray", valueTypeArrayColumnBase);
            var valueTypeEnumerableColumnBase = new ColumnBase<ColumnMappingBase>("ValueTypeEnumerable", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableColumnBase);
            var valueTypeIListColumnBase = new ColumnBase<ColumnMappingBase>("ValueTypeIList", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("ValueTypeIList", valueTypeIListColumnBase);
            var valueTypeListColumnBase = new ColumnBase<ColumnMappingBase>("ValueTypeList", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("ValueTypeList", valueTypeListColumnBase);
            relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase);
            var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase = new TableMappingBase<ColumnMappingBase>(principalBase, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase, false);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase, false);
            defaultTableMappings0.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)idColumnBase0, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)enum1ColumnBase, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)enum2ColumnBase, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)flagsEnum1ColumnBase, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)flagsEnum2ColumnBase, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)principalBaseIdColumnBase, principalBase.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)principalDerivedDependentBasebyteIdColumnBase, principalBase.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)refTypeArrayColumnBase, principalBase.FindProperty("RefTypeArray")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)refTypeEnumerableColumnBase, principalBase.FindProperty("RefTypeEnumerable")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)refTypeIListColumnBase, principalBase.FindProperty("RefTypeIList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)refTypeListColumnBase, principalBase.FindProperty("RefTypeList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)valueTypeArrayColumnBase, principalBase.FindProperty("ValueTypeArray")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)valueTypeEnumerableColumnBase, principalBase.FindProperty("ValueTypeEnumerable")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)valueTypeIListColumnBase, principalBase.FindProperty("ValueTypeIList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)valueTypeListColumnBase, principalBase.FindProperty("ValueTypeList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase);

            var tableMappings0 = new List<TableMapping>();
            principalBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0);
            var principalBaseTable = new Table("PrincipalBase", "TPC", relationalModel);
            var idColumn0 = new Column("Id", "bigint", principalBaseTable);
            principalBaseTable.Columns.Add("Id", idColumn0);
            idColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<long>(idColumn0);
            var enum1Column = new Column("Enum1", "int", principalBaseTable);
            principalBaseTable.Columns.Add("Enum1", enum1Column);
            enum1Column.Accessors = ColumnAccessorsFactory.CreateGeneric<int>(enum1Column);
            var enum2Column = new Column("Enum2", "int", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("Enum2", enum2Column);
            enum2Column.Accessors = ColumnAccessorsFactory.CreateGeneric<int>(enum2Column);
            var flagsEnum1Column = new Column("FlagsEnum1", "int", principalBaseTable);
            principalBaseTable.Columns.Add("FlagsEnum1", flagsEnum1Column);
            flagsEnum1Column.Accessors = ColumnAccessorsFactory.CreateGeneric<int>(flagsEnum1Column);
            var flagsEnum2Column = new Column("FlagsEnum2", "int", principalBaseTable);
            principalBaseTable.Columns.Add("FlagsEnum2", flagsEnum2Column);
            flagsEnum2Column.Accessors = ColumnAccessorsFactory.CreateGeneric<int>(flagsEnum2Column);
            var principalBaseIdColumn = new Column("PrincipalBaseId", "bigint", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("PrincipalBaseId", principalBaseIdColumn);
            principalBaseIdColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<long>(principalBaseIdColumn);
            var principalDerivedDependentBasebyteIdColumn = new Column("PrincipalDerived<DependentBase<byte?>>Id", "bigint", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("PrincipalDerived<DependentBase<byte?>>Id", principalDerivedDependentBasebyteIdColumn);
            principalDerivedDependentBasebyteIdColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<long>(principalDerivedDependentBasebyteIdColumn);
            var refTypeArrayColumn = new Column("RefTypeArray", "nvarchar(max)", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("RefTypeArray", refTypeArrayColumn);
            refTypeArrayColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(refTypeArrayColumn);
            var refTypeEnumerableColumn = new Column("RefTypeEnumerable", "nvarchar(max)", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("RefTypeEnumerable", refTypeEnumerableColumn);
            refTypeEnumerableColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(refTypeEnumerableColumn);
            var refTypeIListColumn = new Column("RefTypeIList", "nvarchar(max)", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("RefTypeIList", refTypeIListColumn);
            refTypeIListColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(refTypeIListColumn);
            var refTypeListColumn = new Column("RefTypeList", "nvarchar(max)", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("RefTypeList", refTypeListColumn);
            refTypeListColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(refTypeListColumn);
            var valueTypeArrayColumn = new Column("ValueTypeArray", "nvarchar(max)", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("ValueTypeArray", valueTypeArrayColumn);
            valueTypeArrayColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(valueTypeArrayColumn);
            var valueTypeEnumerableColumn = new Column("ValueTypeEnumerable", "nvarchar(max)", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableColumn);
            valueTypeEnumerableColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(valueTypeEnumerableColumn);
            var valueTypeIListColumn = new Column("ValueTypeIList", "nvarchar(max)", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("ValueTypeIList", valueTypeIListColumn);
            valueTypeIListColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(valueTypeIListColumn);
            var valueTypeListColumn = new Column("ValueTypeList", "nvarchar(max)", principalBaseTable)
            {
                IsNullable = true
            };
            principalBaseTable.Columns.Add("ValueTypeList", valueTypeListColumn);
            valueTypeListColumn.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(valueTypeListColumn);
            relationalModel.Tables.Add(("PrincipalBase", "TPC"), principalBaseTable);
            var principalBaseTableMapping = new TableMapping(principalBase, principalBaseTable, false);
            principalBaseTable.AddTypeMapping(principalBaseTableMapping, false);
            tableMappings0.Add(principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(idColumn0, principalBase.FindProperty("Id")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(enum1Column, principalBase.FindProperty("Enum1")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(enum2Column, principalBase.FindProperty("Enum2")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(flagsEnum1Column, principalBase.FindProperty("FlagsEnum1")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(flagsEnum2Column, principalBase.FindProperty("FlagsEnum2")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(principalBaseIdColumn, principalBase.FindProperty("PrincipalBaseId")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(principalDerivedDependentBasebyteIdColumn, principalBase.FindProperty("PrincipalDerivedId")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(refTypeArrayColumn, principalBase.FindProperty("RefTypeArray")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(refTypeEnumerableColumn, principalBase.FindProperty("RefTypeEnumerable")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(refTypeIListColumn, principalBase.FindProperty("RefTypeIList")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(refTypeListColumn, principalBase.FindProperty("RefTypeList")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(valueTypeArrayColumn, principalBase.FindProperty("ValueTypeArray")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(valueTypeEnumerableColumn, principalBase.FindProperty("ValueTypeEnumerable")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(valueTypeIListColumn, principalBase.FindProperty("ValueTypeIList")!, principalBaseTableMapping);
            RelationalModel.CreateColumnMapping(valueTypeListColumn, principalBase.FindProperty("ValueTypeList")!, principalBaseTableMapping);
            var pK_PrincipalBase = new UniqueConstraint("PK_PrincipalBase", principalBaseTable, new[] { idColumn0 });
            principalBaseTable.PrimaryKey = pK_PrincipalBase;
            pK_PrincipalBase.SetRowKeyValueFactory(new SimpleRowKeyValueFactory<long>(pK_PrincipalBase));
            var pK_PrincipalBaseKey = RelationalModel.GetKey(this,
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase",
                new[] { "Id" });
            pK_PrincipalBase.MappedKeys.Add(pK_PrincipalBaseKey);
            RelationalModel.GetOrCreateUniqueConstraints(pK_PrincipalBaseKey).Add(pK_PrincipalBase);
            principalBaseTable.UniqueConstraints.Add("PK_PrincipalBase", pK_PrincipalBase);
            var iX_PrincipalBase_PrincipalDerivedDependentBasebyteId = new TableIndex(
            "IX_PrincipalBase_PrincipalDerived<DependentBase<byte?>>Id", principalBaseTable, new[] { principalDerivedDependentBasebyteIdColumn }, false);
            iX_PrincipalBase_PrincipalDerivedDependentBasebyteId.SetRowIndexValueFactory(new SimpleRowIndexValueFactory<long>(iX_PrincipalBase_PrincipalDerivedDependentBasebyteId));
            var iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx = RelationalModel.GetIndex(this,
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase",
                new[] { "PrincipalDerivedId" });
            iX_PrincipalBase_PrincipalDerivedDependentBasebyteId.MappedIndexes.Add(iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx);
            RelationalModel.GetOrCreateTableIndexes(iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx).Add(iX_PrincipalBase_PrincipalDerivedDependentBasebyteId);
            principalBaseTable.Indexes.Add("IX_PrincipalBase_PrincipalDerived<DependentBase<byte?>>Id", iX_PrincipalBase_PrincipalDerivedDependentBasebyteId);
            var pIX = new TableIndex(
            "PIX", principalBaseTable, new[] { principalBaseIdColumn }, true);
            pIX.SetRowIndexValueFactory(new SimpleRowIndexValueFactory<long>(pIX));
            var pIXIx = RelationalModel.GetIndex(this,
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase",
                "PrincipalIndex");
            pIX.MappedIndexes.Add(pIXIx);
            RelationalModel.GetOrCreateTableIndexes(pIXIx).Add(pIX);
            principalBaseTable.Indexes.Add("PIX", pIX);

            var viewMappings = new List<ViewMapping>();
            principalBase.SetRuntimeAnnotation("Relational:ViewMappings", viewMappings);
            var principalBaseViewView = new View("PrincipalBaseView", "TPC", relationalModel);
            var enum1ViewColumn = new ViewColumn("Enum1", "int", principalBaseViewView);
            principalBaseViewView.Columns.Add("Enum1", enum1ViewColumn);
            var enum2ViewColumn = new ViewColumn("Enum2", "int", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("Enum2", enum2ViewColumn);
            var flagsEnum1ViewColumn = new ViewColumn("FlagsEnum1", "int", principalBaseViewView);
            principalBaseViewView.Columns.Add("FlagsEnum1", flagsEnum1ViewColumn);
            var flagsEnum2ViewColumn = new ViewColumn("FlagsEnum2", "int", principalBaseViewView);
            principalBaseViewView.Columns.Add("FlagsEnum2", flagsEnum2ViewColumn);
            var idViewColumn = new ViewColumn("Id", "bigint", principalBaseViewView);
            principalBaseViewView.Columns.Add("Id", idViewColumn);
            var principalBaseIdViewColumn = new ViewColumn("PrincipalBaseId", "bigint", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("PrincipalBaseId", principalBaseIdViewColumn);
            var principalDerivedIdViewColumn = new ViewColumn("PrincipalDerivedId", "bigint", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("PrincipalDerivedId", principalDerivedIdViewColumn);
            var refTypeArrayViewColumn = new ViewColumn("RefTypeArray", "nvarchar(max)", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("RefTypeArray", refTypeArrayViewColumn);
            var refTypeEnumerableViewColumn = new ViewColumn("RefTypeEnumerable", "nvarchar(max)", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("RefTypeEnumerable", refTypeEnumerableViewColumn);
            var refTypeIListViewColumn = new ViewColumn("RefTypeIList", "nvarchar(max)", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("RefTypeIList", refTypeIListViewColumn);
            var refTypeListViewColumn = new ViewColumn("RefTypeList", "nvarchar(max)", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("RefTypeList", refTypeListViewColumn);
            var valueTypeArrayViewColumn = new ViewColumn("ValueTypeArray", "nvarchar(max)", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("ValueTypeArray", valueTypeArrayViewColumn);
            var valueTypeEnumerableViewColumn = new ViewColumn("ValueTypeEnumerable", "nvarchar(max)", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableViewColumn);
            var valueTypeIListViewColumn = new ViewColumn("ValueTypeIList", "nvarchar(max)", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("ValueTypeIList", valueTypeIListViewColumn);
            var valueTypeListViewColumn = new ViewColumn("ValueTypeList", "nvarchar(max)", principalBaseViewView)
            {
                IsNullable = true
            };
            principalBaseViewView.Columns.Add("ValueTypeList", valueTypeListViewColumn);
            relationalModel.Views.Add(("PrincipalBaseView", "TPC"), principalBaseViewView);
            var principalBaseViewViewMapping = new ViewMapping(principalBase, principalBaseViewView, false);
            principalBaseViewView.AddTypeMapping(principalBaseViewViewMapping, false);
            viewMappings.Add(principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(idViewColumn, principalBase.FindProperty("Id")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(enum1ViewColumn, principalBase.FindProperty("Enum1")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(enum2ViewColumn, principalBase.FindProperty("Enum2")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(flagsEnum1ViewColumn, principalBase.FindProperty("FlagsEnum1")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(flagsEnum2ViewColumn, principalBase.FindProperty("FlagsEnum2")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(principalBaseIdViewColumn, principalBase.FindProperty("PrincipalBaseId")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(principalDerivedIdViewColumn, principalBase.FindProperty("PrincipalDerivedId")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(refTypeArrayViewColumn, principalBase.FindProperty("RefTypeArray")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(refTypeEnumerableViewColumn, principalBase.FindProperty("RefTypeEnumerable")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(refTypeIListViewColumn, principalBase.FindProperty("RefTypeIList")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(refTypeListViewColumn, principalBase.FindProperty("RefTypeList")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(valueTypeArrayViewColumn, principalBase.FindProperty("ValueTypeArray")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(valueTypeEnumerableViewColumn, principalBase.FindProperty("ValueTypeEnumerable")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(valueTypeIListViewColumn, principalBase.FindProperty("ValueTypeIList")!, principalBaseViewViewMapping);
            RelationalModel.CreateViewColumnMapping(valueTypeListViewColumn, principalBase.FindProperty("ValueTypeList")!, principalBaseViewViewMapping);

            var deleteSprocMappings = new List<StoredProcedureMapping>();
            principalBase.SetRuntimeAnnotation("Relational:DeleteStoredProcedureMappings", deleteSprocMappings);
            var principalBase_DeleteStoreSproc = new StoreStoredProcedure("PrincipalBase_Delete", "TPC", relationalModel);
            principalBase_DeleteStoreSproc.ReturnValue = new StoreStoredProcedureReturnValue("", "int", principalBase_DeleteStoreSproc);
            var id_OriginalParameter = new StoreStoredProcedureParameter("Id_Original", "bigint", 0, principalBase_DeleteStoreSproc, System.Data.ParameterDirection.Input);
            principalBase_DeleteStoreSproc.AddParameter(id_OriginalParameter);
            principalBase_DeleteStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalBase.GetDeleteStoredProcedure()!);
            relationalModel.StoredProcedures.Add(("PrincipalBase_Delete", "TPC"), principalBase_DeleteStoreSproc);
            var principalBase_DeleteDSproc = (IRuntimeStoredProcedure)principalBase.GetDeleteStoredProcedure()!;
            var principalBase_DeleteSprocMapping = new StoredProcedureMapping(principalBase, principalBase_DeleteStoreSproc, principalBase_DeleteDSproc, principalBaseTableMapping, false);
            principalBase_DeleteStoreSproc.AddTypeMapping(principalBase_DeleteSprocMapping, false);
            deleteSprocMappings.Add(principalBase_DeleteSprocMapping);
            principalBaseTableMapping.DeleteStoredProcedureMapping = principalBase_DeleteSprocMapping;
            RelationalModel.CreateStoredProcedureParameterMapping(id_OriginalParameter, principalBase_DeleteDSproc.FindParameter("Id_Original")!, principalBase.FindProperty("Id")!, principalBase_DeleteSprocMapping);

            var insertSprocMappings = new List<StoredProcedureMapping>();
            principalBase.SetRuntimeAnnotation("Relational:InsertStoredProcedureMappings", insertSprocMappings);
            var principalBase_InsertStoreSproc = new StoreStoredProcedure("PrincipalBase_Insert", "TPC", relationalModel);
            var idParameter = new StoreStoredProcedureParameter("Id", "bigint", 0, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input);
            principalBase_InsertStoreSproc.AddParameter(idParameter);
            var principalBaseIdParameter = new StoreStoredProcedureParameter("PrincipalBaseId", "bigint", 1, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(principalBaseIdParameter);
            var principalDerivedIdParameter = new StoreStoredProcedureParameter("PrincipalDerivedId", "bigint", 2, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(principalDerivedIdParameter);
            var enum2Parameter = new StoreStoredProcedureParameter("Enum2", "int", 3, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(enum2Parameter);
            var flagsEnum1Parameter = new StoreStoredProcedureParameter("FlagsEnum1", "int", 4, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input);
            principalBase_InsertStoreSproc.AddParameter(flagsEnum1Parameter);
            var flagsEnum2Parameter = new StoreStoredProcedureParameter("FlagsEnum2", "int", 5, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input);
            principalBase_InsertStoreSproc.AddParameter(flagsEnum2Parameter);
            var valueTypeListParameter = new StoreStoredProcedureParameter("ValueTypeList", "nvarchar(max)", 6, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(valueTypeListParameter);
            var valueTypeIListParameter = new StoreStoredProcedureParameter("ValueTypeIList", "nvarchar(max)", 7, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(valueTypeIListParameter);
            var valueTypeArrayParameter = new StoreStoredProcedureParameter("ValueTypeArray", "nvarchar(max)", 8, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(valueTypeArrayParameter);
            var valueTypeEnumerableParameter = new StoreStoredProcedureParameter("ValueTypeEnumerable", "nvarchar(max)", 9, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(valueTypeEnumerableParameter);
            var refTypeListParameter = new StoreStoredProcedureParameter("RefTypeList", "nvarchar(max)", 10, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(refTypeListParameter);
            var refTypeIListParameter = new StoreStoredProcedureParameter("RefTypeIList", "nvarchar(max)", 11, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(refTypeIListParameter);
            var refTypeArrayParameter = new StoreStoredProcedureParameter("RefTypeArray", "nvarchar(max)", 12, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(refTypeArrayParameter);
            var refTypeEnumerableParameter = new StoreStoredProcedureParameter("RefTypeEnumerable", "nvarchar(max)", 13, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_InsertStoreSproc.AddParameter(refTypeEnumerableParameter);
            var baseEnumParameter = new StoreStoredProcedureParameter("BaseEnum", "int", 14, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Output);
            principalBase_InsertStoreSproc.AddParameter(baseEnumParameter);
            principalBase_InsertStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalBase.GetInsertStoredProcedure()!);
            relationalModel.StoredProcedures.Add(("PrincipalBase_Insert", "TPC"), principalBase_InsertStoreSproc);
            var principalBase_InsertISproc = (IRuntimeStoredProcedure)principalBase.GetInsertStoredProcedure()!;
            var principalBase_InsertSprocMapping = new StoredProcedureMapping(principalBase, principalBase_InsertStoreSproc, principalBase_InsertISproc, principalBaseTableMapping, false);
            principalBase_InsertStoreSproc.AddTypeMapping(principalBase_InsertSprocMapping, false);
            insertSprocMappings.Add(principalBase_InsertSprocMapping);
            principalBaseTableMapping.InsertStoredProcedureMapping = principalBase_InsertSprocMapping;
            RelationalModel.CreateStoredProcedureParameterMapping(idParameter, principalBase_InsertISproc.FindParameter("Id")!, principalBase.FindProperty("Id")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(baseEnumParameter, principalBase_InsertISproc.FindParameter("BaseEnum")!, principalBase.FindProperty("Enum1")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(enum2Parameter, principalBase_InsertISproc.FindParameter("Enum2")!, principalBase.FindProperty("Enum2")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum1Parameter, principalBase_InsertISproc.FindParameter("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum2Parameter, principalBase_InsertISproc.FindParameter("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(principalBaseIdParameter, principalBase_InsertISproc.FindParameter("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(principalDerivedIdParameter, principalBase_InsertISproc.FindParameter("PrincipalDerivedId")!, principalBase.FindProperty("PrincipalDerivedId")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeArrayParameter, principalBase_InsertISproc.FindParameter("RefTypeArray")!, principalBase.FindProperty("RefTypeArray")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeEnumerableParameter, principalBase_InsertISproc.FindParameter("RefTypeEnumerable")!, principalBase.FindProperty("RefTypeEnumerable")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeIListParameter, principalBase_InsertISproc.FindParameter("RefTypeIList")!, principalBase.FindProperty("RefTypeIList")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeListParameter, principalBase_InsertISproc.FindParameter("RefTypeList")!, principalBase.FindProperty("RefTypeList")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeArrayParameter, principalBase_InsertISproc.FindParameter("ValueTypeArray")!, principalBase.FindProperty("ValueTypeArray")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeEnumerableParameter, principalBase_InsertISproc.FindParameter("ValueTypeEnumerable")!, principalBase.FindProperty("ValueTypeEnumerable")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeIListParameter, principalBase_InsertISproc.FindParameter("ValueTypeIList")!, principalBase.FindProperty("ValueTypeIList")!, principalBase_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeListParameter, principalBase_InsertISproc.FindParameter("ValueTypeList")!, principalBase.FindProperty("ValueTypeList")!, principalBase_InsertSprocMapping);

            var updateSprocMappings = new List<StoredProcedureMapping>();
            principalBase.SetRuntimeAnnotation("Relational:UpdateStoredProcedureMappings", updateSprocMappings);
            var principalBase_UpdateStoreSproc = new StoreStoredProcedure("PrincipalBase_Update", "TPC", relationalModel);
            var principalBaseIdParameter0 = new StoreStoredProcedureParameter("PrincipalBaseId", "bigint", 0, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(principalBaseIdParameter0);
            var principalDerivedIdParameter0 = new StoreStoredProcedureParameter("PrincipalDerivedId", "bigint", 1, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(principalDerivedIdParameter0);
            var enum1Parameter = new StoreStoredProcedureParameter("Enum1", "int", 2, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input);
            principalBase_UpdateStoreSproc.AddParameter(enum1Parameter);
            var enum2Parameter0 = new StoreStoredProcedureParameter("Enum2", "int", 3, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(enum2Parameter0);
            var flagsEnum1Parameter0 = new StoreStoredProcedureParameter("FlagsEnum1", "int", 4, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input);
            principalBase_UpdateStoreSproc.AddParameter(flagsEnum1Parameter0);
            var flagsEnum2Parameter0 = new StoreStoredProcedureParameter("FlagsEnum2", "int", 5, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input);
            principalBase_UpdateStoreSproc.AddParameter(flagsEnum2Parameter0);
            var valueTypeListParameter0 = new StoreStoredProcedureParameter("ValueTypeList", "nvarchar(max)", 6, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(valueTypeListParameter0);
            var valueTypeIListParameter0 = new StoreStoredProcedureParameter("ValueTypeIList", "nvarchar(max)", 7, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(valueTypeIListParameter0);
            var valueTypeArrayParameter0 = new StoreStoredProcedureParameter("ValueTypeArray", "nvarchar(max)", 8, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(valueTypeArrayParameter0);
            var valueTypeEnumerableParameter0 = new StoreStoredProcedureParameter("ValueTypeEnumerable", "nvarchar(max)", 9, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(valueTypeEnumerableParameter0);
            var refTypeListParameter0 = new StoreStoredProcedureParameter("RefTypeList", "nvarchar(max)", 10, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(refTypeListParameter0);
            var refTypeIListParameter0 = new StoreStoredProcedureParameter("RefTypeIList", "nvarchar(max)", 11, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(refTypeIListParameter0);
            var refTypeArrayParameter0 = new StoreStoredProcedureParameter("RefTypeArray", "nvarchar(max)", 12, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(refTypeArrayParameter0);
            var refTypeEnumerableParameter0 = new StoreStoredProcedureParameter("RefTypeEnumerable", "nvarchar(max)", 13, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            principalBase_UpdateStoreSproc.AddParameter(refTypeEnumerableParameter0);
            var id_OriginalParameter0 = new StoreStoredProcedureParameter("Id_Original", "bigint", 14, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input);
            principalBase_UpdateStoreSproc.AddParameter(id_OriginalParameter0);
            principalBase_UpdateStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalBase.GetUpdateStoredProcedure()!);
            relationalModel.StoredProcedures.Add(("PrincipalBase_Update", "TPC"), principalBase_UpdateStoreSproc);
            var principalBase_UpdateUSproc = (IRuntimeStoredProcedure)principalBase.GetUpdateStoredProcedure()!;
            var principalBase_UpdateSprocMapping = new StoredProcedureMapping(principalBase, principalBase_UpdateStoreSproc, principalBase_UpdateUSproc, principalBaseTableMapping, false);
            principalBase_UpdateStoreSproc.AddTypeMapping(principalBase_UpdateSprocMapping, false);
            updateSprocMappings.Add(principalBase_UpdateSprocMapping);
            principalBaseTableMapping.UpdateStoredProcedureMapping = principalBase_UpdateSprocMapping;
            RelationalModel.CreateStoredProcedureParameterMapping(id_OriginalParameter0, principalBase_UpdateUSproc.FindParameter("Id_Original")!, principalBase.FindProperty("Id")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(enum1Parameter, principalBase_UpdateUSproc.FindParameter("Enum1")!, principalBase.FindProperty("Enum1")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(enum2Parameter0, principalBase_UpdateUSproc.FindParameter("Enum2")!, principalBase.FindProperty("Enum2")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum1Parameter0, principalBase_UpdateUSproc.FindParameter("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum2Parameter0, principalBase_UpdateUSproc.FindParameter("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(principalBaseIdParameter0, principalBase_UpdateUSproc.FindParameter("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(principalDerivedIdParameter0, principalBase_UpdateUSproc.FindParameter("PrincipalDerivedId")!, principalBase.FindProperty("PrincipalDerivedId")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeArrayParameter0, principalBase_UpdateUSproc.FindParameter("RefTypeArray")!, principalBase.FindProperty("RefTypeArray")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeEnumerableParameter0, principalBase_UpdateUSproc.FindParameter("RefTypeEnumerable")!, principalBase.FindProperty("RefTypeEnumerable")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeIListParameter0, principalBase_UpdateUSproc.FindParameter("RefTypeIList")!, principalBase.FindProperty("RefTypeIList")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeListParameter0, principalBase_UpdateUSproc.FindParameter("RefTypeList")!, principalBase.FindProperty("RefTypeList")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeArrayParameter0, principalBase_UpdateUSproc.FindParameter("ValueTypeArray")!, principalBase.FindProperty("ValueTypeArray")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeEnumerableParameter0, principalBase_UpdateUSproc.FindParameter("ValueTypeEnumerable")!, principalBase.FindProperty("ValueTypeEnumerable")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeIListParameter0, principalBase_UpdateUSproc.FindParameter("ValueTypeIList")!, principalBase.FindProperty("ValueTypeIList")!, principalBase_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeListParameter0, principalBase_UpdateUSproc.FindParameter("ValueTypeList")!, principalBase.FindProperty("ValueTypeList")!, principalBase_UpdateSprocMapping);

            var principalDerived = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived<Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>>")!;

            var defaultTableMappings1 = new List<TableMappingBase<ColumnMappingBase>>();
            principalDerived.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1);
            var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived<Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>>", null, relationalModel);
            var enum1ColumnBase0 = new ColumnBase<ColumnMappingBase>("Enum1", "int", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("Enum1", enum1ColumnBase0);
            var enum2ColumnBase0 = new ColumnBase<ColumnMappingBase>("Enum2", "int", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("Enum2", enum2ColumnBase0);
            var flagsEnum1ColumnBase0 = new ColumnBase<ColumnMappingBase>("FlagsEnum1", "int", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("FlagsEnum1", flagsEnum1ColumnBase0);
            var flagsEnum2ColumnBase0 = new ColumnBase<ColumnMappingBase>("FlagsEnum2", "int", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("FlagsEnum2", flagsEnum2ColumnBase0);
            var idColumnBase1 = new ColumnBase<ColumnMappingBase>("Id", "bigint", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("Id", idColumnBase1);
            var principalBaseIdColumnBase0 = new ColumnBase<ColumnMappingBase>("PrincipalBaseId", "bigint", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("PrincipalBaseId", principalBaseIdColumnBase0);
            var principalDerivedDependentBasebyteIdColumnBase0 = new ColumnBase<ColumnMappingBase>("PrincipalDerived<DependentBase<byte?>>Id", "bigint", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("PrincipalDerived<DependentBase<byte?>>Id", principalDerivedDependentBasebyteIdColumnBase0);
            var refTypeArrayColumnBase0 = new ColumnBase<ColumnMappingBase>("RefTypeArray", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("RefTypeArray", refTypeArrayColumnBase0);
            var refTypeEnumerableColumnBase0 = new ColumnBase<ColumnMappingBase>("RefTypeEnumerable", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("RefTypeEnumerable", refTypeEnumerableColumnBase0);
            var refTypeIListColumnBase0 = new ColumnBase<ColumnMappingBase>("RefTypeIList", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("RefTypeIList", refTypeIListColumnBase0);
            var refTypeListColumnBase0 = new ColumnBase<ColumnMappingBase>("RefTypeList", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("RefTypeList", refTypeListColumnBase0);
            var valueTypeArrayColumnBase0 = new ColumnBase<ColumnMappingBase>("ValueTypeArray", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("ValueTypeArray", valueTypeArrayColumnBase0);
            var valueTypeEnumerableColumnBase0 = new ColumnBase<ColumnMappingBase>("ValueTypeEnumerable", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableColumnBase0);
            var valueTypeIListColumnBase0 = new ColumnBase<ColumnMappingBase>("ValueTypeIList", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("ValueTypeIList", valueTypeIListColumnBase0);
            var valueTypeListColumnBase0 = new ColumnBase<ColumnMappingBase>("ValueTypeList", "nvarchar(max)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase)
            {
                IsNullable = true
            };
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("ValueTypeList", valueTypeListColumnBase0);
            relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived<Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>>", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase);
            var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase = new TableMappingBase<ColumnMappingBase>(principalDerived, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase, null);
            microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase, false);
            defaultTableMappings1.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)idColumnBase1, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)enum1ColumnBase0, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)enum2ColumnBase0, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)flagsEnum1ColumnBase0, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)flagsEnum2ColumnBase0, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)principalBaseIdColumnBase0, principalDerived.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)principalDerivedDependentBasebyteIdColumnBase0, principalDerived.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)refTypeArrayColumnBase0, principalDerived.FindProperty("RefTypeArray")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)refTypeEnumerableColumnBase0, principalDerived.FindProperty("RefTypeEnumerable")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)refTypeIListColumnBase0, principalDerived.FindProperty("RefTypeIList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)refTypeListColumnBase0, principalDerived.FindProperty("RefTypeList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)valueTypeArrayColumnBase0, principalDerived.FindProperty("ValueTypeArray")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)valueTypeEnumerableColumnBase0, principalDerived.FindProperty("ValueTypeEnumerable")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)valueTypeIListColumnBase0, principalDerived.FindProperty("ValueTypeIList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);
            RelationalModel.CreateColumnMapping((ColumnBase<ColumnMappingBase>)valueTypeListColumnBase0, principalDerived.FindProperty("ValueTypeList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase);

            var tableMappings1 = new List<TableMapping>();
            principalDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1);
            var principalDerivedTable = new Table("PrincipalDerived", "TPC", relationalModel);
            var idColumn1 = new Column("Id", "bigint", principalDerivedTable);
            principalDerivedTable.Columns.Add("Id", idColumn1);
            idColumn1.Accessors = ColumnAccessorsFactory.CreateGeneric<long>(idColumn1);
            var enum1Column0 = new Column("Enum1", "int", principalDerivedTable);
            principalDerivedTable.Columns.Add("Enum1", enum1Column0);
            enum1Column0.Accessors = ColumnAccessorsFactory.CreateGeneric<int>(enum1Column0);
            var enum2Column0 = new Column("Enum2", "int", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("Enum2", enum2Column0);
            enum2Column0.Accessors = ColumnAccessorsFactory.CreateGeneric<int>(enum2Column0);
            var flagsEnum1Column0 = new Column("FlagsEnum1", "int", principalDerivedTable);
            principalDerivedTable.Columns.Add("FlagsEnum1", flagsEnum1Column0);
            flagsEnum1Column0.Accessors = ColumnAccessorsFactory.CreateGeneric<int>(flagsEnum1Column0);
            var flagsEnum2Column0 = new Column("FlagsEnum2", "int", principalDerivedTable);
            principalDerivedTable.Columns.Add("FlagsEnum2", flagsEnum2Column0);
            flagsEnum2Column0.Accessors = ColumnAccessorsFactory.CreateGeneric<int>(flagsEnum2Column0);
            var principalBaseIdColumn0 = new Column("PrincipalBaseId", "bigint", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("PrincipalBaseId", principalBaseIdColumn0);
            principalBaseIdColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<long>(principalBaseIdColumn0);
            var principalDerivedDependentBasebyteIdColumn0 = new Column("PrincipalDerived<DependentBase<byte?>>Id", "bigint", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("PrincipalDerived<DependentBase<byte?>>Id", principalDerivedDependentBasebyteIdColumn0);
            principalDerivedDependentBasebyteIdColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<long>(principalDerivedDependentBasebyteIdColumn0);
            var refTypeArrayColumn0 = new Column("RefTypeArray", "nvarchar(max)", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("RefTypeArray", refTypeArrayColumn0);
            refTypeArrayColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(refTypeArrayColumn0);
            var refTypeEnumerableColumn0 = new Column("RefTypeEnumerable", "nvarchar(max)", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("RefTypeEnumerable", refTypeEnumerableColumn0);
            refTypeEnumerableColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(refTypeEnumerableColumn0);
            var refTypeIListColumn0 = new Column("RefTypeIList", "nvarchar(max)", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("RefTypeIList", refTypeIListColumn0);
            refTypeIListColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(refTypeIListColumn0);
            var refTypeListColumn0 = new Column("RefTypeList", "nvarchar(max)", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("RefTypeList", refTypeListColumn0);
            refTypeListColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(refTypeListColumn0);
            var valueTypeArrayColumn0 = new Column("ValueTypeArray", "nvarchar(max)", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("ValueTypeArray", valueTypeArrayColumn0);
            valueTypeArrayColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(valueTypeArrayColumn0);
            var valueTypeEnumerableColumn0 = new Column("ValueTypeEnumerable", "nvarchar(max)", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableColumn0);
            valueTypeEnumerableColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(valueTypeEnumerableColumn0);
            var valueTypeIListColumn0 = new Column("ValueTypeIList", "nvarchar(max)", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("ValueTypeIList", valueTypeIListColumn0);
            valueTypeIListColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(valueTypeIListColumn0);
            var valueTypeListColumn0 = new Column("ValueTypeList", "nvarchar(max)", principalDerivedTable)
            {
                IsNullable = true
            };
            principalDerivedTable.Columns.Add("ValueTypeList", valueTypeListColumn0);
            valueTypeListColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric<string>(valueTypeListColumn0);
            relationalModel.Tables.Add(("PrincipalDerived", "TPC"), principalDerivedTable);
            var principalDerivedTableMapping = new TableMapping(principalDerived, principalDerivedTable, null);
            principalDerivedTable.AddTypeMapping(principalDerivedTableMapping, false);
            tableMappings1.Add(principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(idColumn1, principalDerived.FindProperty("Id")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(enum1Column0, principalDerived.FindProperty("Enum1")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(enum2Column0, principalDerived.FindProperty("Enum2")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(flagsEnum1Column0, principalDerived.FindProperty("FlagsEnum1")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(flagsEnum2Column0, principalDerived.FindProperty("FlagsEnum2")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(principalBaseIdColumn0, principalDerived.FindProperty("PrincipalBaseId")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(principalDerivedDependentBasebyteIdColumn0, principalDerived.FindProperty("PrincipalDerivedId")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(refTypeArrayColumn0, principalDerived.FindProperty("RefTypeArray")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(refTypeEnumerableColumn0, principalDerived.FindProperty("RefTypeEnumerable")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(refTypeIListColumn0, principalDerived.FindProperty("RefTypeIList")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(refTypeListColumn0, principalDerived.FindProperty("RefTypeList")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(valueTypeArrayColumn0, principalDerived.FindProperty("ValueTypeArray")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(valueTypeEnumerableColumn0, principalDerived.FindProperty("ValueTypeEnumerable")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(valueTypeIListColumn0, principalDerived.FindProperty("ValueTypeIList")!, principalDerivedTableMapping);
            RelationalModel.CreateColumnMapping(valueTypeListColumn0, principalDerived.FindProperty("ValueTypeList")!, principalDerivedTableMapping);
            var pK_PrincipalDerived = new UniqueConstraint("PK_PrincipalDerived", principalDerivedTable, new[] { idColumn1 });
            principalDerivedTable.PrimaryKey = pK_PrincipalDerived;
            pK_PrincipalDerived.SetRowKeyValueFactory(new SimpleRowKeyValueFactory<long>(pK_PrincipalDerived));
            pK_PrincipalDerived.MappedKeys.Add(pK_PrincipalBaseKey);
            RelationalModel.GetOrCreateUniqueConstraints(pK_PrincipalBaseKey).Add(pK_PrincipalDerived);
            principalDerivedTable.UniqueConstraints.Add("PK_PrincipalDerived", pK_PrincipalDerived);
            var iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId = new TableIndex(
            "IX_PrincipalDerived_PrincipalDerived<DependentBase<byte?>>Id", principalDerivedTable, new[] { principalDerivedDependentBasebyteIdColumn0 }, false);
            iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId.SetRowIndexValueFactory(new SimpleRowIndexValueFactory<long>(iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId));
            iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId.MappedIndexes.Add(iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx);
            RelationalModel.GetOrCreateTableIndexes(iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx).Add(iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId);
            principalDerivedTable.Indexes.Add("IX_PrincipalDerived_PrincipalDerived<DependentBase<byte?>>Id", iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId);
            var pIX0 = new TableIndex(
            "PIX", principalDerivedTable, new[] { principalBaseIdColumn0 }, true);
            pIX0.SetRowIndexValueFactory(new SimpleRowIndexValueFactory<long>(pIX0));
            pIX0.MappedIndexes.Add(pIXIx);
            RelationalModel.GetOrCreateTableIndexes(pIXIx).Add(pIX0);
            principalDerivedTable.Indexes.Add("PIX", pIX0);

            var viewMappings0 = new List<ViewMapping>();
            principalDerived.SetRuntimeAnnotation("Relational:ViewMappings", viewMappings0);
            var principalDerivedViewView = new View("PrincipalDerivedView", "TPC", relationalModel);
            var enum1ViewColumn0 = new ViewColumn("Enum1", "int", principalDerivedViewView);
            principalDerivedViewView.Columns.Add("Enum1", enum1ViewColumn0);
            var enum2ViewColumn0 = new ViewColumn("Enum2", "int", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("Enum2", enum2ViewColumn0);
            var flagsEnum1ViewColumn0 = new ViewColumn("FlagsEnum1", "int", principalDerivedViewView);
            principalDerivedViewView.Columns.Add("FlagsEnum1", flagsEnum1ViewColumn0);
            var flagsEnum2ViewColumn0 = new ViewColumn("FlagsEnum2", "int", principalDerivedViewView);
            principalDerivedViewView.Columns.Add("FlagsEnum2", flagsEnum2ViewColumn0);
            var idViewColumn0 = new ViewColumn("Id", "bigint", principalDerivedViewView);
            principalDerivedViewView.Columns.Add("Id", idViewColumn0);
            var principalBaseIdViewColumn0 = new ViewColumn("PrincipalBaseId", "bigint", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("PrincipalBaseId", principalBaseIdViewColumn0);
            var principalDerivedIdViewColumn0 = new ViewColumn("PrincipalDerivedId", "bigint", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("PrincipalDerivedId", principalDerivedIdViewColumn0);
            var refTypeArrayViewColumn0 = new ViewColumn("RefTypeArray", "nvarchar(max)", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("RefTypeArray", refTypeArrayViewColumn0);
            var refTypeEnumerableViewColumn0 = new ViewColumn("RefTypeEnumerable", "nvarchar(max)", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("RefTypeEnumerable", refTypeEnumerableViewColumn0);
            var refTypeIListViewColumn0 = new ViewColumn("RefTypeIList", "nvarchar(max)", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("RefTypeIList", refTypeIListViewColumn0);
            var refTypeListViewColumn0 = new ViewColumn("RefTypeList", "nvarchar(max)", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("RefTypeList", refTypeListViewColumn0);
            var valueTypeArrayViewColumn0 = new ViewColumn("ValueTypeArray", "nvarchar(max)", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("ValueTypeArray", valueTypeArrayViewColumn0);
            var valueTypeEnumerableViewColumn0 = new ViewColumn("ValueTypeEnumerable", "nvarchar(max)", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableViewColumn0);
            var valueTypeIListViewColumn0 = new ViewColumn("ValueTypeIList", "nvarchar(max)", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("ValueTypeIList", valueTypeIListViewColumn0);
            var valueTypeListViewColumn0 = new ViewColumn("ValueTypeList", "nvarchar(max)", principalDerivedViewView)
            {
                IsNullable = true
            };
            principalDerivedViewView.Columns.Add("ValueTypeList", valueTypeListViewColumn0);
            relationalModel.Views.Add(("PrincipalDerivedView", "TPC"), principalDerivedViewView);
            var principalDerivedViewViewMapping = new ViewMapping(principalDerived, principalDerivedViewView, null);
            principalDerivedViewView.AddTypeMapping(principalDerivedViewViewMapping, false);
            viewMappings0.Add(principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(idViewColumn0, principalDerived.FindProperty("Id")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(enum1ViewColumn0, principalDerived.FindProperty("Enum1")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(enum2ViewColumn0, principalDerived.FindProperty("Enum2")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(flagsEnum1ViewColumn0, principalDerived.FindProperty("FlagsEnum1")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(flagsEnum2ViewColumn0, principalDerived.FindProperty("FlagsEnum2")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(principalBaseIdViewColumn0, principalDerived.FindProperty("PrincipalBaseId")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(principalDerivedIdViewColumn0, principalDerived.FindProperty("PrincipalDerivedId")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(refTypeArrayViewColumn0, principalDerived.FindProperty("RefTypeArray")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(refTypeEnumerableViewColumn0, principalDerived.FindProperty("RefTypeEnumerable")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(refTypeIListViewColumn0, principalDerived.FindProperty("RefTypeIList")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(refTypeListViewColumn0, principalDerived.FindProperty("RefTypeList")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(valueTypeArrayViewColumn0, principalDerived.FindProperty("ValueTypeArray")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(valueTypeEnumerableViewColumn0, principalDerived.FindProperty("ValueTypeEnumerable")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(valueTypeIListViewColumn0, principalDerived.FindProperty("ValueTypeIList")!, principalDerivedViewViewMapping);
            RelationalModel.CreateViewColumnMapping(valueTypeListViewColumn0, principalDerived.FindProperty("ValueTypeList")!, principalDerivedViewViewMapping);

            var deleteSprocMappings0 = new List<StoredProcedureMapping>();
            principalDerived.SetRuntimeAnnotation("Relational:DeleteStoredProcedureMappings", deleteSprocMappings0);
            var derived_DeleteStoreSproc = new StoreStoredProcedure("Derived_Delete", "TPC", relationalModel);
            var id_OriginalParameter1 = new StoreStoredProcedureParameter("Id_Original", "bigint", 0, derived_DeleteStoreSproc, System.Data.ParameterDirection.Input);
            derived_DeleteStoreSproc.AddParameter(id_OriginalParameter1);
            derived_DeleteStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalDerived.GetDeleteStoredProcedure()!);
            relationalModel.StoredProcedures.Add(("Derived_Delete", "TPC"), derived_DeleteStoreSproc);
            var derived_DeleteDSproc = (IRuntimeStoredProcedure)principalDerived.GetDeleteStoredProcedure()!;
            var derived_DeleteSprocMapping = new StoredProcedureMapping(principalDerived, derived_DeleteStoreSproc, derived_DeleteDSproc, principalDerivedTableMapping, null);
            derived_DeleteStoreSproc.AddTypeMapping(derived_DeleteSprocMapping, false);
            deleteSprocMappings0.Add(derived_DeleteSprocMapping);
            principalDerivedTableMapping.DeleteStoredProcedureMapping = derived_DeleteSprocMapping;
            RelationalModel.CreateStoredProcedureParameterMapping(id_OriginalParameter1, derived_DeleteDSproc.FindParameter("Id_Original")!, principalDerived.FindProperty("Id")!, derived_DeleteSprocMapping);

            var insertSprocMappings0 = new List<StoredProcedureMapping>();
            principalDerived.SetRuntimeAnnotation("Relational:InsertStoredProcedureMappings", insertSprocMappings0);
            var derived_InsertStoreSproc = new StoreStoredProcedure("Derived_Insert", "TPC", relationalModel);
            var idParameter0 = new StoreStoredProcedureParameter("Id", "bigint", 0, derived_InsertStoreSproc, System.Data.ParameterDirection.Input);
            derived_InsertStoreSproc.AddParameter(idParameter0);
            var principalBaseIdParameter1 = new StoreStoredProcedureParameter("PrincipalBaseId", "bigint", 1, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(principalBaseIdParameter1);
            var principalDerivedIdParameter1 = new StoreStoredProcedureParameter("PrincipalDerivedId", "bigint", 2, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(principalDerivedIdParameter1);
            var enum2Parameter1 = new StoreStoredProcedureParameter("Enum2", "int", 3, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(enum2Parameter1);
            var flagsEnum1Parameter1 = new StoreStoredProcedureParameter("FlagsEnum1", "int", 4, derived_InsertStoreSproc, System.Data.ParameterDirection.Input);
            derived_InsertStoreSproc.AddParameter(flagsEnum1Parameter1);
            var flagsEnum2Parameter1 = new StoreStoredProcedureParameter("FlagsEnum2", "int", 5, derived_InsertStoreSproc, System.Data.ParameterDirection.Input);
            derived_InsertStoreSproc.AddParameter(flagsEnum2Parameter1);
            var valueTypeListParameter1 = new StoreStoredProcedureParameter("ValueTypeList", "nvarchar(max)", 6, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(valueTypeListParameter1);
            var valueTypeIListParameter1 = new StoreStoredProcedureParameter("ValueTypeIList", "nvarchar(max)", 7, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(valueTypeIListParameter1);
            var valueTypeArrayParameter1 = new StoreStoredProcedureParameter("ValueTypeArray", "nvarchar(max)", 8, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(valueTypeArrayParameter1);
            var valueTypeEnumerableParameter1 = new StoreStoredProcedureParameter("ValueTypeEnumerable", "nvarchar(max)", 9, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(valueTypeEnumerableParameter1);
            var refTypeListParameter1 = new StoreStoredProcedureParameter("RefTypeList", "nvarchar(max)", 10, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(refTypeListParameter1);
            var refTypeIListParameter1 = new StoreStoredProcedureParameter("RefTypeIList", "nvarchar(max)", 11, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(refTypeIListParameter1);
            var refTypeArrayParameter1 = new StoreStoredProcedureParameter("RefTypeArray", "nvarchar(max)", 12, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(refTypeArrayParameter1);
            var refTypeEnumerableParameter1 = new StoreStoredProcedureParameter("RefTypeEnumerable", "nvarchar(max)", 13, derived_InsertStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_InsertStoreSproc.AddParameter(refTypeEnumerableParameter1);
            var derivedEnumFunctionColumn = new StoreStoredProcedureResultColumn("DerivedEnum", "int", 0, derived_InsertStoreSproc);
            derived_InsertStoreSproc.AddResultColumn(derivedEnumFunctionColumn);
            derived_InsertStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalDerived.GetInsertStoredProcedure()!);
            relationalModel.StoredProcedures.Add(("Derived_Insert", "TPC"), derived_InsertStoreSproc);
            var derived_InsertISproc = (IRuntimeStoredProcedure)principalDerived.GetInsertStoredProcedure()!;
            var derived_InsertSprocMapping = new StoredProcedureMapping(principalDerived, derived_InsertStoreSproc, derived_InsertISproc, principalDerivedTableMapping, null);
            derived_InsertStoreSproc.AddTypeMapping(derived_InsertSprocMapping, false);
            insertSprocMappings0.Add(derived_InsertSprocMapping);
            principalDerivedTableMapping.InsertStoredProcedureMapping = derived_InsertSprocMapping;
            RelationalModel.CreateStoredProcedureParameterMapping(idParameter0, derived_InsertISproc.FindParameter("Id")!, principalDerived.FindProperty("Id")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(enum2Parameter1, derived_InsertISproc.FindParameter("Enum2")!, principalDerived.FindProperty("Enum2")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum1Parameter1, derived_InsertISproc.FindParameter("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum2Parameter1, derived_InsertISproc.FindParameter("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(principalBaseIdParameter1, derived_InsertISproc.FindParameter("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(principalDerivedIdParameter1, derived_InsertISproc.FindParameter("PrincipalDerivedId")!, principalDerived.FindProperty("PrincipalDerivedId")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeArrayParameter1, derived_InsertISproc.FindParameter("RefTypeArray")!, principalDerived.FindProperty("RefTypeArray")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeEnumerableParameter1, derived_InsertISproc.FindParameter("RefTypeEnumerable")!, principalDerived.FindProperty("RefTypeEnumerable")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeIListParameter1, derived_InsertISproc.FindParameter("RefTypeIList")!, principalDerived.FindProperty("RefTypeIList")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeListParameter1, derived_InsertISproc.FindParameter("RefTypeList")!, principalDerived.FindProperty("RefTypeList")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeArrayParameter1, derived_InsertISproc.FindParameter("ValueTypeArray")!, principalDerived.FindProperty("ValueTypeArray")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeEnumerableParameter1, derived_InsertISproc.FindParameter("ValueTypeEnumerable")!, principalDerived.FindProperty("ValueTypeEnumerable")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeIListParameter1, derived_InsertISproc.FindParameter("ValueTypeIList")!, principalDerived.FindProperty("ValueTypeIList")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeListParameter1, derived_InsertISproc.FindParameter("ValueTypeList")!, principalDerived.FindProperty("ValueTypeList")!, derived_InsertSprocMapping);
            RelationalModel.CreateStoredProcedureResultColumnMapping(derivedEnumFunctionColumn, derived_InsertISproc.FindResultColumn("DerivedEnum")!, principalDerived.FindProperty("Enum1")!, derived_InsertSprocMapping);

            var updateSprocMappings0 = new List<StoredProcedureMapping>();
            principalDerived.SetRuntimeAnnotation("Relational:UpdateStoredProcedureMappings", updateSprocMappings0);
            var derived_UpdateStoreSproc = new StoreStoredProcedure("Derived_Update", "Derived", relationalModel);
            var principalBaseIdParameter2 = new StoreStoredProcedureParameter("PrincipalBaseId", "bigint", 0, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(principalBaseIdParameter2);
            var principalDerivedIdParameter2 = new StoreStoredProcedureParameter("PrincipalDerivedId", "bigint", 1, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(principalDerivedIdParameter2);
            var enum1Parameter0 = new StoreStoredProcedureParameter("Enum1", "int", 2, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input);
            derived_UpdateStoreSproc.AddParameter(enum1Parameter0);
            var enum2Parameter2 = new StoreStoredProcedureParameter("Enum2", "int", 3, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(enum2Parameter2);
            var flagsEnum1Parameter2 = new StoreStoredProcedureParameter("FlagsEnum1", "int", 4, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input);
            derived_UpdateStoreSproc.AddParameter(flagsEnum1Parameter2);
            var flagsEnum2Parameter2 = new StoreStoredProcedureParameter("FlagsEnum2", "int", 5, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input);
            derived_UpdateStoreSproc.AddParameter(flagsEnum2Parameter2);
            var valueTypeListParameter2 = new StoreStoredProcedureParameter("ValueTypeList", "nvarchar(max)", 6, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(valueTypeListParameter2);
            var valueTypeIListParameter2 = new StoreStoredProcedureParameter("ValueTypeIList", "nvarchar(max)", 7, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(valueTypeIListParameter2);
            var valueTypeArrayParameter2 = new StoreStoredProcedureParameter("ValueTypeArray", "nvarchar(max)", 8, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(valueTypeArrayParameter2);
            var valueTypeEnumerableParameter2 = new StoreStoredProcedureParameter("ValueTypeEnumerable", "nvarchar(max)", 9, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(valueTypeEnumerableParameter2);
            var refTypeListParameter2 = new StoreStoredProcedureParameter("RefTypeList", "nvarchar(max)", 10, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(refTypeListParameter2);
            var refTypeIListParameter2 = new StoreStoredProcedureParameter("RefTypeIList", "nvarchar(max)", 11, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(refTypeIListParameter2);
            var refTypeArrayParameter2 = new StoreStoredProcedureParameter("RefTypeArray", "nvarchar(max)", 12, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(refTypeArrayParameter2);
            var refTypeEnumerableParameter2 = new StoreStoredProcedureParameter("RefTypeEnumerable", "nvarchar(max)", 13, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input)
            {
                IsNullable = true
            };
            derived_UpdateStoreSproc.AddParameter(refTypeEnumerableParameter2);
            var id_OriginalParameter2 = new StoreStoredProcedureParameter("Id_Original", "bigint", 14, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input);
            derived_UpdateStoreSproc.AddParameter(id_OriginalParameter2);
            derived_UpdateStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalDerived.GetUpdateStoredProcedure()!);
            relationalModel.StoredProcedures.Add(("Derived_Update", "Derived"), derived_UpdateStoreSproc);
            var derived_UpdateUSproc = (IRuntimeStoredProcedure)principalDerived.GetUpdateStoredProcedure()!;
            var derived_UpdateSprocMapping = new StoredProcedureMapping(principalDerived, derived_UpdateStoreSproc, derived_UpdateUSproc, principalDerivedTableMapping, null);
            derived_UpdateStoreSproc.AddTypeMapping(derived_UpdateSprocMapping, false);
            updateSprocMappings0.Add(derived_UpdateSprocMapping);
            principalDerivedTableMapping.UpdateStoredProcedureMapping = derived_UpdateSprocMapping;
            RelationalModel.CreateStoredProcedureParameterMapping(id_OriginalParameter2, derived_UpdateUSproc.FindParameter("Id_Original")!, principalDerived.FindProperty("Id")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(enum1Parameter0, derived_UpdateUSproc.FindParameter("Enum1")!, principalDerived.FindProperty("Enum1")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(enum2Parameter2, derived_UpdateUSproc.FindParameter("Enum2")!, principalDerived.FindProperty("Enum2")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum1Parameter2, derived_UpdateUSproc.FindParameter("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum2Parameter2, derived_UpdateUSproc.FindParameter("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(principalBaseIdParameter2, derived_UpdateUSproc.FindParameter("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(principalDerivedIdParameter2, derived_UpdateUSproc.FindParameter("PrincipalDerivedId")!, principalDerived.FindProperty("PrincipalDerivedId")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeArrayParameter2, derived_UpdateUSproc.FindParameter("RefTypeArray")!, principalDerived.FindProperty("RefTypeArray")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeEnumerableParameter2, derived_UpdateUSproc.FindParameter("RefTypeEnumerable")!, principalDerived.FindProperty("RefTypeEnumerable")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeIListParameter2, derived_UpdateUSproc.FindParameter("RefTypeIList")!, principalDerived.FindProperty("RefTypeIList")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(refTypeListParameter2, derived_UpdateUSproc.FindParameter("RefTypeList")!, principalDerived.FindProperty("RefTypeList")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeArrayParameter2, derived_UpdateUSproc.FindParameter("ValueTypeArray")!, principalDerived.FindProperty("ValueTypeArray")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeEnumerableParameter2, derived_UpdateUSproc.FindParameter("ValueTypeEnumerable")!, principalDerived.FindProperty("ValueTypeEnumerable")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeIListParameter2, derived_UpdateUSproc.FindParameter("ValueTypeIList")!, principalDerived.FindProperty("ValueTypeIList")!, derived_UpdateSprocMapping);
            RelationalModel.CreateStoredProcedureParameterMapping(valueTypeListParameter2, derived_UpdateUSproc.FindParameter("ValueTypeList")!, principalDerived.FindProperty("ValueTypeList")!, derived_UpdateSprocMapping);
            var fK_DependentBasebyte_PrincipalDerived_PrincipalId = new ForeignKeyConstraint(
                "FK_DependentBase<byte?>_PrincipalDerived_PrincipalId", dependentBasebyteTable, principalDerivedTable,
                new[] { principalIdColumn },
                principalDerivedTable.FindUniqueConstraint("PK_PrincipalDerived")!, ReferentialAction.NoAction);
            fK_DependentBasebyte_PrincipalDerived_PrincipalId.SetRowForeignKeyValueFactory(RowForeignKeyValueFactoryFactory.CreateSimpleNonNullableFactory<long, long>(fK_DependentBasebyte_PrincipalDerived_PrincipalId));
            var fK_DependentBasebyte_PrincipalDerived_PrincipalIdFk = RelationalModel.GetForeignKey(this,
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>",
                new[] { "PrincipalId" },
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived<Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>>",
                new[] { "Id" });
            fK_DependentBasebyte_PrincipalDerived_PrincipalId.MappedForeignKeys.Add(fK_DependentBasebyte_PrincipalDerived_PrincipalIdFk);
            RelationalModel.GetOrCreateForeignKeyConstraints(fK_DependentBasebyte_PrincipalDerived_PrincipalIdFk).Add(fK_DependentBasebyte_PrincipalDerived_PrincipalId);
            dependentBasebyteTable.ForeignKeyConstraints.Add(fK_DependentBasebyte_PrincipalDerived_PrincipalId);
            principalDerivedTable.ReferencingForeignKeyConstraints.Add(fK_DependentBasebyte_PrincipalDerived_PrincipalId);
            var fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteId = new ForeignKeyConstraint(
                "FK_PrincipalBase_PrincipalDerived_PrincipalDerived<DependentBase<byte?>>Id", principalBaseTable, principalDerivedTable,
                new[] { principalDerivedDependentBasebyteIdColumn },
                principalDerivedTable.FindUniqueConstraint("PK_PrincipalDerived")!, ReferentialAction.NoAction);
            fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteId.SetRowForeignKeyValueFactory(RowForeignKeyValueFactoryFactory.CreateSimpleNonNullableFactory<long, long>(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteId));
            var fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteIdFk = RelationalModel.GetForeignKey(this,
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase",
                new[] { "PrincipalDerivedId" },
                "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived<Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase<byte?>>",
                new[] { "Id" });
            fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteId.MappedForeignKeys.Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteIdFk);
            RelationalModel.GetOrCreateForeignKeyConstraints(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteIdFk).Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteId);
            principalBaseTable.ForeignKeyConstraints.Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteId);
            principalDerivedTable.ReferencingForeignKeyConstraints.Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteId);
            var fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependentBasebyteId = new ForeignKeyConstraint(
                "FK_PrincipalDerived_PrincipalDerived_PrincipalDerived<DependentBase<byte?>>Id", principalDerivedTable, principalDerivedTable,
                new[] { principalDerivedDependentBasebyteIdColumn0 },
                principalDerivedTable.FindUniqueConstraint("PK_PrincipalDerived")!, ReferentialAction.NoAction);
            fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependentBasebyteId.SetRowForeignKeyValueFactory(RowForeignKeyValueFactoryFactory.CreateSimpleNonNullableFactory<long, long>(fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependentBasebyteId));
            fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependentBasebyteId.MappedForeignKeys.Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteIdFk);
            RelationalModel.GetOrCreateForeignKeyConstraints(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasebyteIdFk).Add(fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependentBasebyteId);
            principalDerivedTable.ForeignKeyConstraints.Add(fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependentBasebyteId);
            principalDerivedTable.ReferencingForeignKeyConstraints.Add(fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependentBasebyteId);
            return relationalModel.MakeReadOnly();
        }
    }
}
