From 1464b445f94e53f0a20bf752bfdc3a096f1cd144 Mon Sep 17 00:00:00 2001 From: Andriy Svyryd Date: Fri, 21 Jul 2023 19:19:34 -0700 Subject: [PATCH] Add NativeAOT support to the compiled relational model Throw when invoking model building or migrations in a NativeAOT context Part of #29761 --- ...nalCSharpRuntimeAnnotationCodeGenerator.cs | 10 +- .../RelationalDatabaseFacadeExtensions.cs | 84 ++- .../Metadata/Internal/Column.cs | 16 +- .../Metadata/Internal/JsonColumn.cs | 5 +- .../Metadata/Internal/UniqueConstraint.cs | 17 +- .../Update/Internal/ColumnAccessorsFactory.cs | 9 +- .../Internal/SqlServerTypeMappingSource.cs | 506 ++++++++++++---- .../Internal/SqliteTypeMappingSource.cs | 35 +- .../ChangeTracking/Internal/Snapshot.cs | 2 +- src/EFCore/Infrastructure/DatabaseFacade.cs | 17 +- src/EFCore/Metadata/RuntimeEntityType.cs | 5 +- src/EFCore/Metadata/RuntimeProperty.cs | 5 +- src/EFCore/Metadata/RuntimePropertyBase.cs | 9 +- src/EFCore/Metadata/RuntimeTypeBase.cs | 21 +- src/EFCore/Properties/CoreStrings.Designer.cs | 6 + src/EFCore/Properties/CoreStrings.resx | 3 + .../CSharpRuntimeModelCodeGeneratorTest.cs | 558 +++++++++--------- .../NativeAotContextModelBuilder.cs | 50 ++ .../CompiledModels/UserEntityType.cs | 4 + test/EFCore.NativeAotTests/EndToEnd.cs | 13 +- 20 files changed, 903 insertions(+), 472 deletions(-) diff --git a/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs b/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs index feffb46ad1c..30fcf6e94b0 100644 --- a/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs +++ b/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs @@ -1128,7 +1128,7 @@ private void Create( { mainBuilder .Append($"RelationalModel.CreateColumnMapping(") - .Append($"(ColumnBase){tableVariable}.FindColumn({code.Literal(columnMapping.Column.Name)})!, ") + .Append($"(ColumnBase){metadataVariables[columnMapping.Column]}, ") .Append($"{typeBaseVariable}.FindProperty({code.Literal(columnMapping.Property.Name)})!, ") .Append(tableMappingVariable).AppendLine(");"); } @@ -1175,7 +1175,7 @@ private void Create( foreach (var columnMapping in tableMapping.ColumnMappings) { mainBuilder - .Append($"RelationalModel.CreateColumnMapping({tableVariable}.FindColumn({code.Literal(columnMapping.Column.Name)})!, ") + .Append($"RelationalModel.CreateColumnMapping({metadataVariables[columnMapping.Column]}, ") .Append($"{typeBaseVariable}.FindProperty({code.Literal(columnMapping.Property.Name)})!, ") .Append(tableMappingVariable).AppendLine(");"); } @@ -1221,7 +1221,7 @@ private void Create( foreach (var columnMapping in viewMapping.ColumnMappings) { mainBuilder - .Append($"RelationalModel.CreateViewColumnMapping({viewVariable}.FindColumn({code.Literal(columnMapping.Column.Name)})!, ") + .Append($"RelationalModel.CreateViewColumnMapping({metadataVariables[columnMapping.Column]}, ") .Append($"{typeBaseVariable}.FindProperty({code.Literal(columnMapping.Property.Name)})!, ") .Append(viewMappingVariable).AppendLine(");"); } @@ -1273,7 +1273,7 @@ private void Create( foreach (var columnMapping in sqlQueryMapping.ColumnMappings) { mainBuilder - .Append($"RelationalModel.CreateSqlQueryColumnMapping({sqlQueryVariable}.FindColumn({code.Literal(columnMapping.Column.Name)})!, ") + .Append($"RelationalModel.CreateSqlQueryColumnMapping({metadataVariables[columnMapping.Column]}, ") .Append($"{typeBaseVariable}.FindProperty({code.Literal(columnMapping.Property.Name)})!, ") .Append(sqlQueryMappingVariable).AppendLine(");"); } @@ -1327,7 +1327,7 @@ private void Create( foreach (var columnMapping in functionMapping.ColumnMappings) { mainBuilder - .Append($"RelationalModel.CreateFunctionColumnMapping({functionVariable}.FindColumn({code.Literal(columnMapping.Column.Name)})!, ") + .Append($"RelationalModel.CreateFunctionColumnMapping({metadataVariables[columnMapping.Column]}, ") .Append($"{typeBaseVariable}.FindProperty({code.Literal(columnMapping.Property.Name)})!, ") .Append(functionMappingVariable).AppendLine(");"); } diff --git a/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs b/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs index 51d2701fbb6..3e0d9ded951 100644 --- a/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs +++ b/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Data; +using System.Runtime.CompilerServices; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore.Query.Internal; @@ -14,23 +15,6 @@ namespace Microsoft.EntityFrameworkCore; /// public static class RelationalDatabaseFacadeExtensions { - /// - /// Applies any pending migrations for the context to the database. Will create the database - /// if it does not already exist. - /// - /// - /// - /// Note that this API is mutually exclusive with . EnsureCreated does not use migrations - /// to create the database and therefore the database that is created cannot be later updated using migrations. - /// - /// - /// See Database migrations for more information and examples. - /// - /// - /// The for the context. - public static void Migrate(this DatabaseFacade databaseFacade) - => databaseFacade.GetRelationalService().Migrate(); - /// /// Gets all the migrations that are defined in the configured migrations assembly. /// @@ -40,7 +24,9 @@ public static void Migrate(this DatabaseFacade databaseFacade) /// The for the context. /// The list of migrations. public static IEnumerable GetMigrations(this DatabaseFacade databaseFacade) - => databaseFacade.GetRelationalService().Migrations.Keys; + => RuntimeFeature.IsDynamicCodeSupported + ? databaseFacade.GetRelationalService().Migrations.Keys + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// Gets all migrations that have been applied to the target database. @@ -51,8 +37,10 @@ public static IEnumerable GetMigrations(this DatabaseFacade databaseFaca /// The for the context. /// The list of migrations. public static IEnumerable GetAppliedMigrations(this DatabaseFacade databaseFacade) - => databaseFacade.GetRelationalService() - .GetAppliedMigrations().Select(hr => hr.MigrationId); + => RuntimeFeature.IsDynamicCodeSupported + ? databaseFacade.GetRelationalService() + .GetAppliedMigrations().Select(hr => hr.MigrationId) + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// Asynchronously gets all migrations that have been applied to the target database. @@ -67,8 +55,10 @@ public static IEnumerable GetAppliedMigrations(this DatabaseFacade datab public static async Task> GetAppliedMigrationsAsync( this DatabaseFacade databaseFacade, CancellationToken cancellationToken = default) - => (await databaseFacade.GetRelationalService() - .GetAppliedMigrationsAsync(cancellationToken).ConfigureAwait(false)).Select(hr => hr.MigrationId); + => RuntimeFeature.IsDynamicCodeSupported + ? (await databaseFacade.GetRelationalService() + .GetAppliedMigrationsAsync(cancellationToken).ConfigureAwait(false)).Select(hr => hr.MigrationId) + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// Gets all migrations that are defined in the assembly but haven't been applied to the target database. @@ -79,7 +69,9 @@ public static async Task> GetAppliedMigrationsAsync( /// The for the context. /// The list of migrations. public static IEnumerable GetPendingMigrations(this DatabaseFacade databaseFacade) - => GetMigrations(databaseFacade).Except(GetAppliedMigrations(databaseFacade)); + => RuntimeFeature.IsDynamicCodeSupported + ? GetMigrations(databaseFacade).Except(GetAppliedMigrations(databaseFacade)) + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// Asynchronously gets all migrations that are defined in the assembly but haven't been applied to the target database. @@ -94,8 +86,36 @@ public static IEnumerable GetPendingMigrations(this DatabaseFacade datab public static async Task> GetPendingMigrationsAsync( this DatabaseFacade databaseFacade, CancellationToken cancellationToken = default) - => GetMigrations(databaseFacade).Except( - await GetAppliedMigrationsAsync(databaseFacade, cancellationToken).ConfigureAwait(false)); + => RuntimeFeature.IsDynamicCodeSupported + ? GetMigrations(databaseFacade).Except( + await GetAppliedMigrationsAsync(databaseFacade, cancellationToken).ConfigureAwait(false)) + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); + + /// + /// Applies any pending migrations for the context to the database. Will create the database + /// if it does not already exist. + /// + /// + /// + /// Note that this API is mutually exclusive with . EnsureCreated does not use migrations + /// to create the database and therefore the database that is created cannot be later updated using migrations. + /// + /// + /// See Database migrations for more information and examples. + /// + /// + /// The for the context. + public static void Migrate(this DatabaseFacade databaseFacade) + { + if (RuntimeFeature.IsDynamicCodeSupported) + { + databaseFacade.GetRelationalService().Migrate(); + } + else + { + throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); + } + } /// /// Asynchronously applies any pending migrations for the context to the database. Will create the database @@ -118,8 +138,9 @@ public static async Task> GetPendingMigrationsAsync( public static Task MigrateAsync( this DatabaseFacade databaseFacade, CancellationToken cancellationToken = default) - => databaseFacade.GetRelationalService() - .MigrateAsync(cancellationToken: cancellationToken); + => RuntimeFeature.IsDynamicCodeSupported + ? databaseFacade.GetRelationalService().MigrateAsync(cancellationToken: cancellationToken) + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// Executes the given SQL against the database and returns the number of rows affected. @@ -938,7 +959,9 @@ public static void SetCommandTimeout(this DatabaseFacade databaseFacade, TimeSpa /// A SQL script. /// public static string GenerateCreateScript(this DatabaseFacade databaseFacade) - => databaseFacade.GetRelationalService().GenerateCreateScript(); + => RuntimeFeature.IsDynamicCodeSupported + ? databaseFacade.GetRelationalService().GenerateCreateScript() + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// Returns if the database provider currently in use is a relational database. @@ -962,6 +985,11 @@ public static bool IsRelational(this DatabaseFacade databaseFacade) /// public static bool HasPendingModelChanges(this DatabaseFacade databaseFacade) { + if (!RuntimeFeature.IsDynamicCodeSupported) + { + throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); + } + var modelDiffer = databaseFacade.GetRelationalService(); var migrationsAssembly = databaseFacade.GetRelationalService(); diff --git a/src/EFCore.Relational/Metadata/Internal/Column.cs b/src/EFCore.Relational/Metadata/Internal/Column.cs index ace07d00b47..34aa66ac7d5 100644 --- a/src/EFCore.Relational/Metadata/Internal/Column.cs +++ b/src/EFCore.Relational/Metadata/Internal/Column.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Update.Internal; @@ -25,11 +26,9 @@ public class Column : ColumnBase, IColumn /// public Column(string name, string type, Table table, RelationalTypeMapping? storeTypeMapping = null, - ValueComparer? providerValueComparer = null, - ColumnAccessors? accessors = null) + ValueComparer? providerValueComparer = null) : base(name, type, table, storeTypeMapping, providerValueComparer) { - _accessors = accessors; } /// @@ -48,9 +47,14 @@ public Column(string name, string type, Table table, /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual ColumnAccessors Accessors - => NonCapturingLazyInitializer.EnsureInitialized( - ref _accessors, this, static column => - ColumnAccessorsFactory.Create(column)); + { + get => NonCapturingLazyInitializer.EnsureInitialized( + ref _accessors, this, static column => + RuntimeFeature.IsDynamicCodeSupported + ? ColumnAccessorsFactory.Create(column) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); + set { _accessors = value; } + } /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to diff --git a/src/EFCore.Relational/Metadata/Internal/JsonColumn.cs b/src/EFCore.Relational/Metadata/Internal/JsonColumn.cs index 21b29feae39..a1a0d2f2c8e 100644 --- a/src/EFCore.Relational/Metadata/Internal/JsonColumn.cs +++ b/src/EFCore.Relational/Metadata/Internal/JsonColumn.cs @@ -22,9 +22,8 @@ public class JsonColumn : Column, IColumn /// public JsonColumn(string name, string type, Table table, RelationalTypeMapping? storeTypeMapping = null, - ValueComparer? providerValueComparer = null, - ColumnAccessors? accessors = null) - : base(name, type, table, storeTypeMapping, providerValueComparer, accessors) + ValueComparer? providerValueComparer = null) + : base(name, type, table, storeTypeMapping, providerValueComparer) { } diff --git a/src/EFCore.Relational/Metadata/Internal/UniqueConstraint.cs b/src/EFCore.Relational/Metadata/Internal/UniqueConstraint.cs index eec6a5c4422..e0c2bf0c069 100644 --- a/src/EFCore.Relational/Metadata/Internal/UniqueConstraint.cs +++ b/src/EFCore.Relational/Metadata/Internal/UniqueConstraint.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Update.Internal; @@ -77,7 +78,21 @@ public override bool IsReadOnly public virtual IRowKeyValueFactory GetRowKeyValueFactory() => NonCapturingLazyInitializer.EnsureInitialized( ref _rowKeyValueFactory, this, - static constraint => constraint.Table.Model.Model.GetRelationalDependencies().RowKeyValueFactoryFactory.Create(constraint)); + static constraint => + RuntimeFeature.IsDynamicCodeSupported + ? constraint.Table.Model.Model.GetRelationalDependencies().RowKeyValueFactoryFactory.Create(constraint) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + + [EntityFrameworkInternal] + public virtual void SetRowKeyValueFactory(IRowKeyValueFactory factory) + => _rowKeyValueFactory = factory; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to diff --git a/src/EFCore.Relational/Update/Internal/ColumnAccessorsFactory.cs b/src/EFCore.Relational/Update/Internal/ColumnAccessorsFactory.cs index cdf4c136b2b..b21a44ab995 100644 --- a/src/EFCore.Relational/Update/Internal/ColumnAccessorsFactory.cs +++ b/src/EFCore.Relational/Update/Internal/ColumnAccessorsFactory.cs @@ -27,8 +27,13 @@ public static ColumnAccessors Create(IColumn column) private static readonly MethodInfo GenericCreate = typeof(ColumnAccessorsFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateGeneric))!; - [UsedImplicitly] - private static ColumnAccessors CreateGeneric(IColumn column) + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static ColumnAccessors CreateGeneric(IColumn column) => new( CreateCurrentValueGetter(column), CreateOriginalValueGetter(column)); diff --git a/src/EFCore.SqlServer/Storage/Internal/SqlServerTypeMappingSource.cs b/src/EFCore.SqlServer/Storage/Internal/SqlServerTypeMappingSource.cs index 2df0ae3570a..6073232f085 100644 --- a/src/EFCore.SqlServer/Storage/Internal/SqlServerTypeMappingSource.cs +++ b/src/EFCore.SqlServer/Storage/Internal/SqlServerTypeMappingSource.cs @@ -16,25 +16,67 @@ namespace Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; /// public class SqlServerTypeMappingSource : RelationalTypeMappingSource { - private readonly RelationalTypeMapping _sqlVariant + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly RelationalTypeMapping SqlVariant = new SqlServerSqlVariantTypeMapping("sql_variant"); - private readonly FloatTypeMapping _real + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly FloatTypeMapping Real = new SqlServerFloatTypeMapping("real"); - private readonly FloatTypeMapping _realAlias + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly FloatTypeMapping RealAlias = new SqlServerFloatTypeMapping("placeholder", storeTypePostfix: StoreTypePostfix.None); - private readonly ByteTypeMapping _byte + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly ByteTypeMapping Byte = new SqlServerByteTypeMapping("tinyint"); - private readonly ShortTypeMapping _short + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly ShortTypeMapping Short = new SqlServerShortTypeMapping("smallint"); - private readonly LongTypeMapping _long + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly LongTypeMapping Long = new SqlServerLongTypeMapping("bigint"); - private readonly SqlServerByteArrayTypeMapping _rowversion + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerByteArrayTypeMapping Rowversion = new( "rowversion", size: 8, @@ -44,7 +86,13 @@ private readonly SqlServerByteArrayTypeMapping _rowversion v => v.ToArray()), storeTypePostfix: StoreTypePostfix.None); - private readonly SqlServerLongTypeMapping _longRowversion + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerLongTypeMapping LongRowversion = new( "rowversion", converter: new NumberToBytesConverter(), @@ -54,7 +102,13 @@ private readonly SqlServerLongTypeMapping _longRowversion v => v.ToArray()), dbType: DbType.Binary); - private readonly SqlServerLongTypeMapping _ulongRowversion + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerLongTypeMapping UlongRowversion = new( "rowversion", converter: new NumberToBytesConverter(), @@ -64,110 +118,320 @@ private readonly SqlServerLongTypeMapping _ulongRowversion v => v.ToArray()), dbType: DbType.Binary); - private readonly IntTypeMapping _int + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly IntTypeMapping Int = new("int"); - private readonly BoolTypeMapping _bool + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly BoolTypeMapping Bool = new SqlServerBoolTypeMapping("bit"); - private readonly SqlServerStringTypeMapping _fixedLengthUnicodeString + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping FixedLengthUnicodeString = new(unicode: true, fixedLength: true); - private readonly SqlServerStringTypeMapping _textUnicodeString + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping TextUnicodeString = new("ntext", unicode: true, sqlDbType: SqlDbType.NText, storeTypePostfix: StoreTypePostfix.None); - private readonly SqlServerStringTypeMapping _variableLengthUnicodeString + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping VariableLengthUnicodeString = new(unicode: true); - private readonly SqlServerStringTypeMapping _variableLengthMaxUnicodeString + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping VariableLengthMaxUnicodeString = new("nvarchar(max)", unicode: true, storeTypePostfix: StoreTypePostfix.None); - private readonly SqlServerStringTypeMapping _fixedLengthAnsiString + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping FixedLengthAnsiString = new(fixedLength: true); - private readonly SqlServerStringTypeMapping _textAnsiString + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping TextAnsiString = new("text", sqlDbType: SqlDbType.Text, storeTypePostfix: StoreTypePostfix.None); - private readonly SqlServerStringTypeMapping _variableLengthAnsiString + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping VariableLengthAnsiString = new(); - private readonly SqlServerStringTypeMapping _variableLengthMaxAnsiString + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping VariableLengthMaxAnsiString = new("varchar(max)", storeTypePostfix: StoreTypePostfix.None); - private readonly SqlServerByteArrayTypeMapping _variableLengthBinary + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerByteArrayTypeMapping VariableLengthBinary = new(); - private readonly SqlServerByteArrayTypeMapping _imageBinary + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerByteArrayTypeMapping ImageBinary = new("image", sqlDbType: SqlDbType.Image); - private readonly SqlServerByteArrayTypeMapping _variableLengthMaxBinary + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerByteArrayTypeMapping VariableLengthMaxBinary = new("varbinary(max)", storeTypePostfix: StoreTypePostfix.None); - private readonly SqlServerByteArrayTypeMapping _fixedLengthBinary + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerByteArrayTypeMapping FixedLengthBinary = new(fixedLength: true); - private readonly SqlServerDateOnlyTypeMapping _dateAsDateOnly + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerDateOnlyTypeMapping DateAsDateOnly = new("date"); - private readonly SqlServerDateTimeTypeMapping _dateAsDateTime + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerDateTimeTypeMapping DateAsDateTime = new("date", DbType.Date); - private readonly SqlServerDateTimeTypeMapping _smallDatetime + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerDateTimeTypeMapping SmallDatetime = new("smalldatetime", DbType.DateTime, SqlDbType.SmallDateTime); - private readonly SqlServerDateTimeTypeMapping _datetime + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerDateTimeTypeMapping Datetime = new("datetime", DbType.DateTime); - private readonly SqlServerDateTimeTypeMapping _datetime2 + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerDateTimeTypeMapping Datetime2 = new("datetime2", DbType.DateTime2); - private readonly SqlServerDateTimeTypeMapping _datetime2Alias + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerDateTimeTypeMapping Datetime2Alias = new("placeholder", DbType.DateTime2, null, StoreTypePostfix.None); - private readonly DoubleTypeMapping _double + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly DoubleTypeMapping Double = new SqlServerDoubleTypeMapping("float"); - private readonly DoubleTypeMapping _doubleAlias + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly DoubleTypeMapping DoubleAlias = new SqlServerDoubleTypeMapping("placeholder", storeTypePostfix: StoreTypePostfix.None); - private readonly SqlServerDateTimeOffsetTypeMapping _datetimeoffset + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerDateTimeOffsetTypeMapping Datetimeoffset = new("datetimeoffset"); - private readonly SqlServerDateTimeOffsetTypeMapping _datetimeoffsetAlias + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerDateTimeOffsetTypeMapping DatetimeoffsetAlias = new("placeholder", DbType.DateTimeOffset, StoreTypePostfix.None); - private readonly GuidTypeMapping _uniqueidentifier + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly GuidTypeMapping Uniqueidentifier = new("uniqueidentifier"); - private readonly DecimalTypeMapping _decimal + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly DecimalTypeMapping Decimal = new SqlServerDecimalTypeMapping("decimal", precision: 18, scale: 0); - private readonly DecimalTypeMapping _decimalAlias + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly DecimalTypeMapping DecimalAlias = new SqlServerDecimalTypeMapping("placeholder", precision: 18, scale: 2, storeTypePostfix: StoreTypePostfix.None); - private readonly DecimalTypeMapping _decimal182 + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly DecimalTypeMapping Decimal182 = new SqlServerDecimalTypeMapping("decimal(18, 2)", precision: 18, scale: 2); - private readonly DecimalTypeMapping _money + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly DecimalTypeMapping Money = new SqlServerDecimalTypeMapping("money", DbType.Currency, sqlDbType: SqlDbType.Money, storeTypePostfix: StoreTypePostfix.None); - private readonly DecimalTypeMapping _smallMoney + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly DecimalTypeMapping SmallMoney = new SqlServerDecimalTypeMapping( "smallmoney", DbType.Currency, sqlDbType: SqlDbType.SmallMoney, storeTypePostfix: StoreTypePostfix.None); - private readonly TimeSpanTypeMapping _timeAsTimeSpan + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly TimeSpanTypeMapping TimeAsTimeSpan = new SqlServerTimeSpanTypeMapping("time"); - private readonly TimeOnlyTypeMapping _timeAsTimeOnly + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly TimeOnlyTypeMapping TimeAsTimeOnly = new SqlServerTimeOnlyTypeMapping("time"); - private readonly TimeOnlyTypeMapping _timeAlias + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly TimeOnlyTypeMapping TimeAlias = new SqlServerTimeOnlyTypeMapping("placeholder", StoreTypePostfix.None); - private readonly SqlServerStringTypeMapping _xml + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerStringTypeMapping Xml = new("xml", unicode: true, storeTypePostfix: StoreTypePostfix.None); - private readonly SqlServerJsonTypeMapping _json + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqlServerJsonTypeMapping Json = new("nvarchar(max)"); private readonly Dictionary _clrTypeMappings; @@ -191,85 +455,85 @@ public SqlServerTypeMappingSource( _clrTypeMappings = new Dictionary { - { typeof(int), _int }, - { typeof(long), _long }, - { typeof(DateOnly), _dateAsDateOnly }, - { typeof(DateTime), _datetime2 }, - { typeof(Guid), _uniqueidentifier }, - { typeof(bool), _bool }, - { typeof(byte), _byte }, - { typeof(double), _double }, - { typeof(DateTimeOffset), _datetimeoffset }, - { typeof(short), _short }, - { typeof(float), _real }, - { typeof(decimal), _decimal182 }, - { typeof(TimeOnly), _timeAsTimeOnly }, - { typeof(TimeSpan), _timeAsTimeSpan }, - { typeof(JsonElement), _json } + { typeof(int), Int }, + { typeof(long), Long }, + { typeof(DateOnly), DateAsDateOnly }, + { typeof(DateTime), Datetime2 }, + { typeof(Guid), Uniqueidentifier }, + { typeof(bool), Bool }, + { typeof(byte), Byte }, + { typeof(double), Double }, + { typeof(DateTimeOffset), Datetimeoffset }, + { typeof(short), Short }, + { typeof(float), Real }, + { typeof(decimal), Decimal182 }, + { typeof(TimeOnly), TimeAsTimeOnly }, + { typeof(TimeSpan), TimeAsTimeSpan }, + { typeof(JsonElement), Json } }; _clrNoFacetTypeMappings = new Dictionary { - { typeof(DateTime), _datetime2Alias }, - { typeof(DateTimeOffset), _datetimeoffsetAlias }, - { typeof(TimeOnly), _timeAlias }, - { typeof(double), _doubleAlias }, - { typeof(float), _realAlias }, - { typeof(decimal), _decimalAlias } + { typeof(DateTime), Datetime2Alias }, + { typeof(DateTimeOffset), DatetimeoffsetAlias }, + { typeof(TimeOnly), TimeAlias }, + { typeof(double), DoubleAlias }, + { typeof(float), RealAlias }, + { typeof(decimal), DecimalAlias } }; // ReSharper disable CoVariantArrayConversion _storeTypeMappings = new Dictionary(StringComparer.OrdinalIgnoreCase) { - { "bigint", new[] { _long } }, - { "binary varying", new[] { _variableLengthBinary } }, - { "binary", new[] { _fixedLengthBinary } }, - { "bit", new[] { _bool } }, - { "char varying", new[] { _variableLengthAnsiString } }, - { "char varying(max)", new[] { _variableLengthMaxAnsiString } }, - { "char", new[] { _fixedLengthAnsiString } }, - { "character varying", new[] { _variableLengthAnsiString } }, - { "character varying(max)", new[] { _variableLengthMaxAnsiString } }, - { "character", new[] { _fixedLengthAnsiString } }, - { "date", new RelationalTypeMapping[] { _dateAsDateOnly, _dateAsDateTime } }, - { "datetime", new[] { _datetime } }, - { "datetime2", new[] { _datetime2 } }, - { "datetimeoffset", new[] { _datetimeoffset } }, - { "dec", new[] { _decimal } }, - { "decimal", new[] { _decimal } }, - { "double precision", new[] { _double } }, - { "float", new[] { _double } }, - { "image", new[] { _imageBinary } }, - { "int", new[] { _int } }, - { "money", new[] { _money } }, - { "national char varying", new[] { _variableLengthUnicodeString } }, - { "national char varying(max)", new[] { _variableLengthMaxUnicodeString } }, - { "national character varying", new[] { _variableLengthUnicodeString } }, - { "national character varying(max)", new[] { _variableLengthMaxUnicodeString } }, - { "national character", new[] { _fixedLengthUnicodeString } }, - { "nchar", new[] { _fixedLengthUnicodeString } }, - { "ntext", new[] { _textUnicodeString } }, - { "numeric", new[] { _decimal } }, - { "nvarchar", new[] { _variableLengthUnicodeString } }, - { "nvarchar(max)", new[] { _variableLengthMaxUnicodeString } }, - { "real", new[] { _real } }, - { "rowversion", new[] { _rowversion } }, - { "smalldatetime", new[] { _smallDatetime } }, - { "smallint", new[] { _short } }, - { "smallmoney", new[] { _smallMoney } }, - { "sql_variant", new[] { _sqlVariant } }, - { "text", new[] { _textAnsiString } }, - { "time", new RelationalTypeMapping[] { _timeAsTimeOnly, _timeAsTimeSpan } }, - { "timestamp", new[] { _rowversion } }, - { "tinyint", new[] { _byte } }, - { "uniqueidentifier", new[] { _uniqueidentifier } }, - { "varbinary", new[] { _variableLengthBinary } }, - { "varbinary(max)", new[] { _variableLengthMaxBinary } }, - { "varchar", new[] { _variableLengthAnsiString } }, - { "varchar(max)", new[] { _variableLengthMaxAnsiString } }, - { "xml", new[] { _xml } } + { "bigint", new[] { Long } }, + { "binary varying", new[] { VariableLengthBinary } }, + { "binary", new[] { FixedLengthBinary } }, + { "bit", new[] { Bool } }, + { "char varying", new[] { VariableLengthAnsiString } }, + { "char varying(max)", new[] { VariableLengthMaxAnsiString } }, + { "char", new[] { FixedLengthAnsiString } }, + { "character varying", new[] { VariableLengthAnsiString } }, + { "character varying(max)", new[] { VariableLengthMaxAnsiString } }, + { "character", new[] { FixedLengthAnsiString } }, + { "date", new RelationalTypeMapping[] { DateAsDateOnly, DateAsDateTime } }, + { "datetime", new[] { Datetime } }, + { "datetime2", new[] { Datetime2 } }, + { "datetimeoffset", new[] { Datetimeoffset } }, + { "dec", new[] { Decimal } }, + { "decimal", new[] { Decimal } }, + { "double precision", new[] { Double } }, + { "float", new[] { Double } }, + { "image", new[] { ImageBinary } }, + { "int", new[] { Int } }, + { "money", new[] { Money } }, + { "national char varying", new[] { VariableLengthUnicodeString } }, + { "national char varying(max)", new[] { VariableLengthMaxUnicodeString } }, + { "national character varying", new[] { VariableLengthUnicodeString } }, + { "national character varying(max)", new[] { VariableLengthMaxUnicodeString } }, + { "national character", new[] { FixedLengthUnicodeString } }, + { "nchar", new[] { FixedLengthUnicodeString } }, + { "ntext", new[] { TextUnicodeString } }, + { "numeric", new[] { Decimal } }, + { "nvarchar", new[] { VariableLengthUnicodeString } }, + { "nvarchar(max)", new[] { VariableLengthMaxUnicodeString } }, + { "real", new[] { Real } }, + { "rowversion", new[] { Rowversion } }, + { "smalldatetime", new[] { SmallDatetime } }, + { "smallint", new[] { Short } }, + { "smallmoney", new[] { SmallMoney } }, + { "sql_variant", new[] { SqlVariant } }, + { "text", new[] { TextAnsiString } }, + { "time", new RelationalTypeMapping[] { TimeAsTimeOnly, TimeAsTimeSpan } }, + { "timestamp", new[] { Rowversion } }, + { "tinyint", new[] { Byte } }, + { "uniqueidentifier", new[] { Uniqueidentifier } }, + { "varbinary", new[] { VariableLengthBinary } }, + { "varbinary(max)", new[] { VariableLengthMaxBinary } }, + { "varchar", new[] { VariableLengthAnsiString } }, + { "varchar(max)", new[] { VariableLengthMaxAnsiString } }, + { "xml", new[] { Xml } } }; // ReSharper restore CoVariantArrayConversion } @@ -303,7 +567,7 @@ public SqlServerTypeMappingSource( && (storeTypeNameBase.Equals("float", StringComparison.OrdinalIgnoreCase) || storeTypeNameBase.Equals("double precision", StringComparison.OrdinalIgnoreCase))) { - return _real; + return Real; } if (_storeTypeMappings.TryGetValue(storeTypeName, out var mappings) @@ -350,12 +614,12 @@ public SqlServerTypeMappingSource( if (clrType == typeof(ulong) && mappingInfo.IsRowVersion == true) { - return _ulongRowversion; + return UlongRowversion; } if (clrType == typeof(long) && mappingInfo.IsRowVersion == true) { - return _longRowversion; + return LongRowversion; } if (clrType == typeof(string)) @@ -376,11 +640,11 @@ public SqlServerTypeMappingSource( { return isAnsi ? isFixedLength - ? _fixedLengthAnsiString - : _variableLengthMaxAnsiString + ? FixedLengthAnsiString + : VariableLengthMaxAnsiString : isFixedLength - ? _fixedLengthUnicodeString - : _variableLengthMaxUnicodeString; + ? FixedLengthUnicodeString + : VariableLengthMaxUnicodeString; } return new SqlServerStringTypeMapping( @@ -395,7 +659,7 @@ public SqlServerTypeMappingSource( { if (mappingInfo.IsRowVersion == true) { - return _rowversion; + return Rowversion; } var isFixedLength = mappingInfo.IsFixedLength == true; @@ -407,7 +671,7 @@ public SqlServerTypeMappingSource( } return size == null - ? _variableLengthMaxBinary + ? VariableLengthMaxBinary : new SqlServerByteArrayTypeMapping( size: size, fixedLength: isFixedLength, diff --git a/src/EFCore.Sqlite.Core/Storage/Internal/SqliteTypeMappingSource.cs b/src/EFCore.Sqlite.Core/Storage/Internal/SqliteTypeMappingSource.cs index bf34f8d6291..cb1554232a2 100644 --- a/src/EFCore.Sqlite.Core/Storage/Internal/SqliteTypeMappingSource.cs +++ b/src/EFCore.Sqlite.Core/Storage/Internal/SqliteTypeMappingSource.cs @@ -55,10 +55,37 @@ private static readonly HashSet SpatialiteTypes private const string BlobTypeName = "BLOB"; private const string TextTypeName = "TEXT"; - private static readonly LongTypeMapping Integer = new(IntegerTypeName); - private static readonly DoubleTypeMapping Real = new(RealTypeName); - private static readonly ByteArrayTypeMapping Blob = new(BlobTypeName); - private static readonly SqliteStringTypeMapping Text = new(TextTypeName); + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly LongTypeMapping Integer = new(IntegerTypeName); + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly DoubleTypeMapping Real = new(RealTypeName); + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly ByteArrayTypeMapping Blob = new(BlobTypeName); + + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public static readonly SqliteStringTypeMapping Text = new(TextTypeName); private readonly Dictionary _clrTypeMappings = new() { diff --git a/src/EFCore/ChangeTracking/Internal/Snapshot.cs b/src/EFCore/ChangeTracking/Internal/Snapshot.cs index aac2c05085d..f375fe1605d 100644 --- a/src/EFCore/ChangeTracking/Internal/Snapshot.cs +++ b/src/EFCore/ChangeTracking/Internal/Snapshot.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; -using static Microsoft.EntityFrameworkCore.Metadata.Internal.EntityType; namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal; @@ -62,6 +61,7 @@ public T GetValue(int index) /// doing so can result in application failures when updating to a new Entity Framework Core release. /// [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] + [RequiresDynamicCode("Creates types using MakeGenericType.")] public static Type CreateSnapshotType(Type[] types) => types.Length switch { diff --git a/src/EFCore/Infrastructure/DatabaseFacade.cs b/src/EFCore/Infrastructure/DatabaseFacade.cs index 7288fc5b8e8..83321f03124 100644 --- a/src/EFCore/Infrastructure/DatabaseFacade.cs +++ b/src/EFCore/Infrastructure/DatabaseFacade.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Data.Common; +using System.Runtime.CompilerServices; namespace Microsoft.EntityFrameworkCore.Infrastructure; @@ -72,7 +73,9 @@ private IDatabaseFacadeDependencies Dependencies /// /// if the database is created, if it already existed. public virtual bool EnsureCreated() - => Dependencies.DatabaseCreator.EnsureCreated(); + => RuntimeFeature.IsDynamicCodeSupported + ? Dependencies.DatabaseCreator.EnsureCreated() + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// Ensures that the database for the context exists. @@ -128,7 +131,9 @@ public virtual bool EnsureCreated() /// /// If the is canceled. public virtual Task EnsureCreatedAsync(CancellationToken cancellationToken = default) - => Dependencies.DatabaseCreator.EnsureCreatedAsync(cancellationToken); + => RuntimeFeature.IsDynamicCodeSupported + ? Dependencies.DatabaseCreator.EnsureCreatedAsync(cancellationToken) + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// @@ -153,7 +158,9 @@ public virtual Task EnsureCreatedAsync(CancellationToken cancellationToken /// /// if the database is deleted, if it did not exist. public virtual bool EnsureDeleted() - => Dependencies.DatabaseCreator.EnsureDeleted(); + => RuntimeFeature.IsDynamicCodeSupported + ? Dependencies.DatabaseCreator.EnsureDeleted() + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// @@ -190,7 +197,9 @@ public virtual bool EnsureDeleted() /// /// If the is canceled. public virtual Task EnsureDeletedAsync(CancellationToken cancellationToken = default) - => Dependencies.DatabaseCreator.EnsureDeletedAsync(cancellationToken); + => RuntimeFeature.IsDynamicCodeSupported + ? Dependencies.DatabaseCreator.EnsureDeletedAsync(cancellationToken) + : throw new InvalidOperationException(CoreStrings.NativeAotNoMigrations); /// /// Determines whether or not the database is available and can be connected to. diff --git a/src/EFCore/Metadata/RuntimeEntityType.cs b/src/EFCore/Metadata/RuntimeEntityType.cs index d7b656d77d6..ebc9fb1e1a9 100644 --- a/src/EFCore/Metadata/RuntimeEntityType.cs +++ b/src/EFCore/Metadata/RuntimeEntityType.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -1182,7 +1183,9 @@ IEnumerable IEntityType.GetDeclaredTriggers() Func IRuntimeEntityType.RelationshipSnapshotFactory => NonCapturingLazyInitializer.EnsureInitialized( ref _relationshipSnapshotFactory, this, - static entityType => new RelationshipSnapshotFactoryFactory().Create(entityType)); + static entityType => RuntimeFeature.IsDynamicCodeSupported + ? new RelationshipSnapshotFactoryFactory().Create(entityType) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// [DebuggerStepThrough] diff --git a/src/EFCore/Metadata/RuntimeProperty.cs b/src/EFCore/Metadata/RuntimeProperty.cs index 11ea05e75b1..f8776f1671f 100644 --- a/src/EFCore/Metadata/RuntimeProperty.cs +++ b/src/EFCore/Metadata/RuntimeProperty.cs @@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Storage.Json; +using System.Runtime.CompilerServices; namespace Microsoft.EntityFrameworkCore.Metadata; @@ -171,7 +172,9 @@ public virtual CoreTypeMapping TypeMapping get => NonCapturingLazyInitializer.EnsureInitialized( ref _typeMapping, (IProperty)this, static property => - property.DeclaringType.Model.GetModelDependencies().TypeMappingSource.FindMapping(property)!); + RuntimeFeature.IsDynamicCodeSupported + ? property.DeclaringType.Model.GetModelDependencies().TypeMappingSource.FindMapping(property)! + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); set => _typeMapping = value; } diff --git a/src/EFCore/Metadata/RuntimePropertyBase.cs b/src/EFCore/Metadata/RuntimePropertyBase.cs index 37b972b70c1..1a10e57e8de 100644 --- a/src/EFCore/Metadata/RuntimePropertyBase.cs +++ b/src/EFCore/Metadata/RuntimePropertyBase.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -96,13 +97,17 @@ IReadOnlyTypeBase IReadOnlyPropertyBase.DeclaringType IClrPropertySetter IRuntimePropertyBase.MaterializationSetter => NonCapturingLazyInitializer.EnsureInitialized( ref _materializationSetter, this, static property => - new ClrPropertyMaterializationSetterFactory().Create(property)); + RuntimeFeature.IsDynamicCodeSupported + ? new ClrPropertyMaterializationSetterFactory().Create(property) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// PropertyAccessors IRuntimePropertyBase.Accessors => NonCapturingLazyInitializer.EnsureInitialized( ref _accessors, this, static property => - new PropertyAccessorsFactory().Create(property)); + RuntimeFeature.IsDynamicCodeSupported + ? new PropertyAccessorsFactory().Create(property) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// PropertyIndexes IRuntimePropertyBase.PropertyIndexes diff --git a/src/EFCore/Metadata/RuntimeTypeBase.cs b/src/EFCore/Metadata/RuntimeTypeBase.cs index 63c5c60230a..cf020c65607 100644 --- a/src/EFCore/Metadata/RuntimeTypeBase.cs +++ b/src/EFCore/Metadata/RuntimeTypeBase.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -690,31 +691,41 @@ PropertyCounts IRuntimeTypeBase.Counts Func IRuntimeTypeBase.OriginalValuesFactory => NonCapturingLazyInitializer.EnsureInitialized( ref _originalValuesFactory, this, - static complexType => new OriginalValuesFactoryFactory().Create(complexType)); + static complexType => RuntimeFeature.IsDynamicCodeSupported + ? new OriginalValuesFactoryFactory().Create(complexType) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// Func IRuntimeTypeBase.StoreGeneratedValuesFactory => NonCapturingLazyInitializer.EnsureInitialized( ref _storeGeneratedValuesFactory, this, - static complexType => new StoreGeneratedValuesFactoryFactory().CreateEmpty(complexType)); + static complexType => RuntimeFeature.IsDynamicCodeSupported + ? new StoreGeneratedValuesFactoryFactory().CreateEmpty(complexType) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// Func IRuntimeTypeBase.TemporaryValuesFactory => NonCapturingLazyInitializer.EnsureInitialized( ref _temporaryValuesFactory, this, - static complexType => new TemporaryValuesFactoryFactory().Create(complexType)); + static complexType => RuntimeFeature.IsDynamicCodeSupported + ? new TemporaryValuesFactoryFactory().Create(complexType) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// Func IRuntimeTypeBase.ShadowValuesFactory => NonCapturingLazyInitializer.EnsureInitialized( ref _shadowValuesFactory, this, - static complexType => new ShadowValuesFactoryFactory().Create(complexType)); + static complexType => RuntimeFeature.IsDynamicCodeSupported + ? new ShadowValuesFactoryFactory().Create(complexType) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// Func IRuntimeTypeBase.EmptyShadowValuesFactory => NonCapturingLazyInitializer.EnsureInitialized( ref _emptyShadowValuesFactory, this, - static complexType => new EmptyShadowValuesFactoryFactory().CreateEmpty(complexType)); + static complexType => RuntimeFeature.IsDynamicCodeSupported + ? new EmptyShadowValuesFactoryFactory().CreateEmpty(complexType) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// [DebuggerStepThrough] diff --git a/src/EFCore/Properties/CoreStrings.Designer.cs b/src/EFCore/Properties/CoreStrings.Designer.cs index 662e5874937..29555f51623 100644 --- a/src/EFCore/Properties/CoreStrings.Designer.cs +++ b/src/EFCore/Properties/CoreStrings.Designer.cs @@ -1751,6 +1751,12 @@ public static string NamedIndexWrongType(object? indexName, object? entityType) public static string NativeAotNoCompiledModel => GetString("NativeAotNoCompiledModel"); + /// + /// Migration operations are not supported when publishing with NativeAOT. Use a migration bundle or an alternate way of executing migration operations. + /// + public static string NativeAotNoMigrations + => GetString("NativeAotNoMigrations"); + /// /// The type of navigation '{1_entityType}.{0_navigation}' is '{foundType}' which is an array type. Collection navigations cannot be arrays. /// diff --git a/src/EFCore/Properties/CoreStrings.resx b/src/EFCore/Properties/CoreStrings.resx index f300271c954..ef753ddf255 100644 --- a/src/EFCore/Properties/CoreStrings.resx +++ b/src/EFCore/Properties/CoreStrings.resx @@ -1086,6 +1086,9 @@ Model building is not supported when publishing with NativeAOT. Use a compiled model. + + Migration operations are not supported when publishing with NativeAOT. Use a migration bundle or an alternate way of executing migration operations. + The type of navigation '{1_entityType}.{0_navigation}' is '{foundType}' which is an array type. Collection navigations cannot be arrays. diff --git a/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpRuntimeModelCodeGeneratorTest.cs b/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpRuntimeModelCodeGeneratorTest.cs index 24e3def5242..bcf0e750fc0 100644 --- a/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpRuntimeModelCodeGeneratorTest.cs +++ b/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpRuntimeModelCodeGeneratorTest.cs @@ -1067,10 +1067,10 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase = new TableMappingBase(dependentBase, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalAlternateId")!, dependentBase.FindProperty("PrincipalAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalId")!, dependentBase.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("EnumDiscriminator")!, dependentBase.FindProperty("EnumDiscriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Id")!, dependentBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalAlternateIdColumnBase, dependentBase.FindProperty("PrincipalAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalIdColumnBase, dependentBase.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enumDiscriminatorColumnBase, dependentBase.FindProperty("EnumDiscriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, dependentBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); var tableMappings = new List(); dependentBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -1119,10 +1119,10 @@ private IRelationalModel CreateRelationalModel() }; dependentBasebyteTable.AddTypeMapping(dependentBasebyteTableMapping, false); tableMappings.Add(dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalAlternateId")!, dependentBase.FindProperty("PrincipalAlternateId")!, dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalId")!, dependentBase.FindProperty("PrincipalId")!, dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("EnumDiscriminator")!, dependentBase.FindProperty("EnumDiscriminator")!, dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Id")!, dependentBase.FindProperty("Id")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalAlternateIdColumn, dependentBase.FindProperty("PrincipalAlternateId")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalIdColumn, dependentBase.FindProperty("PrincipalId")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(enumDiscriminatorColumn, dependentBase.FindProperty("EnumDiscriminator")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(idColumn, dependentBase.FindProperty("Id")!, dependentBasebyteTableMapping); var dependentDerived = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+DependentDerived")!; @@ -1131,12 +1131,12 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0 = new TableMappingBase(dependentDerived, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0, false); defaultTableMappings0.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalAlternateId")!, dependentDerived.FindProperty("PrincipalAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalId")!, dependentDerived.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Data")!, dependentDerived.FindProperty("Data")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("EnumDiscriminator")!, dependentDerived.FindProperty("EnumDiscriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Id")!, dependentDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Money")!, dependentDerived.FindProperty("Money")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)principalAlternateIdColumnBase, dependentDerived.FindProperty("PrincipalAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)principalIdColumnBase, dependentDerived.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, dependentDerived.FindProperty("Data")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)enumDiscriminatorColumnBase, dependentDerived.FindProperty("EnumDiscriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, dependentDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)moneyColumnBase, dependentDerived.FindProperty("Money")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); var tableMappings0 = new List(); dependentDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); @@ -1146,12 +1146,12 @@ private IRelationalModel CreateRelationalModel() }; dependentBasebyteTable.AddTypeMapping(dependentBasebyteTableMapping0, false); tableMappings0.Add(dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalAlternateId")!, dependentDerived.FindProperty("PrincipalAlternateId")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalId")!, dependentDerived.FindProperty("PrincipalId")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Data")!, dependentDerived.FindProperty("Data")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("EnumDiscriminator")!, dependentDerived.FindProperty("EnumDiscriminator")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Id")!, dependentDerived.FindProperty("Id")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Money")!, dependentDerived.FindProperty("Money")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(principalAlternateIdColumn, dependentDerived.FindProperty("PrincipalAlternateId")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(principalIdColumn, dependentDerived.FindProperty("PrincipalId")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(dataColumn, dependentDerived.FindProperty("Data")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(enumDiscriminatorColumn, dependentDerived.FindProperty("EnumDiscriminator")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(idColumn, dependentDerived.FindProperty("Id")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(moneyColumn, dependentDerived.FindProperty("Money")!, dependentBasebyteTableMapping0); var principalBase = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalBase")!; @@ -1182,13 +1182,13 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase = new TableMappingBase(principalBase, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase, false); defaultTableMappings1.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("AlternateId")!, principalBase.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Id")!, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Point")!, principalBase.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)alternateIdColumnBase, principalBase.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pointColumnBase, principalBase.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); var tableMappings1 = new List(); principalBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); @@ -1250,13 +1250,13 @@ private IRelationalModel CreateRelationalModel() }; principalBaseTable.AddTypeMapping(principalBaseTableMapping, false); tableMappings1.Add(principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("AlternateId")!, principalBase.FindProperty("AlternateId")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Id")!, principalBase.FindProperty("Id")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Point")!, principalBase.FindProperty("Point")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(alternateIdColumn, principalBase.FindProperty("AlternateId")!, 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(pointColumn, principalBase.FindProperty("Point")!, principalBaseTableMapping); var ownedType = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalBase.Owned#OwnedType")!; @@ -1278,10 +1278,10 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase = new TableMappingBase(ownedType, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase, false); defaultTableMappings2.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeTableBase.FindColumn("PrincipalBaseAlternateId")!, ownedType.FindProperty("PrincipalBaseAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeTableBase.FindColumn("PrincipalBaseId")!, ownedType.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeTableBase.FindColumn("Details")!, ownedType.FindProperty("Details")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeTableBase.FindColumn("Number")!, ownedType.FindProperty("Number")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalBaseAlternateIdColumnBase, ownedType.FindProperty("PrincipalBaseAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalBaseIdColumnBase, ownedType.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)detailsColumnBase, ownedType.FindProperty("Details")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)numberColumnBase, ownedType.FindProperty("Number")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseOwnedOwnedTypeMappingBase); var tableMappings2 = new List(); ownedType.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); @@ -1297,9 +1297,9 @@ private IRelationalModel CreateRelationalModel() new[] { "PrincipalBaseId", "PrincipalBaseAlternateId" }, "Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalBase", new[] { "Id", "AlternateId" })); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("AlternateId")!, ownedType.FindProperty("PrincipalBaseAlternateId")!, principalBaseTableMapping0); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Id")!, ownedType.FindProperty("PrincipalBaseId")!, principalBaseTableMapping0); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Owned_Number")!, ownedType.FindProperty("Number")!, principalBaseTableMapping0); + RelationalModel.CreateColumnMapping(alternateIdColumn, ownedType.FindProperty("PrincipalBaseAlternateId")!, principalBaseTableMapping0); + RelationalModel.CreateColumnMapping(idColumn0, ownedType.FindProperty("PrincipalBaseId")!, principalBaseTableMapping0); + RelationalModel.CreateColumnMapping(owned_NumberColumn, ownedType.FindProperty("Number")!, principalBaseTableMapping0); var detailsTable = new Table("Details", null, relationalModel); var principalBaseIdColumn = new Column("PrincipalBaseId", "bigint", detailsTable); detailsTable.Columns.Add("PrincipalBaseId", principalBaseIdColumn); @@ -1325,9 +1325,9 @@ private IRelationalModel CreateRelationalModel() }; detailsTable.AddTypeMapping(detailsTableMapping, false); tableMappings2.Add(detailsTableMapping); - RelationalModel.CreateColumnMapping(detailsTable.FindColumn("PrincipalBaseAlternateId")!, ownedType.FindProperty("PrincipalBaseAlternateId")!, detailsTableMapping); - RelationalModel.CreateColumnMapping(detailsTable.FindColumn("PrincipalBaseId")!, ownedType.FindProperty("PrincipalBaseId")!, detailsTableMapping); - RelationalModel.CreateColumnMapping(detailsTable.FindColumn("Details")!, ownedType.FindProperty("Details")!, detailsTableMapping); + RelationalModel.CreateColumnMapping(principalBaseAlternateIdColumn, ownedType.FindProperty("PrincipalBaseAlternateId")!, detailsTableMapping); + RelationalModel.CreateColumnMapping(principalBaseIdColumn, ownedType.FindProperty("PrincipalBaseId")!, detailsTableMapping); + RelationalModel.CreateColumnMapping(detailsColumn, ownedType.FindProperty("Details")!, detailsTableMapping); var principalDerived = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalDerived>")!; @@ -1336,13 +1336,13 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0 = new TableMappingBase(principalDerived, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase, false); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0, false); defaultTableMappings3.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("AlternateId")!, principalDerived.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Id")!, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Point")!, principalDerived.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)alternateIdColumnBase, principalDerived.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)pointColumnBase, principalDerived.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); var defaultTableMappings4 = new List>(); principalDerived.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings4); @@ -1355,8 +1355,8 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase = new TableMappingBase(principalDerived, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase, false); defaultTableMappings4.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("AlternateId")!, principalDerived.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Id")!, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)alternateIdColumnBase0, principalDerived.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); var tableMappings3 = new List(); principalDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); @@ -1366,13 +1366,13 @@ private IRelationalModel CreateRelationalModel() }; principalBaseTable.AddTypeMapping(principalBaseTableMapping1, false); tableMappings3.Add(principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("AlternateId")!, principalDerived.FindProperty("AlternateId")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Id")!, principalDerived.FindProperty("Id")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Point")!, principalDerived.FindProperty("Point")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(alternateIdColumn, principalDerived.FindProperty("AlternateId")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(idColumn0, principalDerived.FindProperty("Id")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(enum1Column, principalDerived.FindProperty("Enum1")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(enum2Column, principalDerived.FindProperty("Enum2")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(flagsEnum1Column, principalDerived.FindProperty("FlagsEnum1")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(flagsEnum2Column, principalDerived.FindProperty("FlagsEnum2")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(pointColumn, principalDerived.FindProperty("Point")!, principalBaseTableMapping1); var principalDerivedTable = new Table("PrincipalDerived", null, relationalModel); var derivedIdColumn = new Column("DerivedId", "bigint", principalDerivedTable); principalDerivedTable.Columns.Add("DerivedId", derivedIdColumn); @@ -1405,8 +1405,8 @@ private IRelationalModel CreateRelationalModel() var principalDerivedTableMapping = new TableMapping(principalDerived, principalDerivedTable, true); principalDerivedTable.AddTypeMapping(principalDerivedTableMapping, false); tableMappings3.Add(principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("AlternateId")!, principalDerived.FindProperty("AlternateId")!, principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("DerivedId")!, principalDerived.FindProperty("Id")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(alternateIdColumn0, principalDerived.FindProperty("AlternateId")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(derivedIdColumn, principalDerived.FindProperty("Id")!, principalDerivedTableMapping); var ownedType0 = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalDerived>.ManyOwned#OwnedType")!; @@ -1430,11 +1430,11 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase = new TableMappingBase(ownedType0, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase, false); defaultTableMappings5.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeTableBase.FindColumn("Id")!, ownedType0.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeTableBase.FindColumn("PrincipalDerived>AlternateId")!, ownedType0.FindProperty("PrincipalDerivedAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeTableBase.FindColumn("PrincipalDerived>Id")!, ownedType0.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeTableBase.FindColumn("Details")!, ownedType0.FindProperty("Details")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeTableBase.FindColumn("Number")!, ownedType0.FindProperty("Number")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase2, ownedType0.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalDerivedDependentBasebyteAlternateIdColumnBase, ownedType0.FindProperty("PrincipalDerivedAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalDerivedDependentBasebyteIdColumnBase, ownedType0.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)detailsColumnBase0, ownedType0.FindProperty("Details")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)numberColumnBase0, ownedType0.FindProperty("Number")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteManyOwnedOwnedTypeMappingBase); var tableMappings4 = new List(); ownedType0.SetRuntimeAnnotation("Relational:TableMappings", tableMappings4); @@ -1464,11 +1464,11 @@ private IRelationalModel CreateRelationalModel() var manyOwnedTableMapping = new TableMapping(ownedType0, manyOwnedTable, true); manyOwnedTable.AddTypeMapping(manyOwnedTableMapping, false); tableMappings4.Add(manyOwnedTableMapping); - RelationalModel.CreateColumnMapping(manyOwnedTable.FindColumn("Id")!, ownedType0.FindProperty("Id")!, manyOwnedTableMapping); - RelationalModel.CreateColumnMapping(manyOwnedTable.FindColumn("PrincipalDerived>AlternateId")!, ownedType0.FindProperty("PrincipalDerivedAlternateId")!, manyOwnedTableMapping); - RelationalModel.CreateColumnMapping(manyOwnedTable.FindColumn("PrincipalDerived>Id")!, ownedType0.FindProperty("PrincipalDerivedId")!, manyOwnedTableMapping); - RelationalModel.CreateColumnMapping(manyOwnedTable.FindColumn("Details")!, ownedType0.FindProperty("Details")!, manyOwnedTableMapping); - RelationalModel.CreateColumnMapping(manyOwnedTable.FindColumn("Number")!, ownedType0.FindProperty("Number")!, manyOwnedTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, ownedType0.FindProperty("Id")!, manyOwnedTableMapping); + RelationalModel.CreateColumnMapping(principalDerivedDependentBasebyteAlternateIdColumn, ownedType0.FindProperty("PrincipalDerivedAlternateId")!, manyOwnedTableMapping); + RelationalModel.CreateColumnMapping(principalDerivedDependentBasebyteIdColumn, ownedType0.FindProperty("PrincipalDerivedId")!, manyOwnedTableMapping); + RelationalModel.CreateColumnMapping(detailsColumn0, ownedType0.FindProperty("Details")!, manyOwnedTableMapping); + RelationalModel.CreateColumnMapping(numberColumn, ownedType0.FindProperty("Number")!, manyOwnedTableMapping); var principalBasePrincipalDerivedDependentBasebyte = FindEntityType("PrincipalBasePrincipalDerived>")!; @@ -1492,11 +1492,11 @@ private IRelationalModel CreateRelationalModel() var principalBasePrincipalDerivedDependentBasebyteMappingBase = new TableMappingBase(principalBasePrincipalDerivedDependentBasebyte, principalBasePrincipalDerivedDependentBasebyteTableBase, true); principalBasePrincipalDerivedDependentBasebyteTableBase.AddTypeMapping(principalBasePrincipalDerivedDependentBasebyteMappingBase, false); defaultTableMappings6.Add(principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("rowid")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("rowid")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)derivedsAlternateIdColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)derivedsIdColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalsAlternateIdColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalsIdColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)rowidColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("rowid")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); var tableMappings5 = new List(); principalBasePrincipalDerivedDependentBasebyte.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); @@ -1534,11 +1534,11 @@ private IRelationalModel CreateRelationalModel() var principalBasePrincipalDerivedDependentBasebyteTableMapping = new TableMapping(principalBasePrincipalDerivedDependentBasebyte, principalBasePrincipalDerivedDependentBasebyteTable, true); principalBasePrincipalDerivedDependentBasebyteTable.AddTypeMapping(principalBasePrincipalDerivedDependentBasebyteTableMapping, false); tableMappings5.Add(principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("rowid")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("rowid")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(derivedsAlternateIdColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(derivedsIdColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalsAlternateIdColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalsIdColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(rowidColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("rowid")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); var fK_DependentBasebyte_PrincipalBase_PrincipalId = new ForeignKeyConstraint( "FK_DependentBase_PrincipalBase_PrincipalId", dependentBasebyteTable, principalBaseTable, new[] { principalIdColumn }, @@ -3026,10 +3026,10 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase = new TableMappingBase(dependentBase, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalAlternateId")!, dependentBase.FindProperty("PrincipalAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalId")!, dependentBase.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("EnumDiscriminator")!, dependentBase.FindProperty("EnumDiscriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Id")!, dependentBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalAlternateIdColumnBase, dependentBase.FindProperty("PrincipalAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalIdColumnBase, dependentBase.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enumDiscriminatorColumnBase, dependentBase.FindProperty("EnumDiscriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, dependentBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); var tableMappings = new List(); dependentBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -3078,10 +3078,10 @@ private IRelationalModel CreateRelationalModel() }; dependentBasebyteTable.AddTypeMapping(dependentBasebyteTableMapping, false); tableMappings.Add(dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalAlternateId")!, dependentBase.FindProperty("PrincipalAlternateId")!, dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalId")!, dependentBase.FindProperty("PrincipalId")!, dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("EnumDiscriminator")!, dependentBase.FindProperty("EnumDiscriminator")!, dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Id")!, dependentBase.FindProperty("Id")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalAlternateIdColumn, dependentBase.FindProperty("PrincipalAlternateId")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalIdColumn, dependentBase.FindProperty("PrincipalId")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(enumDiscriminatorColumn, dependentBase.FindProperty("EnumDiscriminator")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(idColumn, dependentBase.FindProperty("Id")!, dependentBasebyteTableMapping); var dependentDerived = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+DependentDerived")!; @@ -3090,12 +3090,12 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0 = new TableMappingBase(dependentDerived, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0, false); defaultTableMappings0.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalAlternateId")!, dependentDerived.FindProperty("PrincipalAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalId")!, dependentDerived.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Data")!, dependentDerived.FindProperty("Data")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("EnumDiscriminator")!, dependentDerived.FindProperty("EnumDiscriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Id")!, dependentDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Money")!, dependentDerived.FindProperty("Money")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)principalAlternateIdColumnBase, dependentDerived.FindProperty("PrincipalAlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)principalIdColumnBase, dependentDerived.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, dependentDerived.FindProperty("Data")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)enumDiscriminatorColumnBase, dependentDerived.FindProperty("EnumDiscriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, dependentDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)moneyColumnBase, dependentDerived.FindProperty("Money")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase0); var tableMappings0 = new List(); dependentDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); @@ -3105,12 +3105,12 @@ private IRelationalModel CreateRelationalModel() }; dependentBasebyteTable.AddTypeMapping(dependentBasebyteTableMapping0, false); tableMappings0.Add(dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalAlternateId")!, dependentDerived.FindProperty("PrincipalAlternateId")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalId")!, dependentDerived.FindProperty("PrincipalId")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Data")!, dependentDerived.FindProperty("Data")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("EnumDiscriminator")!, dependentDerived.FindProperty("EnumDiscriminator")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Id")!, dependentDerived.FindProperty("Id")!, dependentBasebyteTableMapping0); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Money")!, dependentDerived.FindProperty("Money")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(principalAlternateIdColumn, dependentDerived.FindProperty("PrincipalAlternateId")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(principalIdColumn, dependentDerived.FindProperty("PrincipalId")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(dataColumn, dependentDerived.FindProperty("Data")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(enumDiscriminatorColumn, dependentDerived.FindProperty("EnumDiscriminator")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(idColumn, dependentDerived.FindProperty("Id")!, dependentBasebyteTableMapping0); + RelationalModel.CreateColumnMapping(moneyColumn, dependentDerived.FindProperty("Money")!, dependentBasebyteTableMapping0); var principalBase = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalBase")!; @@ -3143,14 +3143,14 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase = new TableMappingBase(principalBase, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase, false); defaultTableMappings1.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("AlternateId")!, principalBase.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Id")!, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Discriminator")!, principalBase.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Point")!, principalBase.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)alternateIdColumnBase, principalBase.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)discriminatorColumnBase, principalBase.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pointColumnBase, principalBase.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); var tableMappings1 = new List(); principalBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); @@ -3214,14 +3214,14 @@ private IRelationalModel CreateRelationalModel() }; principalBaseTable.AddTypeMapping(principalBaseTableMapping, false); tableMappings1.Add(principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("AlternateId")!, principalBase.FindProperty("AlternateId")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Id")!, principalBase.FindProperty("Id")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Discriminator")!, principalBase.FindProperty("Discriminator")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Point")!, principalBase.FindProperty("Point")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(alternateIdColumn, principalBase.FindProperty("AlternateId")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, principalBase.FindProperty("Id")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(discriminatorColumn, principalBase.FindProperty("Discriminator")!, 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(pointColumn, principalBase.FindProperty("Point")!, principalBaseTableMapping); var ownedType = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalBase.Owned#OwnedType")!; @@ -3256,14 +3256,14 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0 = new TableMappingBase(principalDerived, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0, false); defaultTableMappings3.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("AlternateId")!, principalDerived.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Id")!, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Discriminator")!, principalDerived.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Point")!, principalDerived.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)alternateIdColumnBase, principalDerived.FindProperty("AlternateId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)discriminatorColumnBase, principalDerived.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)pointColumnBase, principalDerived.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); var tableMappings3 = new List(); principalDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings3); @@ -3273,14 +3273,14 @@ private IRelationalModel CreateRelationalModel() }; principalBaseTable.AddTypeMapping(principalBaseTableMapping1, false); tableMappings3.Add(principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("AlternateId")!, principalDerived.FindProperty("AlternateId")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Id")!, principalDerived.FindProperty("Id")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Discriminator")!, principalDerived.FindProperty("Discriminator")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Point")!, principalDerived.FindProperty("Point")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(alternateIdColumn, principalDerived.FindProperty("AlternateId")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(idColumn0, principalDerived.FindProperty("Id")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(discriminatorColumn, principalDerived.FindProperty("Discriminator")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(enum1Column, principalDerived.FindProperty("Enum1")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(enum2Column, principalDerived.FindProperty("Enum2")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(flagsEnum1Column, principalDerived.FindProperty("FlagsEnum1")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(flagsEnum2Column, principalDerived.FindProperty("FlagsEnum2")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(pointColumn, principalDerived.FindProperty("Point")!, principalBaseTableMapping1); var ownedType0 = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalDerived>.ManyOwned#OwnedType")!; @@ -3333,11 +3333,11 @@ private IRelationalModel CreateRelationalModel() var principalBasePrincipalDerivedDependentBasebyteMappingBase = new TableMappingBase(principalBasePrincipalDerivedDependentBasebyte, principalBasePrincipalDerivedDependentBasebyteTableBase, true); principalBasePrincipalDerivedDependentBasebyteTableBase.AddTypeMapping(principalBasePrincipalDerivedDependentBasebyteMappingBase, false); defaultTableMappings5.Add(principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)principalBasePrincipalDerivedDependentBasebyteTableBase.FindColumn("rowid")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("rowid")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)derivedsAlternateIdColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)derivedsIdColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalsAlternateIdColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalsIdColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)rowidColumnBase, principalBasePrincipalDerivedDependentBasebyte.FindProperty("rowid")!, principalBasePrincipalDerivedDependentBasebyteMappingBase); var tableMappings5 = new List(); principalBasePrincipalDerivedDependentBasebyte.SetRuntimeAnnotation("Relational:TableMappings", tableMappings5); @@ -3375,11 +3375,11 @@ private IRelationalModel CreateRelationalModel() var principalBasePrincipalDerivedDependentBasebyteTableMapping = new TableMapping(principalBasePrincipalDerivedDependentBasebyte, principalBasePrincipalDerivedDependentBasebyteTable, true); principalBasePrincipalDerivedDependentBasebyteTable.AddTypeMapping(principalBasePrincipalDerivedDependentBasebyteTableMapping, false); tableMappings5.Add(principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(principalBasePrincipalDerivedDependentBasebyteTable.FindColumn("rowid")!, principalBasePrincipalDerivedDependentBasebyte.FindProperty("rowid")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(derivedsAlternateIdColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(derivedsIdColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("DerivedsId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalsAlternateIdColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsAlternateId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalsIdColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("PrincipalsId")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(rowidColumn, principalBasePrincipalDerivedDependentBasebyte.FindProperty("rowid")!, principalBasePrincipalDerivedDependentBasebyteTableMapping); var fK_DependentBasebyte_PrincipalBase_PrincipalId = new ForeignKeyConstraint( "FK_DependentBase_PrincipalBase_PrincipalId", dependentBasebyteTable, principalBaseTable, new[] { principalIdColumn }, @@ -4755,13 +4755,13 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase = new TableMappingBase(principalBase, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Id")!, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Discriminator")!, principalBase.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)discriminatorColumnBase, principalBase.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalBaseIdColumnBase, principalBase.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); var tableMappings = new List(); principalBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -4834,13 +4834,13 @@ private IRelationalModel CreateRelationalModel() }; principalBaseTable.AddTypeMapping(principalBaseTableMapping, false); tableMappings.Add(principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Id")!, principalBase.FindProperty("Id")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Discriminator")!, principalBase.FindProperty("Discriminator")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(idColumn, principalBase.FindProperty("Id")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(discriminatorColumn, principalBase.FindProperty("Discriminator")!, 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); var viewMappings = new List(); principalBase.SetRuntimeAnnotation("Relational:ViewMappings", viewMappings); @@ -4869,13 +4869,13 @@ private IRelationalModel CreateRelationalModel() var principalBaseViewViewMapping = new ViewMapping(principalBase, principalBaseViewView, true); principalBaseViewView.AddTypeMapping(principalBaseViewViewMapping, false); viewMappings.Add(principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("Id")!, principalBase.FindProperty("Id")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("Discriminator")!, principalBase.FindProperty("Discriminator")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(idViewColumn, principalBase.FindProperty("Id")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(discriminatorViewColumn, principalBase.FindProperty("Discriminator")!, 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); var sqlQueryMappings = new List(); principalBase.SetRuntimeAnnotation("Relational:SqlQueryMappings", sqlQueryMappings); @@ -4905,13 +4905,13 @@ private IRelationalModel CreateRelationalModel() microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping, false); sqlQueryMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping.IsDefaultSqlQueryMapping = true; - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("Id")!, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("Discriminator")!, principalBase.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); + RelationalModel.CreateSqlQueryColumnMapping(idSqlQueryColumn, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); + RelationalModel.CreateSqlQueryColumnMapping(discriminatorSqlQueryColumn, principalBase.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); + RelationalModel.CreateSqlQueryColumnMapping(enum1SqlQueryColumn, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); + RelationalModel.CreateSqlQueryColumnMapping(enum2SqlQueryColumn, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); + RelationalModel.CreateSqlQueryColumnMapping(flagsEnum1SqlQueryColumn, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); + RelationalModel.CreateSqlQueryColumnMapping(flagsEnum2SqlQueryColumn, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); + RelationalModel.CreateSqlQueryColumnMapping(principalBaseIdSqlQueryColumn, principalBase.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping); var functionMappings = new List(); principalBase.SetRuntimeAnnotation("Relational:FunctionMappings", functionMappings); @@ -4944,13 +4944,13 @@ private IRelationalModel CreateRelationalModel() principalBaseTvfFunction.AddTypeMapping(principalBaseTvfFunctionMapping, false); functionMappings.Add(principalBaseTvfFunctionMapping); principalBaseTvfFunctionMapping.IsDefaultFunctionMapping = true; - RelationalModel.CreateFunctionColumnMapping(principalBaseTvfFunction.FindColumn("Id")!, principalBase.FindProperty("Id")!, principalBaseTvfFunctionMapping); - RelationalModel.CreateFunctionColumnMapping(principalBaseTvfFunction.FindColumn("Discriminator")!, principalBase.FindProperty("Discriminator")!, principalBaseTvfFunctionMapping); - RelationalModel.CreateFunctionColumnMapping(principalBaseTvfFunction.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, principalBaseTvfFunctionMapping); - RelationalModel.CreateFunctionColumnMapping(principalBaseTvfFunction.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, principalBaseTvfFunctionMapping); - RelationalModel.CreateFunctionColumnMapping(principalBaseTvfFunction.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBaseTvfFunctionMapping); - RelationalModel.CreateFunctionColumnMapping(principalBaseTvfFunction.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBaseTvfFunctionMapping); - RelationalModel.CreateFunctionColumnMapping(principalBaseTvfFunction.FindColumn("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBaseTvfFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(idFunctionColumn, principalBase.FindProperty("Id")!, principalBaseTvfFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(discriminatorFunctionColumn, principalBase.FindProperty("Discriminator")!, principalBaseTvfFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(enum1FunctionColumn, principalBase.FindProperty("Enum1")!, principalBaseTvfFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(enum2FunctionColumn, principalBase.FindProperty("Enum2")!, principalBaseTvfFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(flagsEnum1FunctionColumn, principalBase.FindProperty("FlagsEnum1")!, principalBaseTvfFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(flagsEnum2FunctionColumn, principalBase.FindProperty("FlagsEnum2")!, principalBaseTvfFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(principalBaseIdFunctionColumn, principalBase.FindProperty("PrincipalBaseId")!, principalBaseTvfFunctionMapping); var deleteSprocMappings = new List(); principalBase.SetRuntimeAnnotation("Relational:DeleteStoredProcedureMappings", deleteSprocMappings); @@ -5047,8 +5047,8 @@ private IRelationalModel CreateRelationalModel() var principalBaseTableMapping0 = new TableMapping(ownedType, principalBaseTable, true); principalBaseTable.AddTypeMapping(principalBaseTableMapping0, false); tableMappings0.Add(principalBaseTableMapping0); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Deets")!, ownedType.FindProperty("Details")!, principalBaseTableMapping0); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Owned_Number")!, ownedType.FindProperty("Number")!, principalBaseTableMapping0); + RelationalModel.CreateColumnMapping(deetsColumn, ownedType.FindProperty("Details")!, principalBaseTableMapping0); + RelationalModel.CreateColumnMapping(owned_NumberColumn, ownedType.FindProperty("Number")!, principalBaseTableMapping0); var principalBase0 = ownedType.FindComplexProperty("Principal")!.ComplexType; @@ -5057,12 +5057,12 @@ private IRelationalModel CreateRelationalModel() var principalBaseTableMapping1 = new TableMapping(principalBase0, principalBaseTable, true); principalBaseTable.AddTypeMapping(principalBaseTableMapping1, false); tableMappings1.Add(principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Owned_Principal_AlternateId")!, principalBase0.FindProperty("AlternateId")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Owned_Principal_Enum1")!, principalBase0.FindProperty("Enum1")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Owned_Principal_Enum2")!, principalBase0.FindProperty("Enum2")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Owned_Principal_FlagsEnum1")!, principalBase0.FindProperty("FlagsEnum1")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Owned_Principal_FlagsEnum2")!, principalBase0.FindProperty("FlagsEnum2")!, principalBaseTableMapping1); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Owned_Principal_Id")!, principalBase0.FindProperty("Id")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(owned_Principal_AlternateIdColumn, principalBase0.FindProperty("AlternateId")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(owned_Principal_Enum1Column, principalBase0.FindProperty("Enum1")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(owned_Principal_Enum2Column, principalBase0.FindProperty("Enum2")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(owned_Principal_FlagsEnum1Column, principalBase0.FindProperty("FlagsEnum1")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(owned_Principal_FlagsEnum2Column, principalBase0.FindProperty("FlagsEnum2")!, principalBaseTableMapping1); + RelationalModel.CreateColumnMapping(owned_Principal_IdColumn, principalBase0.FindProperty("Id")!, principalBaseTableMapping1); var principalDerived = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalDerived>")!; @@ -5071,13 +5071,13 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0 = new TableMappingBase(principalDerived, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0, false); defaultTableMappings0.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Id")!, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Discriminator")!, principalDerived.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)discriminatorColumnBase, principalDerived.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); + RelationalModel.CreateColumnMapping((ColumnBase)principalBaseIdColumnBase, principalDerived.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase0); var tableMappings2 = new List(); principalDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings2); @@ -5087,13 +5087,13 @@ private IRelationalModel CreateRelationalModel() }; principalBaseTable.AddTypeMapping(principalBaseTableMapping2, false); tableMappings2.Add(principalBaseTableMapping2); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Id")!, principalDerived.FindProperty("Id")!, principalBaseTableMapping2); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Discriminator")!, principalDerived.FindProperty("Discriminator")!, principalBaseTableMapping2); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, principalBaseTableMapping2); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, principalBaseTableMapping2); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, principalBaseTableMapping2); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, principalBaseTableMapping2); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, principalBaseTableMapping2); + RelationalModel.CreateColumnMapping(idColumn, principalDerived.FindProperty("Id")!, principalBaseTableMapping2); + RelationalModel.CreateColumnMapping(discriminatorColumn, principalDerived.FindProperty("Discriminator")!, principalBaseTableMapping2); + RelationalModel.CreateColumnMapping(enum1Column, principalDerived.FindProperty("Enum1")!, principalBaseTableMapping2); + RelationalModel.CreateColumnMapping(enum2Column, principalDerived.FindProperty("Enum2")!, principalBaseTableMapping2); + RelationalModel.CreateColumnMapping(flagsEnum1Column, principalDerived.FindProperty("FlagsEnum1")!, principalBaseTableMapping2); + RelationalModel.CreateColumnMapping(flagsEnum2Column, principalDerived.FindProperty("FlagsEnum2")!, principalBaseTableMapping2); + RelationalModel.CreateColumnMapping(principalBaseIdColumn, principalDerived.FindProperty("PrincipalBaseId")!, principalBaseTableMapping2); var sqlQueryMappings0 = new List(); principalDerived.SetRuntimeAnnotation("Relational:SqlQueryMappings", sqlQueryMappings0); @@ -5101,13 +5101,13 @@ private IRelationalModel CreateRelationalModel() microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0, false); sqlQueryMappings0.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0.IsDefaultSqlQueryMapping = true; - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("Id")!, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("Discriminator")!, principalDerived.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); - RelationalModel.CreateSqlQueryColumnMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQuery.FindColumn("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); + RelationalModel.CreateSqlQueryColumnMapping(idSqlQueryColumn, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); + RelationalModel.CreateSqlQueryColumnMapping(discriminatorSqlQueryColumn, principalDerived.FindProperty("Discriminator")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); + RelationalModel.CreateSqlQueryColumnMapping(enum1SqlQueryColumn, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); + RelationalModel.CreateSqlQueryColumnMapping(enum2SqlQueryColumn, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); + RelationalModel.CreateSqlQueryColumnMapping(flagsEnum1SqlQueryColumn, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); + RelationalModel.CreateSqlQueryColumnMapping(flagsEnum2SqlQueryColumn, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); + RelationalModel.CreateSqlQueryColumnMapping(principalBaseIdSqlQueryColumn, principalDerived.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappedSqlQuerySqlQueryMapping0); var deleteSprocMappings0 = new List(); principalDerived.SetRuntimeAnnotation("Relational:DeleteStoredProcedureMappings", deleteSprocMappings0); @@ -6040,8 +6040,8 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase = new TableMappingBase(dependentBase, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Id")!, dependentBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalId")!, dependentBase.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, dependentBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalIdColumnBase, dependentBase.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); var tableMappings = new List(); dependentBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -6073,8 +6073,8 @@ private IRelationalModel CreateRelationalModel() var dependentBasebyteTableMapping = new TableMapping(dependentBase, dependentBasebyteTable, true); dependentBasebyteTable.AddTypeMapping(dependentBasebyteTableMapping, false); tableMappings.Add(dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("Id")!, dependentBase.FindProperty("Id")!, dependentBasebyteTableMapping); - RelationalModel.CreateColumnMapping(dependentBasebyteTable.FindColumn("PrincipalId")!, dependentBase.FindProperty("PrincipalId")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(idColumn, dependentBase.FindProperty("Id")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalIdColumn, dependentBase.FindProperty("PrincipalId")!, dependentBasebyteTableMapping); var principalBase = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+PrincipalBase")!; @@ -6108,13 +6108,13 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase = new TableMappingBase(principalBase, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase, false); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase, false); defaultTableMappings0.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Id")!, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseTableBase.FindColumn("PrincipalDerived>Id")!, principalBase.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalBaseIdColumnBase, principalBase.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalDerivedDependentBasebyteIdColumnBase, principalBase.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalBaseMappingBase); var tableMappings0 = new List(); principalBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); @@ -6170,13 +6170,13 @@ private IRelationalModel CreateRelationalModel() var principalBaseTableMapping = new TableMapping(principalBase, principalBaseTable, false); principalBaseTable.AddTypeMapping(principalBaseTableMapping, false); tableMappings0.Add(principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Id")!, principalBase.FindProperty("Id")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBaseTableMapping); - RelationalModel.CreateColumnMapping(principalBaseTable.FindColumn("PrincipalDerived>Id")!, principalBase.FindProperty("PrincipalDerivedId")!, 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); var viewMappings = new List(); principalBase.SetRuntimeAnnotation("Relational:ViewMappings", viewMappings); @@ -6208,13 +6208,13 @@ private IRelationalModel CreateRelationalModel() var principalBaseViewViewMapping = new ViewMapping(principalBase, principalBaseViewView, false); principalBaseViewView.AddTypeMapping(principalBaseViewViewMapping, false); viewMappings.Add(principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("Id")!, principalBase.FindProperty("Id")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("Enum1")!, principalBase.FindProperty("Enum1")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("Enum2")!, principalBase.FindProperty("Enum2")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBaseViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalBaseViewView.FindColumn("PrincipalDerivedId")!, principalBase.FindProperty("PrincipalDerivedId")!, 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); var deleteSprocMappings = new List(); principalBase.SetRuntimeAnnotation("Relational:DeleteStoredProcedureMappings", deleteSprocMappings); @@ -6345,13 +6345,13 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase = new TableMappingBase(principalDerived, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase, false); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase, false); defaultTableMappings1.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Id")!, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteTableBase.FindColumn("PrincipalDerived>Id")!, principalDerived.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase0, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase0, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase0, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase0, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalBaseIdColumnBase0, principalDerived.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalDerivedDependentBasebyteIdColumnBase0, principalDerived.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestPrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDependentBasebyteMappingBase); var tableMappings1 = new List(); principalDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); @@ -6407,13 +6407,13 @@ private IRelationalModel CreateRelationalModel() var principalDerivedTableMapping = new TableMapping(principalDerived, principalDerivedTable, false); principalDerivedTable.AddTypeMapping(principalDerivedTableMapping, false); tableMappings1.Add(principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("Id")!, principalDerived.FindProperty("Id")!, principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, principalDerivedTableMapping); - RelationalModel.CreateColumnMapping(principalDerivedTable.FindColumn("PrincipalDerived>Id")!, principalDerived.FindProperty("PrincipalDerivedId")!, 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); var viewMappings0 = new List(); principalDerived.SetRuntimeAnnotation("Relational:ViewMappings", viewMappings0); @@ -6445,13 +6445,13 @@ private IRelationalModel CreateRelationalModel() var principalDerivedViewViewMapping = new ViewMapping(principalDerived, principalDerivedViewView, false); principalDerivedViewView.AddTypeMapping(principalDerivedViewViewMapping, false); viewMappings0.Add(principalDerivedViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalDerivedViewView.FindColumn("Id")!, principalDerived.FindProperty("Id")!, principalDerivedViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalDerivedViewView.FindColumn("Enum1")!, principalDerived.FindProperty("Enum1")!, principalDerivedViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalDerivedViewView.FindColumn("Enum2")!, principalDerived.FindProperty("Enum2")!, principalDerivedViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalDerivedViewView.FindColumn("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, principalDerivedViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalDerivedViewView.FindColumn("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, principalDerivedViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalDerivedViewView.FindColumn("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, principalDerivedViewViewMapping); - RelationalModel.CreateViewColumnMapping(principalDerivedViewView.FindColumn("PrincipalDerivedId")!, principalDerived.FindProperty("PrincipalDerivedId")!, 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); var deleteSprocMappings0 = new List(); principalDerived.SetRuntimeAnnotation("Relational:DeleteStoredProcedureMappings", deleteSprocMappings0); @@ -7625,7 +7625,7 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase = new TableMappingBase(data, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Blob")!, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)blobColumnBase, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); var functionMappings = new List(); data.SetRuntimeAnnotation("Relational:FunctionMappings", functionMappings); @@ -7643,7 +7643,7 @@ private IRelationalModel CreateRelationalModel() getAllDataFunction.AddTypeMapping(getAllDataFunctionMapping, false); functionMappings.Add(getAllDataFunctionMapping); getAllDataFunctionMapping.IsDefaultFunctionMapping = true; - RelationalModel.CreateFunctionColumnMapping(getAllDataFunction.FindColumn("Blob")!, data.FindProperty("Blob")!, getAllDataFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(blobFunctionColumn, data.FindProperty("Blob")!, getAllDataFunctionMapping); var getData = (IRuntimeDbFunction)this.FindDbFunction("Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest+DbFunctionContext.GetData(int)")!; var getDataFunction = new StoreFunction(getData, relationalModel); var idFunctionParameter = getDataFunction.FindParameter("id")!; @@ -7658,7 +7658,7 @@ private IRelationalModel CreateRelationalModel() var getDataFunctionMapping = new FunctionMapping(data, getDataFunction, getData, true); getDataFunction.AddTypeMapping(getDataFunctionMapping, false); functionMappings.Add(getDataFunctionMapping); - RelationalModel.CreateFunctionColumnMapping(getDataFunction.FindColumn("Blob")!, data.FindProperty("Blob")!, getDataFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(blobFunctionColumn0, data.FindProperty("Blob")!, getDataFunctionMapping); var @object = FindEntityType("object")!; @@ -8125,8 +8125,8 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase = new TableMappingBase(data, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Id")!, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Blob")!, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)blobColumnBase, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); var tableMappings = new List(); data.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -8150,8 +8150,8 @@ private IRelationalModel CreateRelationalModel() var dataTableMapping = new TableMapping(data, dataTable, true); dataTable.AddTypeMapping(dataTableMapping, false); tableMappings.Add(dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Id")!, data.FindProperty("Id")!, dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Blob")!, data.FindProperty("Blob")!, dataTableMapping); + RelationalModel.CreateColumnMapping(idColumn, data.FindProperty("Id")!, dataTableMapping); + RelationalModel.CreateColumnMapping(blobColumn, data.FindProperty("Blob")!, dataTableMapping); return relationalModel.MakeReadOnly(); } } @@ -8375,8 +8375,8 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase = new TableMappingBase(data, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Id")!, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Blob")!, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)blobColumnBase, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); var tableMappings = new List(); data.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -8400,8 +8400,8 @@ private IRelationalModel CreateRelationalModel() var dataTableMapping = new TableMapping(data, dataTable, true); dataTable.AddTypeMapping(dataTableMapping, false); tableMappings.Add(dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Id")!, data.FindProperty("Id")!, dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Blob")!, data.FindProperty("Blob")!, dataTableMapping); + RelationalModel.CreateColumnMapping(idColumn, data.FindProperty("Id")!, dataTableMapping); + RelationalModel.CreateColumnMapping(blobColumn, data.FindProperty("Blob")!, dataTableMapping); return relationalModel.MakeReadOnly(); } } @@ -8599,8 +8599,8 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase = new TableMappingBase(data, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Id")!, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Blob")!, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)blobColumnBase, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); var tableMappings = new List(); data.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -8624,8 +8624,8 @@ private IRelationalModel CreateRelationalModel() var dataTableMapping = new TableMapping(data, dataTable, true); dataTable.AddTypeMapping(dataTableMapping, false); tableMappings.Add(dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Id")!, data.FindProperty("Id")!, dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Blob")!, data.FindProperty("Blob")!, dataTableMapping); + RelationalModel.CreateColumnMapping(idColumn, data.FindProperty("Id")!, dataTableMapping); + RelationalModel.CreateColumnMapping(blobColumn, data.FindProperty("Blob")!, dataTableMapping); return relationalModel.MakeReadOnly(); } } @@ -8812,8 +8812,8 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase = new TableMappingBase(data, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Id")!, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Blob")!, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)blobColumnBase, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); var tableMappings = new List(); data.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -8839,8 +8839,8 @@ private IRelationalModel CreateRelationalModel() var dataTableMapping = new TableMapping(data, dataTable, true); dataTable.AddTypeMapping(dataTableMapping, false); tableMappings.Add(dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Id")!, data.FindProperty("Id")!, dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Blob")!, data.FindProperty("Blob")!, dataTableMapping); + RelationalModel.CreateColumnMapping(idColumn, data.FindProperty("Id")!, dataTableMapping); + RelationalModel.CreateColumnMapping(blobColumn, data.FindProperty("Blob")!, dataTableMapping); return relationalModel.MakeReadOnly(); } } @@ -9037,9 +9037,9 @@ private IRelationalModel CreateRelationalModel() var microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase = new TableMappingBase(data, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase, true); microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase, false); defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Id")!, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Blob")!, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); - RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataTableBase.FindColumn("Point")!, data.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)blobColumnBase, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)pointColumnBase, data.FindProperty("Point")!, microsoftEntityFrameworkCoreScaffoldingInternalCSharpRuntimeModelCodeGeneratorTestDataMappingBase); var tableMappings = new List(); data.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); @@ -9068,9 +9068,9 @@ private IRelationalModel CreateRelationalModel() var dataTableMapping = new TableMapping(data, dataTable, true); dataTable.AddTypeMapping(dataTableMapping, false); tableMappings.Add(dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Id")!, data.FindProperty("Id")!, dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Blob")!, data.FindProperty("Blob")!, dataTableMapping); - RelationalModel.CreateColumnMapping(dataTable.FindColumn("Point")!, data.FindProperty("Point")!, dataTableMapping); + RelationalModel.CreateColumnMapping(idColumn, data.FindProperty("Id")!, dataTableMapping); + RelationalModel.CreateColumnMapping(blobColumn, data.FindProperty("Blob")!, dataTableMapping); + RelationalModel.CreateColumnMapping(pointColumn, data.FindProperty("Point")!, dataTableMapping); return relationalModel.MakeReadOnly(); } } diff --git a/test/EFCore.NativeAotTests/CompiledModels/NativeAotContextModelBuilder.cs b/test/EFCore.NativeAotTests/CompiledModels/NativeAotContextModelBuilder.cs index 3375782ab20..3563da6a9ec 100644 --- a/test/EFCore.NativeAotTests/CompiledModels/NativeAotContextModelBuilder.cs +++ b/test/EFCore.NativeAotTests/CompiledModels/NativeAotContextModelBuilder.cs @@ -1,5 +1,7 @@ // using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Update.Internal; #pragma warning disable 219, 612, 618 #nullable enable @@ -17,6 +19,54 @@ partial void Initialize() AddAnnotation("ProductVersion", "8.0.0-dev"); AddAnnotation("Relational:MaxIdentifierLength", 128); AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + AddRuntimeAnnotation("Relational:RelationalModel", CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var user = FindEntityType("Microsoft.EntityFrameworkCore.NativeAotTests.Models.User")!; + + var defaultTableMappings = new List>(); + user.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase = new TableBase("Microsoft.EntityFrameworkCore.NativeAotTests.Models.User", null, relationalModel); + var idColumnBase = new ColumnBase("Id", "int", microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase); + microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase.Columns.Add("Id", idColumnBase); + var nameColumnBase = new ColumnBase("Name", "nvarchar(max)", microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase); + microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase.Columns.Add("Name", nameColumnBase); + relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.NativeAotTests.Models.User", microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase); + var microsoftEntityFrameworkCoreNativeAotTestsModelsUserMappingBase = new TableMappingBase(user, microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase, true); + microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase.AddTypeMapping(microsoftEntityFrameworkCoreNativeAotTestsModelsUserMappingBase, false); + defaultTableMappings.Add(microsoftEntityFrameworkCoreNativeAotTestsModelsUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase.FindColumn("Id")!, user.FindProperty("Id")!, microsoftEntityFrameworkCoreNativeAotTestsModelsUserMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)microsoftEntityFrameworkCoreNativeAotTestsModelsUserTableBase.FindColumn("Name")!, user.FindProperty("Name")!, microsoftEntityFrameworkCoreNativeAotTestsModelsUserMappingBase); + + var tableMappings = new List(); + user.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var usersTable = new Table("Users", null, relationalModel); + var idColumn = new Column("Id", "int", usersTable); + idColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(idColumn); + usersTable.Columns.Add("Id", idColumn); + var nameColumn = new Column("Name", "nvarchar(max)", usersTable); + nameColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(nameColumn); + usersTable.Columns.Add("Name", nameColumn); + var pK_Users = new UniqueConstraint("PK_Users", usersTable, new[] { idColumn }); + usersTable.PrimaryKey = pK_Users; + var pK_UsersUc = RelationalModel.GetKey(this, + "Microsoft.EntityFrameworkCore.NativeAotTests.Models.User", + new[] { "Id" }); + pK_Users.MappedKeys.Add(pK_UsersUc); + RelationalModel.GetOrCreateUniqueConstraints(pK_UsersUc).Add(pK_Users); + usersTable.UniqueConstraints.Add("PK_Users", pK_Users); + relationalModel.Tables.Add(("Users", null), usersTable); + var usersTableMapping = new TableMapping(user, usersTable, true); + usersTable.AddTypeMapping(usersTableMapping, false); + tableMappings.Add(usersTableMapping); + RelationalModel.CreateColumnMapping(idColumn, user.FindProperty("Id")!, usersTableMapping); + RelationalModel.CreateColumnMapping(nameColumn, user.FindProperty("Name")!, usersTableMapping); + pK_Users.SetRowKeyValueFactory(new SimpleRowKeyValueFactory(pK_Users)); + return relationalModel.MakeReadOnly(); } } } diff --git a/test/EFCore.NativeAotTests/CompiledModels/UserEntityType.cs b/test/EFCore.NativeAotTests/CompiledModels/UserEntityType.cs index af40f39c4d5..2021fbc36b2 100644 --- a/test/EFCore.NativeAotTests/CompiledModels/UserEntityType.cs +++ b/test/EFCore.NativeAotTests/CompiledModels/UserEntityType.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.NativeAotTests.Models; +using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; #pragma warning disable 219, 612, 618 #nullable enable @@ -27,6 +28,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? ba fieldInfo: typeof(User).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0, valueComparer: ValueComparer.CreateDefault(favorStructuralComparisons: false), providerValueComparer: ValueComparer.CreateDefault(favorStructuralComparisons: true)); id.SetSetter((User e, int v) => e.Id = v); @@ -49,6 +51,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? ba (InternalEntityEntry e) => e.ReadOriginalValue(id, 0), (InternalEntityEntry e) => e.ReadRelationshipSnapshotValue(id, 0), valueBuffer => valueBuffer[0]!)); + id.TypeMapping = SqlServerTypeMappingSource.Int; id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var name = runtimeEntityType.AddProperty( @@ -66,6 +69,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? ba (InternalEntityEntry e) => e.ReadOriginalValue(name, 1), (InternalEntityEntry e) => e.ReadRelationshipSnapshotValue(name, 1), valueBuffer => valueBuffer[1]!)); + name.TypeMapping = SqlServerTypeMappingSource.VariableLengthMaxUnicodeString; name.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var key = runtimeEntityType.AddKey( diff --git a/test/EFCore.NativeAotTests/EndToEnd.cs b/test/EFCore.NativeAotTests/EndToEnd.cs index 7511645cb9a..9af467ec7ba 100644 --- a/test/EFCore.NativeAotTests/EndToEnd.cs +++ b/test/EFCore.NativeAotTests/EndToEnd.cs @@ -1,16 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.EntityFrameworkCore.NativeAotTests.Models; +//using Microsoft.EntityFrameworkCore.NativeAotTests.Models; -// using var context = new NativeAotContext(); +//using var context = new NativeAotContext(); -// context.Database.EnsureDeleted(); -// context.Database.EnsureCreated(); - -// context.Add(new User { Name = "Andriy" }); -// await context.SaveChangesAsync(); - -// Console.WriteLine(context.Users.First().Id); +//context.Add(new User { Name = "Andriy" }); +//await context.SaveChangesAsync(); return 100;