From 952bec97fa8d7c1fd048dd3b6a690ba5c7db2996 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 23 May 2026 23:50:57 +0800 Subject: [PATCH 01/43] Update .NET SDK and package dependencies to latest versions --- Dependencies.targets | 16 ++++++++-------- global.json | 2 +- .../EFCore.Jet.FunctionalTests.csproj | 2 +- test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Dependencies.targets b/Dependencies.targets index ebab4e47..52d8f3df 100644 --- a/Dependencies.targets +++ b/Dependencies.targets @@ -1,8 +1,8 @@ - [10.0.5,10.0.999] - [10.0.5,10.0.999] - [10.0.5,10.0.999] + [10.0.8,10.0.999] + [10.0.8,10.0.999] + [10.0.8,10.0.999] @@ -14,7 +14,7 @@ - + @@ -28,10 +28,10 @@ - - - - + + + + diff --git a/global.json b/global.json index 20008430..98c1f6d9 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.201", + "version": "10.0.300", "allowPrerelease": true, "rollForward": "latestFeature" } diff --git a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj index 01ab4d65..65edce24 100644 --- a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj +++ b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj @@ -15,7 +15,7 @@ - + diff --git a/test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj b/test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj index 8f06624c..9b01a45f 100644 --- a/test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj +++ b/test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj @@ -34,7 +34,7 @@ - + From 1ab5734bb13b019601573756aac64d8b2586500b Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 23 May 2026 23:52:13 +0800 Subject: [PATCH 02/43] Improve Jet string function translation and add string.Join Enhance translation of string functions for Jet provider: - Add CASE handling for MID index -1 in JetStringMethodTranslator - Implement string.Join(string, string[]) translation via concatenation - Update tests for new SQL logic --- .../Internal/JetStringMethodTranslator.cs | 9 ++++++ .../JetSqlTranslatingExpressionVisitor.cs | 32 +++++++++++++++++++ .../Translations/StringTranslationsJetTest.cs | 14 ++++---- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs index 8349d378..43ad70cb 100644 --- a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs +++ b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs @@ -190,6 +190,15 @@ private static readonly MethodInfo _lastOrDefaultMethodInfoWithoutArgs { argument = _sqlExpressionFactory.Coalesce(argument, _sqlExpressionFactory.Constant(0)); } + + argument = _sqlExpressionFactory.Case( + [ + new CaseWhenClause( + _sqlExpressionFactory.Equal(argument, _sqlExpressionFactory.Constant(-1)), + _sqlExpressionFactory.Constant(0)) + ], + argument); + return _sqlExpressionFactory.Function( "MID", [ diff --git a/src/EFCore.Jet/Query/Internal/JetSqlTranslatingExpressionVisitor.cs b/src/EFCore.Jet/Query/Internal/JetSqlTranslatingExpressionVisitor.cs index 2792f697..f5b1d430 100644 --- a/src/EFCore.Jet/Query/Internal/JetSqlTranslatingExpressionVisitor.cs +++ b/src/EFCore.Jet/Query/Internal/JetSqlTranslatingExpressionVisitor.cs @@ -82,6 +82,9 @@ private static readonly MethodInfo StringContainsMethodInfoChar private static readonly MethodInfo EscapeLikePatternParameterMethod = typeof(JetSqlTranslatingExpressionVisitor).GetTypeInfo().GetDeclaredMethod(nameof(ConstructLikePatternParameter))!; + private static readonly MethodInfo StringJoinMethodInfo + = typeof(string).GetRuntimeMethod(nameof(string.Join), [typeof(string), typeof(string[])])!; + private const char LikeEscapeChar = '\\'; private const string LikeEscapeString = "\\"; @@ -246,6 +249,35 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp return translation3; } + if (method == StringJoinMethodInfo + && methodCallExpression.Arguments[1] is NewArrayExpression newArrayExpression + && Visit(methodCallExpression.Arguments[0]) is SqlExpression separator) + { + var stringTypeMapping = separator.TypeMapping; + + SqlExpression? result = null; + + foreach (var expression in newArrayExpression.Expressions) + { + if (Visit(expression) is not SqlExpression translated) + { + return QueryCompilationContext.NotTranslatedExpression; + } + + translated = _sqlExpressionFactory.Coalesce( + _sqlExpressionFactory.ApplyTypeMapping(translated, stringTypeMapping), + _sqlExpressionFactory.Constant(string.Empty, stringTypeMapping)); + + result = result is null + ? translated + : _sqlExpressionFactory.Add( + _sqlExpressionFactory.Add(result, separator), + translated); + } + + return result ?? _sqlExpressionFactory.Constant(string.Empty, stringTypeMapping); + } + return base.VisitMethodCall(methodCallExpression); bool TryTranslateStartsEndsWithContains( diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs index 99e38ba1..823f837d 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs @@ -422,9 +422,9 @@ public override async Task Substring_with_two_args_with_IndexOf() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE [b].[String] LIKE N'%a%' AND SUBSTRING([b].[String], (CAST(CHARINDEX(N'a', [b].[String]) AS int) - 1) + 1, 3) = N'att' +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`String` LIKE '%a%') AND MID(`b`.`String`, IIF((INSTR(1, `b`.`String`, 'a', 1) - 1) = -1, 0, INSTR(1, `b`.`String`, 'a', 1) - 1) + 1, 3) = 'att' """); } @@ -1372,11 +1372,11 @@ public override async Task Join_non_aggregate() AssertSql( """ -@foo='foo' (Size = 4000) +@foo='foo' (Size = 255) -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONCAT_WS(N'|', [b].[String], @foo, N'', N'bar') = N'Seattle|foo||bar' +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ((((((`b`.`String` & '|') & @foo) & '|') & '') & '|') & 'bar') = 'Seattle|foo||bar' """); } From b631f1401e9a8c675fd10e881bd5fc136652bcc3 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 23 May 2026 23:53:08 +0800 Subject: [PATCH 03/43] Refactor Jet concurrency tests for List row versions Refactored F1JetFixture to use a custom value converter and comparer for List as row version. Extended OptimisticConcurrencyJetTest to cover TPH, TPT, and TPC mappings with List row versions. Removed F1ULongJetFixture and improved test clarity and coverage for custom concurrency token types. --- .../F1JetFixture.cs | 102 ++- .../OptimisticConcurrencyJetTest.cs | 597 +++++++++--------- 2 files changed, 390 insertions(+), 309 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs b/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs index 4f9ca569..19701478 100644 --- a/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs @@ -2,23 +2,97 @@ using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.TestModels.ConcurrencyModel; using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; + +#nullable disable namespace EntityFrameworkCore.Jet.FunctionalTests { - public class F1ULongJetFixture : F1JetFixtureBase - { - } - public class F1JetFixture : F1JetFixtureBase { + protected override void BuildModelExternal(ModelBuilder modelBuilder) + { + base.BuildModelExternal(modelBuilder); + + var converter = new BinaryVersionConverter(); + var comparer = new BinaryVersionComparer(); + + modelBuilder + .Entity() + .Property(e => e.BinaryVersion) + .HasConversion(converter, comparer) + .IsRowVersion(); + + modelBuilder + .Entity() + .Property(e => e.BinaryVersion) + .HasConversion(converter, comparer) + .IsRowVersion(); + + modelBuilder + .Entity() + .Property(e => e.BinaryVersion) + .HasConversion(converter, comparer) + .IsRowVersion(); + + modelBuilder + .Entity() + .Property(e => e.BinaryVersion) + .HasConversion(converter, comparer) + .IsRowVersion(); + + modelBuilder + .Entity() + .Property(e => e.BinaryVersion) + .HasConversion(converter, comparer) + .IsRowVersion(); + + modelBuilder + .Entity() + .Property(e => e.BinaryVersion) + .HasConversion(converter, comparer) + .IsRowVersion(); + } + + private class BinaryVersionConverter() : ValueConverter, byte[]>( + v => v == null ? null : v.ToArray(), + v => v == null ? null : v.ToList()); + + private class BinaryVersionComparer() : ValueComparer>( + (l, r) => (l == null && r == null) || (l != null && r != null && l.SequenceEqual(r)), + v => CalculateHashCode(v), + v => v == null ? null : v.ToList()) + { + private static int CalculateHashCode(List source) + { + if (source == null) + { + return 0; + } + + var hash = new HashCode(); + foreach (var el in source) + { + hash.Add(el); + } + + return hash.ToHashCode(); + } + } } public abstract class F1JetFixtureBase : F1RelationalFixture { - protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; - + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + public override TestHelpers TestHelpers => JetTestHelpers.Instance; @@ -26,27 +100,11 @@ protected override void BuildModelExternal(ModelBuilder modelBuilder) { base.BuildModelExternal(modelBuilder); - modelBuilder.Entity().Property("Version").IsRowVersion(); - modelBuilder.Entity().Property("Version").IsRowVersion(); - - modelBuilder.Entity().Property("Version") - .ValueGeneratedOnAddOrUpdate() - .IsConcurrencyToken(); - - modelBuilder.Entity( - eb => - { - eb.Property("Version").IsRowVersion().HasColumnName("Version"); - eb.Property(Sponsor.ClientTokenPropertyName).HasColumnName(Sponsor.ClientTokenPropertyName); - }); modelBuilder.Entity() .OwnsOne( s => s.Details, eb => { eb.Property(d => d.Space).HasColumnType("decimal(18,2)"); - eb.Property("Version").IsRowVersion().HasColumnName("Version"); - eb.Property(Sponsor.ClientTokenPropertyName).IsConcurrencyToken() - .HasColumnName(Sponsor.ClientTokenPropertyName); }); } } diff --git a/test/EFCore.Jet.FunctionalTests/OptimisticConcurrencyJetTest.cs b/test/EFCore.Jet.FunctionalTests/OptimisticConcurrencyJetTest.cs index 3745cf89..f6e3be7e 100644 --- a/test/EFCore.Jet.FunctionalTests/OptimisticConcurrencyJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/OptimisticConcurrencyJetTest.cs @@ -1,364 +1,388 @@ -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Linq; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.TestModels.ConcurrencyModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Xunit; -#nullable disable + // ReSharper disable InconsistentNaming -namespace EntityFrameworkCore.Jet.FunctionalTests +namespace EntityFrameworkCore.Jet.FunctionalTests; + +#nullable disable + +public class OptimisticConcurrencyJetTest(F1JetFixture fixture) + : OptimisticConcurrencyJetTestBase(fixture) { - public class OptimisticConcurrencyULongJetTest(F1ULongJetFixture fixture) - : OptimisticConcurrencyJetTestBase(fixture); + [ConditionalTheory, InlineData(true), InlineData(false)] + public Task Row_version_with_TPH_and_owned_types(bool updateOwnedFirst) + => Row_version_with_owned_types>(updateOwnedFirst, Mapping.Tph, "BinaryVersion"); - public class OptimisticConcurrencyJetTest(F1JetFixture fixture) - : OptimisticConcurrencyJetTestBase(fixture); + [ConditionalTheory, InlineData(true), InlineData(false)] + public Task Row_version_with_TPT_and_owned_types(bool updateOwnedFirst) + => Row_version_with_owned_types>(updateOwnedFirst, Mapping.Tpt, "BinaryVersion"); - public abstract class OptimisticConcurrencyJetTestBase(TFixture fixture) - : OptimisticConcurrencyRelationalTestBase(fixture) - where TFixture : F1RelationalFixture, new() - { - protected enum Mapping - { - Tph, - Tpt, - Tpc - } - - protected async Task Row_version_with_owned_types(bool updateOwnedFirst, Mapping mapping, string propertyName) - where TEntity : class, ISuperFan - { - await using var c = CreateF1Context(); - - await c.Database.CreateExecutionStrategy().ExecuteAsync( - c, async context => - { - var synthesizedPropertyName = $"_TableSharingConcurrencyTokenConvention_{propertyName}"; + [ConditionalTheory, InlineData(true), InlineData(false)] + public Task Row_version_with_TPC_and_owned_types(bool updateOwnedFirst) + => Row_version_with_owned_types>(updateOwnedFirst, Mapping.Tpc, "BinaryVersion"); + + [ConditionalTheory, InlineData(true), InlineData(false)] + public Task Ulong_row_version_with_TPH_and_table_splitting(bool updateDependentFirst) + => Row_version_with_table_splitting>(updateDependentFirst, Mapping.Tph, "BinaryVersion"); + + [ConditionalTheory, InlineData(true), InlineData(false)] + public Task Ulong_row_version_with_TPT_and_table_splitting(bool updateDependentFirst) + => Row_version_with_table_splitting>(updateDependentFirst, Mapping.Tpt, "BinaryVersion"); + + [ConditionalTheory, InlineData(true), InlineData(false)] + public Task Ulong_row_version_with_TPC_and_table_splitting(bool updateDependentFirst) + => Row_version_with_table_splitting>(updateDependentFirst, Mapping.Tpc, "BinaryVersion"); +} - await using var transaction = BeginTransaction(context.Database); +public abstract class OptimisticConcurrencyJetTestBase(TFixture fixture) + : OptimisticConcurrencyRelationalTestBase(fixture) + where TFixture : F1RelationalFixture, new() +{ + protected enum Mapping + { + Tph, + Tpt, + Tpc + } - var fan = context.Set().Single(e => e.Name == "Alice"); + protected async Task Row_version_with_owned_types(bool updateOwnedFirst, Mapping mapping, string propertyName) + where TEntity : class, ISuperFan + { + await using var c = CreateF1Context(); - var fanEntry = c.Entry(fan); - var swagEntry = fanEntry.Reference(s => s.Swag).TargetEntry!; - var fanVersion1 = fanEntry.Property(propertyName).CurrentValue; - var swagVersion1 = default(TVersion); + await c.Database.CreateExecutionStrategy().ExecuteAsync( + c, async context => + { + var synthesizedPropertyName = $"_TableSharingConcurrencyTokenConvention_{propertyName}"; - if (mapping == Mapping.Tph) // Issue #29750 - { - swagVersion1 = swagEntry.Property(synthesizedPropertyName).CurrentValue; + await using var transaction = BeginTransaction(context.Database); - Assert.Equal(fanVersion1, swagVersion1); - } + var fan = context.Set().Single(e => e.Name == "Alice"); - await using var innerContext = CreateF1Context(); - UseTransaction(innerContext.Database, transaction); - var fanInner = innerContext.Set().Single(e => e.Name == "Alice"); + var fanEntry = c.Entry(fan); + var swagEntry = fanEntry.Reference(s => s.Swag).TargetEntry!; + var fanVersion1 = fanEntry.Property(propertyName).CurrentValue; + var swagVersion1 = default(TVersion); - if (updateOwnedFirst) - { - fan.Swag.Stuff += "+"; - fanInner.Swag.Stuff += "-"; - } - else - { - fanInner.Name += "-"; - fan.Name += "+"; - } + if (mapping != Mapping.Tpt) // Issue #22060 + { + swagVersion1 = swagEntry.Property(synthesizedPropertyName).CurrentValue; - await innerContext.SaveChangesAsync(); + Assert.Equal(fanVersion1, swagVersion1); + } - if (updateOwnedFirst && mapping == Mapping.Tpt) // Issue #22060 - { - await context.SaveChangesAsync(); - return; - } + await using var innerContext = CreateF1Context(); + UseTransaction(innerContext.Database, transaction); + var fanInner = innerContext.Set().Single(e => e.Name == "Alice"); - await Assert.ThrowsAnyAsync(() => context.SaveChangesAsync()); + if (updateOwnedFirst) + { + fan.Swag.Stuff += "+"; + fanInner.Swag.Stuff += "-"; + } + else + { + fanInner.Name += "-"; + fan.Name += "+"; + } - await fanEntry.ReloadAsync(); - await swagEntry.ReloadAsync(); + await innerContext.SaveChangesAsync(); + if (updateOwnedFirst && mapping == Mapping.Tpt) // Issue #22060 + { await context.SaveChangesAsync(); + return; + } - var fanVersion2 = fanEntry.Property(propertyName).CurrentValue; - Assert.NotEqual(fanVersion1, fanVersion2); + await Assert.ThrowsAnyAsync(() => context.SaveChangesAsync()); - var swagVersion2 = default(TVersion); - if (mapping == Mapping.Tph) // Issue #29750 - { - swagVersion2 = swagEntry.Property(synthesizedPropertyName).CurrentValue; - Assert.Equal(fanVersion2, swagVersion2); - Assert.NotEqual(swagVersion1, swagVersion2); - } + await fanEntry.ReloadAsync(); + await swagEntry.ReloadAsync(); - await innerContext.Entry(fanInner).ReloadAsync(); - await innerContext.Entry(fanInner.Swag).ReloadAsync(); + await context.SaveChangesAsync(); - if (updateOwnedFirst) - { - fanInner.Name += "-"; - fan.Name += "+"; - } - else - { - fan.Swag.Stuff += "+"; - fanInner.Swag.Stuff += "-"; - } + var fanVersion2 = fanEntry.Property(propertyName).CurrentValue; + Assert.NotEqual(fanVersion1, fanVersion2); - await innerContext.SaveChangesAsync(); + var swagVersion2 = default(TVersion); + if (mapping != Mapping.Tpt) // Issue #22060 + { + swagVersion2 = swagEntry.Property(synthesizedPropertyName).CurrentValue; + Assert.Equal(fanVersion2, swagVersion2); + Assert.NotEqual(swagVersion1, swagVersion2); + } - if (!updateOwnedFirst && mapping == Mapping.Tpt) // Issue #22060 - { - await context.SaveChangesAsync(); - return; - } + await innerContext.Entry(fanInner).ReloadAsync(); + await innerContext.Entry(fanInner.Swag).ReloadAsync(); - await Assert.ThrowsAnyAsync(() => context.SaveChangesAsync()); + if (updateOwnedFirst) + { + fanInner.Name += "-"; + fan.Name += "+"; + } + else + { + fan.Swag.Stuff += "+"; + fanInner.Swag.Stuff += "-"; + } - await fanEntry.ReloadAsync(); - await swagEntry.ReloadAsync(); + await innerContext.SaveChangesAsync(); + if (!updateOwnedFirst && mapping == Mapping.Tpt) // Issue #22060 + { await context.SaveChangesAsync(); + return; + } - var fanVersion3 = fanEntry.Property(propertyName).CurrentValue; - Assert.NotEqual(fanVersion2, fanVersion3); - - if (mapping == Mapping.Tph) // Issue #29750 - { - var swagVersion3 = swagEntry.Property(synthesizedPropertyName).CurrentValue; - Assert.Equal(fanVersion3, swagVersion3); - Assert.NotEqual(swagVersion2, swagVersion3); - } - }); - } - - protected async Task Row_version_with_table_splitting( - bool updateDependentFirst, - Mapping mapping, - string propertyName) - where TEntity : class, IStreetCircuit - where TCity : class, ICity - { - await using var c = CreateF1Context(); - - await c.Database.CreateExecutionStrategy().ExecuteAsync( - c, async context => - { - var synthesizedPropertyName = $"_TableSharingConcurrencyTokenConvention_{propertyName}"; + await Assert.ThrowsAnyAsync(() => context.SaveChangesAsync()); - await using var transaction = BeginTransaction(context.Database); + await fanEntry.ReloadAsync(); + await swagEntry.ReloadAsync(); - var circuit = context.Set().Include(e => e.City).Single(e => e.Name == "Monaco"); + await context.SaveChangesAsync(); - var circuitEntry = c.Entry(circuit); - var cityEntry = circuitEntry.Reference(s => s.City).TargetEntry!; - var circuitVersion1 = circuitEntry.Property(propertyName).CurrentValue; - var cityVersion1 = default(TVersion); + var fanVersion3 = fanEntry.Property(propertyName).CurrentValue; + Assert.NotEqual(fanVersion2, fanVersion3); - if (mapping == Mapping.Tph) // Issue #29750 - { - cityVersion1 = cityEntry.Property(synthesizedPropertyName).CurrentValue; + if (mapping != Mapping.Tpt) // Issue #22060 + { + var swagVersion3 = swagEntry.Property(synthesizedPropertyName).CurrentValue; + Assert.Equal(fanVersion3, swagVersion3); + Assert.NotEqual(swagVersion2, swagVersion3); + } + }); + } - Assert.Equal(circuitVersion1, cityVersion1); - } + protected async Task Row_version_with_table_splitting( + bool updateDependentFirst, + Mapping mapping, + string propertyName) + where TEntity : class, IStreetCircuit + where TCity : class, ICity + { + await using var c = CreateF1Context(); - await using var innerContext = CreateF1Context(); - UseTransaction(innerContext.Database, transaction); - var circuitInner = innerContext.Set().Include(e => e.City).Single(e => e.Name == "Monaco"); + await c.Database.CreateExecutionStrategy().ExecuteAsync( + c, async context => + { + var synthesizedPropertyName = $"_TableSharingConcurrencyTokenConvention_{propertyName}"; - if (updateDependentFirst) - { - circuit.City.Name += "+"; - circuitInner.City.Name += "-"; - } - else - { - circuit.Name += "+"; - circuitInner.Name += "-"; - } + await using var transaction = BeginTransaction(context.Database); - await innerContext.SaveChangesAsync(); + var circuit = context.Set().Include(e => e.City).Single(e => e.Name == "Monaco"); - if (updateDependentFirst && mapping == Mapping.Tpt) // Issue #22060 - { - await context.SaveChangesAsync(); - return; - } + var circuitEntry = c.Entry(circuit); + var cityEntry = circuitEntry.Reference(s => s.City).TargetEntry!; + var circuitVersion1 = circuitEntry.Property(propertyName).CurrentValue; + var cityVersion1 = default(TVersion); - await Assert.ThrowsAnyAsync(() => context.SaveChangesAsync()); + if (mapping != Mapping.Tpt) // Issue #22060 + { + cityVersion1 = cityEntry.Property(synthesizedPropertyName).CurrentValue; - await circuitEntry.ReloadAsync(); - await cityEntry.ReloadAsync(); + Assert.Equal(circuitVersion1, cityVersion1); + } - await context.SaveChangesAsync(); + await using var innerContext = CreateF1Context(); + UseTransaction(innerContext.Database, transaction); + var circuitInner = innerContext.Set().Include(e => e.City).Single(e => e.Name == "Monaco"); - var circuitVersion2 = circuitEntry.Property(propertyName).CurrentValue; - Assert.NotEqual(circuitVersion1, circuitVersion2); + if (updateDependentFirst) + { + circuit.City.Name += "+"; + circuitInner.City.Name += "-"; + } + else + { + circuit.Name += "+"; + circuitInner.Name += "-"; + } - var cityVersion2 = default(TVersion); - if (mapping == Mapping.Tph) // Issue #29750 - { - cityVersion2 = cityEntry.Property(synthesizedPropertyName).CurrentValue; - Assert.Equal(circuitVersion2, cityVersion2); - Assert.NotEqual(cityVersion1, cityVersion2); - } + await innerContext.SaveChangesAsync(); - await innerContext.Entry(circuitInner).ReloadAsync(); - await innerContext.Entry(circuitInner.City).ReloadAsync(); + if (updateDependentFirst && mapping == Mapping.Tpt) // Issue #22060 + { + await context.SaveChangesAsync(); + return; + } - if (updateDependentFirst) - { - circuit.Name += "+"; - circuitInner.Name += "-"; - } - else - { - circuit.City.Name += "+"; - circuitInner.City.Name += "-"; - } + await Assert.ThrowsAnyAsync(() => context.SaveChangesAsync()); - await innerContext.SaveChangesAsync(); + await circuitEntry.ReloadAsync(); + await cityEntry.ReloadAsync(); - if (!updateDependentFirst && mapping == Mapping.Tpt) // Issue #22060 - { - await context.SaveChangesAsync(); - return; - } + await context.SaveChangesAsync(); - await Assert.ThrowsAnyAsync(() => context.SaveChangesAsync()); + var circuitVersion2 = circuitEntry.Property(propertyName).CurrentValue; + Assert.NotEqual(circuitVersion1, circuitVersion2); - await circuitEntry.ReloadAsync(); - await cityEntry.ReloadAsync(); + var cityVersion2 = default(TVersion); + if (mapping != Mapping.Tpt) // Issue #22060 + { + cityVersion2 = cityEntry.Property(synthesizedPropertyName).CurrentValue; + Assert.Equal(circuitVersion2, cityVersion2); + Assert.NotEqual(cityVersion1, cityVersion2); + } - await context.SaveChangesAsync(); + await innerContext.Entry(circuitInner).ReloadAsync(); + await innerContext.Entry(circuitInner.City).ReloadAsync(); - var circuitVersion3 = circuitEntry.Property(propertyName).CurrentValue; - Assert.NotEqual(circuitVersion2, circuitVersion3); - - if (mapping == Mapping.Tph) // Issue #29750 - { - var cityVersion3 = cityEntry.Property(synthesizedPropertyName).CurrentValue; - Assert.Equal(circuitVersion3, cityVersion3); - Assert.NotEqual(cityVersion2, cityVersion3); - } - }); - } - - [ConditionalFact] - public async Task Modifying_concurrency_token_only_is_noop() - { - using var c = CreateF1Context(); - await c.Database.CreateExecutionStrategy().ExecuteAsync( - c, async context => + if (updateDependentFirst) + { + circuit.Name += "+"; + circuitInner.Name += "-"; + } + else + { + circuit.City.Name += "+"; + circuitInner.City.Name += "-"; + } + + await innerContext.SaveChangesAsync(); + + if (!updateDependentFirst && mapping == Mapping.Tpt) // Issue #22060 { - using var transaction = context.Database.BeginTransaction(); - var driver = context.Drivers.Single(d => d.CarNumber == 1); - driver.Podiums = StorePodiums; - var firstVersion = context.Entry(driver).Property("Version").CurrentValue; await context.SaveChangesAsync(); + return; + } + + await Assert.ThrowsAnyAsync(() => context.SaveChangesAsync()); + + await circuitEntry.ReloadAsync(); + await cityEntry.ReloadAsync(); + + await context.SaveChangesAsync(); + + var circuitVersion3 = circuitEntry.Property(propertyName).CurrentValue; + Assert.NotEqual(circuitVersion2, circuitVersion3); - using var innerContext = CreateF1Context(); - innerContext.Database.UseTransaction(transaction.GetDbTransaction()); - driver = innerContext.Drivers.Single(d => d.CarNumber == 1); - Assert.NotEqual(firstVersion, innerContext.Entry(driver).Property("Version").CurrentValue); - Assert.Equal(StorePodiums, driver.Podiums); - - var secondVersion = innerContext.Entry(driver).Property("Version").CurrentValue; - innerContext.Entry(driver).Property("Version").CurrentValue = firstVersion; - await innerContext.SaveChangesAsync(); - using var validationContext = CreateF1Context(); - validationContext.Database.UseTransaction(transaction.GetDbTransaction()); - driver = validationContext.Drivers.Single(d => d.CarNumber == 1); - Assert.Equal(secondVersion, validationContext.Entry(driver).Property("Version").CurrentValue); - Assert.Equal(StorePodiums, driver.Podiums); - }); - } - - [ConditionalFact] - public async Task Database_concurrency_token_value_is_updated_for_all_sharing_entities() - { - using var c = CreateF1Context(); - await c.Database.CreateExecutionStrategy().ExecuteAsync( - c, async context => + if (mapping != Mapping.Tpt) // Issue #22060 { - using var transaction = context.Database.BeginTransaction(); - var sponsor = context.Set().Single(); - var sponsorEntry = c.Entry(sponsor); - var detailsEntry = sponsorEntry.Reference(s => s.Details).TargetEntry; - var sponsorVersion = sponsorEntry.Property("Version").CurrentValue; - var detailsVersion = detailsEntry.Property("Version").CurrentValue; + var cityVersion3 = cityEntry.Property(synthesizedPropertyName).CurrentValue; + Assert.Equal(circuitVersion3, cityVersion3); + Assert.NotEqual(cityVersion2, cityVersion3); + } + }); + } - Assert.Null(sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); - sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue = 1; + [ConditionalFact] + public async Task Modifying_concurrency_token_only_is_noop() + { + using var c = CreateF1Context(); + await c.Database.CreateExecutionStrategy().ExecuteAsync( + c, async context => + { + using var transaction = context.Database.BeginTransaction(); + var driver = context.Drivers.Single(d => d.CarNumber == 1); + driver.Podiums = StorePodiums; + var firstVersion = context.Entry(driver).Property("Version").CurrentValue; + await context.SaveChangesAsync(); + + using var innerContext = CreateF1Context(); + innerContext.Database.UseTransaction(transaction.GetDbTransaction()); + driver = innerContext.Drivers.Single(d => d.CarNumber == 1); + Assert.NotEqual(firstVersion, innerContext.Entry(driver).Property("Version").CurrentValue); + Assert.Equal(StorePodiums, driver.Podiums); + + var secondVersion = innerContext.Entry(driver).Property("Version").CurrentValue; + innerContext.Entry(driver).Property("Version").CurrentValue = firstVersion; + await innerContext.SaveChangesAsync(); + using var validationContext = CreateF1Context(); + validationContext.Database.UseTransaction(transaction.GetDbTransaction()); + driver = validationContext.Drivers.Single(d => d.CarNumber == 1); + Assert.Equal(secondVersion, validationContext.Entry(driver).Property("Version").CurrentValue); + Assert.Equal(StorePodiums, driver.Podiums); + }); + } - sponsor.Name = "Telecom"; + [ConditionalFact] + public async Task Database_concurrency_token_value_is_updated_for_all_sharing_entities() + { + using var c = CreateF1Context(); + await c.Database.CreateExecutionStrategy().ExecuteAsync( + c, async context => + { + using var transaction = context.Database.BeginTransaction(); + var sponsor = context.Set().Single(); + var sponsorEntry = c.Entry(sponsor); + var detailsEntry = sponsorEntry.Reference(s => s.Details).TargetEntry; + var sponsorVersion = sponsorEntry.Property("Version").CurrentValue; + var detailsVersion = detailsEntry.Property("Version").CurrentValue; - Assert.Equal(sponsorVersion, detailsVersion); + Assert.Null(sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); + sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue = 1; - await context.SaveChangesAsync(); + sponsor.Name = "Telecom"; - var newSponsorVersion = sponsorEntry.Property("Version").CurrentValue; - var newDetailsVersion = detailsEntry.Property("Version").CurrentValue; + Assert.Equal(sponsorVersion, detailsVersion); - Assert.Equal(newSponsorVersion, newDetailsVersion); - Assert.NotEqual(sponsorVersion, newSponsorVersion); + await context.SaveChangesAsync(); - Assert.Equal(1, sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); - Assert.Equal(1, detailsEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); - }); - } + var newSponsorVersion = sponsorEntry.Property("Version").CurrentValue; + var newDetailsVersion = detailsEntry.Property("Version").CurrentValue; - [ConditionalFact] - public async Task Original_concurrency_token_value_is_used_when_replacing_owned_instance() - { - using var c = CreateF1Context(); - await c.Database.CreateExecutionStrategy().ExecuteAsync( - c, async context => - { - using var transaction = context.Database.BeginTransaction(); - var sponsor = context.Set().Single(); - var sponsorEntry = c.Entry(sponsor); - var sponsorVersion = sponsorEntry.Property("Version").CurrentValue; + Assert.Equal(newSponsorVersion, newDetailsVersion); + Assert.NotEqual(sponsorVersion, newSponsorVersion); - Assert.Null(sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); - sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue = 1; + Assert.Equal(1, sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); + Assert.Equal(1, detailsEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); + }); + } - sponsor.Details = new SponsorDetails { Days = 11, Space = 51m }; + [ConditionalFact] + public async Task Original_concurrency_token_value_is_used_when_replacing_owned_instance() + { + using var c = CreateF1Context(); + await c.Database.CreateExecutionStrategy().ExecuteAsync( + c, async context => + { + using var transaction = context.Database.BeginTransaction(); + var sponsor = context.Set().Single(); + var sponsorEntry = c.Entry(sponsor); + var sponsorVersion = sponsorEntry.Property("Version").CurrentValue; - context.ChangeTracker.DetectChanges(); + Assert.Null(sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); + sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue = 1; - var detailsEntry = sponsorEntry.Reference(s => s.Details).TargetEntry; - detailsEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue = 1; + sponsor.Details = new SponsorDetails { Days = 11, Space = 51m }; - await context.SaveChangesAsync(); + context.ChangeTracker.DetectChanges(); + + var detailsEntry = sponsorEntry.Reference(s => s.Details).TargetEntry; + detailsEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue = 1; - var newSponsorVersion = sponsorEntry.Property("Version").CurrentValue; - var newDetailsVersion = detailsEntry.Property("Version").CurrentValue; + await context.SaveChangesAsync(); - Assert.Equal(newSponsorVersion, newDetailsVersion); - Assert.NotEqual(sponsorVersion, newSponsorVersion); + var newSponsorVersion = sponsorEntry.Property("Version").CurrentValue; + var newDetailsVersion = detailsEntry.Property("Version").CurrentValue; - Assert.Equal(1, sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); - Assert.Equal(1, detailsEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); - }); - } + Assert.Equal(newSponsorVersion, newDetailsVersion); + Assert.NotEqual(sponsorVersion, newSponsorVersion); - public override void Property_entry_original_value_is_set() - { - base.Property_entry_original_value_is_set(); + Assert.Equal(1, sponsorEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); + Assert.Equal(1, detailsEntry.Property(Sponsor.ClientTokenPropertyName).CurrentValue); + }); + } - AssertSql( - """ + public override void Property_entry_original_value_is_set() + { + base.Property_entry_original_value_is_set(); + + AssertSql( + """ SELECT TOP 1 `e`.`Id`, `e`.`EngineSupplierId`, `e`.`Name`, `e`.`StorageLocation_Latitude`, `e`.`StorageLocation_Longitude` FROM `Engines` AS `e` ORDER BY `e`.`Id` """, - // - """ + // + """ @p0='FO 108X' (Size = 255) @p1='1' @p2='Mercedes' (Size = 255) @@ -370,12 +394,11 @@ ORDER BY `e`.`Id` WHERE `Id` = @p1 AND `EngineSupplierId` = @p2 AND `Name` = @p3 AND `StorageLocation_Latitude` = @p4 AND `StorageLocation_Longitude` = @p5; SELECT @@ROWCOUNT; """); - } + } - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); - protected override void UseTransaction(DatabaseFacade facade, IDbContextTransaction transaction) - => facade.UseTransaction(transaction.GetDbTransaction()); - } + protected override void UseTransaction(DatabaseFacade facade, IDbContextTransaction transaction) + => facade.UseTransaction(transaction.GetDbTransaction()); } From 4506f32ec2ffa4f77ddeea17d740f1d82b781ac4 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 2 Jun 2026 20:36:26 +0800 Subject: [PATCH 04/43] Add the Default properties for the type mapping. Helps prepare for compiled models --- .../Storage/Internal/JetBoolTypeMapping.cs | 2 + .../Internal/JetByteArrayTypeMapping.cs | 2 +- .../Storage/Internal/JetByteTypeMapping.cs | 2 + .../Internal/JetDateOnlyTypeMapping.cs | 11 +-- .../Internal/JetDateTimeOffsetTypeMapping.cs | 15 ++-- .../Internal/JetDateTimeTypeMapping.cs | 68 ++----------------- .../Storage/Internal/JetDecimalTypeMapping.cs | 2 + .../Storage/Internal/JetDoubleTypeMapping.cs | 2 + .../Storage/Internal/JetFloatTypeMapping.cs | 1 + .../Storage/Internal/JetGuidTypeMapping.cs | 2 + .../Storage/Internal/JetIntTypeMapping.cs | 2 + .../Storage/Internal/JetLongTypeMapping.cs | 3 + .../Internal/JetOdbcGuidTypeMapping.cs | 2 + .../Storage/Internal/JetStringTypeMapping.cs | 4 +- .../Internal/JetTimeOnlyTypeMapping.cs | 23 ++----- .../Internal/JetTimeSpanTypeMapping.cs | 11 ++- .../Storage/Internal/JetTypeMappingSource.cs | 33 ++++----- 17 files changed, 62 insertions(+), 123 deletions(-) diff --git a/src/EFCore.Jet/Storage/Internal/JetBoolTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetBoolTypeMapping.cs index 8e1bde9b..66bb9278 100644 --- a/src/EFCore.Jet/Storage/Internal/JetBoolTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetBoolTypeMapping.cs @@ -4,6 +4,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetBoolTypeMapping : BoolTypeMapping { + public static new JetBoolTypeMapping Default { get; } = new("smallint"); + public JetBoolTypeMapping( string storeType, DbType? dbType = System.Data.DbType.Boolean) diff --git a/src/EFCore.Jet/Storage/Internal/JetByteArrayTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetByteArrayTypeMapping.cs index 283eb301..21733afa 100644 --- a/src/EFCore.Jet/Storage/Internal/JetByteArrayTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetByteArrayTypeMapping.cs @@ -12,7 +12,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal /// public class JetByteArrayTypeMapping : ByteArrayTypeMapping { - + public static new JetByteArrayTypeMapping Default { get; } = new(); /// /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. diff --git a/src/EFCore.Jet/Storage/Internal/JetByteTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetByteTypeMapping.cs index 21ad90e2..571370d6 100644 --- a/src/EFCore.Jet/Storage/Internal/JetByteTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetByteTypeMapping.cs @@ -13,6 +13,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal; /// public class JetByteTypeMapping : ByteTypeMapping { + public static new JetByteTypeMapping Default { get; } = new("byte", System.Data.DbType.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 diff --git a/src/EFCore.Jet/Storage/Internal/JetDateOnlyTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetDateOnlyTypeMapping.cs index 2a11e038..5a82d699 100644 --- a/src/EFCore.Jet/Storage/Internal/JetDateOnlyTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetDateOnlyTypeMapping.cs @@ -3,32 +3,27 @@ using System.Data; using System.Globalization; using System.Text; -using EntityFrameworkCore.Jet.Data; -using EntityFrameworkCore.Jet.Infrastructure.Internal; namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetDateOnlyTypeMapping : DateOnlyTypeMapping { - private readonly IJetOptions _options; + public static new JetDateOnlyTypeMapping Default { get; } = new JetDateOnlyTypeMapping("date", dbType: System.Data.DbType.Date); public JetDateOnlyTypeMapping( string storeType, - IJetOptions options, DbType? dbType = null) : base(storeType) { - _options = options; } - protected JetDateOnlyTypeMapping(RelationalTypeMappingParameters parameters, IJetOptions options) + protected JetDateOnlyTypeMapping(RelationalTypeMappingParameters parameters) : base(parameters) { - _options = options; } protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) - => new JetDateOnlyTypeMapping(parameters, _options); + => new JetDateOnlyTypeMapping(parameters); protected override void ConfigureParameter(DbParameter parameter) { diff --git a/src/EFCore.Jet/Storage/Internal/JetDateTimeOffsetTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetDateTimeOffsetTypeMapping.cs index 5b17855d..5149a1d5 100644 --- a/src/EFCore.Jet/Storage/Internal/JetDateTimeOffsetTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetDateTimeOffsetTypeMapping.cs @@ -1,32 +1,31 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Globalization; using EntityFrameworkCore.Jet.Infrastructure.Internal; +using Microsoft.Extensions.Options; +using System.Globalization; namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetDateTimeOffsetTypeMapping : DateTimeOffsetTypeMapping { - private readonly IJetOptions _options; private const string DateTimeOffsetFormatConst = @"'{0:yyyy-MM-ddTHH:mm:ss.fffffffzzz}'"; private const string DateTimeFormatConst = @"'{0:yyyy-MM-dd HH:mm:ss}'"; + + public static new JetDateTimeOffsetTypeMapping Default { get; } = new JetDateTimeOffsetTypeMapping("datetime"); public JetDateTimeOffsetTypeMapping( - string storeType, - IJetOptions options) + string storeType) : base( storeType, System.Data.DbType.DateTime) { - _options = options; } - protected JetDateTimeOffsetTypeMapping(RelationalTypeMappingParameters parameters, IJetOptions options) + protected JetDateTimeOffsetTypeMapping(RelationalTypeMappingParameters parameters) : base(parameters) { - _options = options; } protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) - => new JetDateTimeOffsetTypeMapping(parameters, _options); + => new JetDateTimeOffsetTypeMapping(parameters); protected override void ConfigureParameter(DbParameter parameter) { diff --git a/src/EFCore.Jet/Storage/Internal/JetDateTimeTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetDateTimeTypeMapping.cs index 214e3462..dbb9e6bc 100644 --- a/src/EFCore.Jet/Storage/Internal/JetDateTimeTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetDateTimeTypeMapping.cs @@ -11,27 +11,24 @@ namespace EntityFrameworkCore.Jet.Storage.Internal public class JetDateTimeTypeMapping : DateTimeTypeMapping { private const int MaxDateTimeDoublePrecision = 10; - private static readonly JetDecimalTypeMapping _decimalTypeMapping = new("decimal", System.Data.DbType.Decimal, 18, 10); - private readonly IJetOptions _options; + + public static new JetDateTimeTypeMapping Default { get; } = new JetDateTimeTypeMapping("datetime", dbType: System.Data.DbType.DateTime); public JetDateTimeTypeMapping( string storeType, - IJetOptions options, DbType? dbType = null, Type? clrType = null) : base(storeType) { - _options = options; } - protected JetDateTimeTypeMapping(RelationalTypeMappingParameters parameters, IJetOptions options) + protected JetDateTimeTypeMapping(RelationalTypeMappingParameters parameters) : base(parameters) { - _options = options; } protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) - => new JetDateTimeTypeMapping(parameters, _options); + => new JetDateTimeTypeMapping(parameters); protected override void ConfigureParameter(DbParameter parameter) { @@ -41,16 +38,6 @@ protected override void ConfigureParameter(DbParameter parameter) } base.ConfigureParameter(parameter); - if (_options.EnableMillisecondsSupport && - parameter.Value is DateTime dateTime) - { - parameter.Value = GetDateTimeDoubleValueAsDecimal(dateTime, _options.EnableMillisecondsSupport); - parameter.ResetDbType(); - - // Necessary to explicitly set for OLE DB, to apply the System.Decimal value as DOUBLE to Jet. - parameter.DbType = System.Data.DbType.Double; - } - if ((parameter.DbType == System.Data.DbType.Date || StoreTypeNameBase == "date") && parameter.Value is DateTime date) { parameter.Value = date.Date; @@ -71,12 +58,6 @@ public virtual string GenerateNonNullSqlLiteral(object value, bool defaultClause var literal = new StringBuilder(); - if (defaultClauseCompatible && - _options.EnableMillisecondsSupport) - { - return _decimalTypeMapping.GenerateSqlLiteral(GetDateTimeDoubleValueAsDecimal(dateTime, _options.EnableMillisecondsSupport)); - } - literal.Append( defaultClauseCompatible ? "'" @@ -95,53 +76,12 @@ public virtual string GenerateNonNullSqlLiteral(object value, bool defaultClause ? "'" : "#"); - if (_options.EnableMillisecondsSupport && - time != TimeSpan.Zero) - { - // Round to milliseconds. - var millisecondsTicks = time.Ticks % TimeSpan.TicksPerSecond / TimeSpan.TicksPerMillisecond * TimeSpan.TicksPerMillisecond; - if (millisecondsTicks > 0) - { - var jetTimeDoubleFractions = Math.Round((decimal)millisecondsTicks / TimeSpan.TicksPerDay, MaxDateTimeDoublePrecision); - - literal - .Insert(0, "(") - .Append(" + ") - .Append(_decimalTypeMapping.GenerateSqlLiteral(jetTimeDoubleFractions)) - .Append(")"); - } - } - return literal.ToString(); } protected virtual DateTime ConvertToDateTimeCompatibleValue(object value) => (DateTime)value; - private static decimal GetDateTimeDoubleValueAsDecimal(DateTime dateTime, bool millisecondsSupportEnabled) - { - // - // We are explicitly using System.Decimal here, so we get better scale results: - // - - var checkDateTimeValue = CheckDateTimeValue(dateTime) - JetConfiguration.TimeSpanOffset; - - if (millisecondsSupportEnabled) - { - // Round to milliseconds. - var millisecondsTicks = checkDateTimeValue.Ticks / TimeSpan.TicksPerMillisecond * TimeSpan.TicksPerMillisecond; - var result = /*Math.Round(*/(decimal)millisecondsTicks / TimeSpan.TicksPerDay/*, MaxDateTimeDoublePrecision, MidpointRounding.AwayFromZero)*/; - return result; - } - else - { - // Round to seconds. - var secondsTicks = checkDateTimeValue.Ticks / TimeSpan.TicksPerSecond * TimeSpan.TicksPerSecond; - var result = /*Math.Round(*/(decimal)secondsTicks / TimeSpan.TicksPerDay/*, MaxDateTimeDoublePrecision, MidpointRounding.AwayFromZero)*/; - return result; - } - } - private static DateTime CheckDateTimeValue(DateTime dateTime) { if (dateTime < new DateTime(100,1,1)) diff --git a/src/EFCore.Jet/Storage/Internal/JetDecimalTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetDecimalTypeMapping.cs index fd145321..16840736 100644 --- a/src/EFCore.Jet/Storage/Internal/JetDecimalTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetDecimalTypeMapping.cs @@ -11,6 +11,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal /// public class JetDecimalTypeMapping : DecimalTypeMapping { + + public static new JetDecimalTypeMapping Default { get; } = new("decimal(18,2)", System.Data.DbType.Decimal, precision: 18, scale: 2, StoreTypePostfix.PrecisionAndScale); /// /// 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 diff --git a/src/EFCore.Jet/Storage/Internal/JetDoubleTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetDoubleTypeMapping.cs index 1732a188..3e18431e 100644 --- a/src/EFCore.Jet/Storage/Internal/JetDoubleTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetDoubleTypeMapping.cs @@ -6,6 +6,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetDoubleTypeMapping : DoubleTypeMapping { + public static new JetDoubleTypeMapping Default { get; } = new("double"); + public JetDoubleTypeMapping( string storeType) : base(storeType, System.Data.DbType.Double) diff --git a/src/EFCore.Jet/Storage/Internal/JetFloatTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetFloatTypeMapping.cs index 84e4fd3b..db22830f 100644 --- a/src/EFCore.Jet/Storage/Internal/JetFloatTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetFloatTypeMapping.cs @@ -6,6 +6,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetFloatTypeMapping : FloatTypeMapping { + public static new JetFloatTypeMapping Default { get; } = new("single"); public JetFloatTypeMapping( string storeType) : base(storeType, System.Data.DbType.Single) diff --git a/src/EFCore.Jet/Storage/Internal/JetGuidTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetGuidTypeMapping.cs index 3aa86914..74920be6 100644 --- a/src/EFCore.Jet/Storage/Internal/JetGuidTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetGuidTypeMapping.cs @@ -4,6 +4,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetGuidTypeMapping : GuidTypeMapping { + public static new JetGuidTypeMapping Default { get; } = new JetGuidTypeMapping("uniqueidentifier"); + public JetGuidTypeMapping(string storeType, DbType? dbType = System.Data.DbType.Guid) : base(storeType, dbType) { } diff --git a/src/EFCore.Jet/Storage/Internal/JetIntTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetIntTypeMapping.cs index b294de77..d5bec2f1 100644 --- a/src/EFCore.Jet/Storage/Internal/JetIntTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetIntTypeMapping.cs @@ -2,6 +2,8 @@ public class JetIntTypeMapping : IntTypeMapping { + public static new JetIntTypeMapping Default { get; } = new JetIntTypeMapping("integer"); + public JetIntTypeMapping(string storeType) : base(storeType, System.Data.DbType.Int32) { diff --git a/src/EFCore.Jet/Storage/Internal/JetLongTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetLongTypeMapping.cs index b62e9727..5ffa54f6 100644 --- a/src/EFCore.Jet/Storage/Internal/JetLongTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetLongTypeMapping.cs @@ -4,6 +4,9 @@ namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetLongTypeMapping : LongTypeMapping { + public static new JetLongTypeMapping Default { get; } = new("decimal(20, 0)", precision: 20, scale: 0, + StoreTypePostfix.PrecisionAndScale); + public JetLongTypeMapping(string storeType, int? precision = null, int? scale = null, diff --git a/src/EFCore.Jet/Storage/Internal/JetOdbcGuidTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetOdbcGuidTypeMapping.cs index e8b7a9aa..73867155 100644 --- a/src/EFCore.Jet/Storage/Internal/JetOdbcGuidTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetOdbcGuidTypeMapping.cs @@ -4,6 +4,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetOdbcGuidTypeMapping : JetGuidTypeMapping { + public static new JetOdbcGuidTypeMapping Default { get; } = new JetOdbcGuidTypeMapping("uniqueidentifier"); + public JetOdbcGuidTypeMapping(string storeType) : base(storeType, System.Data.DbType.Guid) { } diff --git a/src/EFCore.Jet/Storage/Internal/JetStringTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetStringTypeMapping.cs index ba10dda0..8e0be35f 100644 --- a/src/EFCore.Jet/Storage/Internal/JetStringTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetStringTypeMapping.cs @@ -14,6 +14,8 @@ public class JetStringTypeMapping : StringTypeMapping private readonly bool _keepLineBreakCharacters; private readonly int _maxSpecificSize; + public static new JetStringTypeMapping Default { get; } = new(); + private static readonly CaseInsensitiveValueComparer CaseInsensitiveValueComparer = new(); /// @@ -22,7 +24,7 @@ public class JetStringTypeMapping : StringTypeMapping /// public JetStringTypeMapping( string? storeType = null, - bool unicode = false, + bool unicode = true , int? size = null, bool fixedLength = false, StoreTypePostfix? storeTypePostfix = null, diff --git a/src/EFCore.Jet/Storage/Internal/JetTimeOnlyTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetTimeOnlyTypeMapping.cs index b8e1772c..2bbd61af 100644 --- a/src/EFCore.Jet/Storage/Internal/JetTimeOnlyTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetTimeOnlyTypeMapping.cs @@ -6,20 +6,16 @@ namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetTimeOnlyTypeMapping : TimeOnlyTypeMapping { - private readonly IJetOptions _options; - + public static new JetTimeOnlyTypeMapping Default { get; } = new JetTimeOnlyTypeMapping("time"); public JetTimeOnlyTypeMapping( - string storeType, - IJetOptions options) + string storeType) : base(storeType) { - _options = options; } - protected JetTimeOnlyTypeMapping(RelationalTypeMappingParameters parameters, IJetOptions options) + protected JetTimeOnlyTypeMapping(RelationalTypeMappingParameters parameters) : base(parameters) { - _options = options; } protected override void ConfigureParameter(DbParameter parameter) @@ -34,20 +30,11 @@ protected override void ConfigureParameter(DbParameter parameter) } protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) - => new JetTimeOnlyTypeMapping(parameters, _options); + => new JetTimeOnlyTypeMapping(parameters); protected override string GenerateNonNullSqlLiteral(object value) { - //Format time without any milliseconds - if (!_options.EnableMillisecondsSupport) - { - return FormattableString.Invariant($@"TIMEVALUE('{value:HH\:mm\:ss}')"); - } - else - { - //TODO: Treat as double - return ""; - } + return FormattableString.Invariant($@"TIMEVALUE('{value:HH\:mm\:ss}')"); } protected override string ProcessStoreType(RelationalTypeMappingParameters parameters, string storeType, string storeTypeNameBase) diff --git a/src/EFCore.Jet/Storage/Internal/JetTimeSpanTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetTimeSpanTypeMapping.cs index 787e67eb..6837f404 100644 --- a/src/EFCore.Jet/Storage/Internal/JetTimeSpanTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetTimeSpanTypeMapping.cs @@ -6,24 +6,21 @@ namespace EntityFrameworkCore.Jet.Storage.Internal { public class JetTimeSpanTypeMapping : TimeSpanTypeMapping { - private readonly IJetOptions _options; + public static new JetTimeSpanTypeMapping Default { get; } = new JetTimeSpanTypeMapping("time"); public JetTimeSpanTypeMapping( - string storeType, - IJetOptions options) + string storeType) : base(storeType) { - _options = options; } - protected JetTimeSpanTypeMapping(RelationalTypeMappingParameters parameters, IJetOptions options) + protected JetTimeSpanTypeMapping(RelationalTypeMappingParameters parameters) : base(parameters) { - _options = options; } protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) - => new JetTimeSpanTypeMapping(parameters, _options); + => new JetTimeSpanTypeMapping(parameters); /*protected override DateTime ConvertToDateTimeCompatibleValue(object value) => JetConfiguration.TimeSpanOffset + (TimeSpan)value;*/ diff --git a/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs b/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs index 0750a6bd..7b1d5928 100644 --- a/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs +++ b/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs @@ -21,19 +21,19 @@ public class JetTypeMappingSource : RelationalTypeMappingSource private readonly JetByteArrayTypeMapping _unboundedBinary = new("longbinary", storeTypePostfix: StoreTypePostfix.None); private readonly JetBoolTypeMapping _bit = new("bit"); // JET bits are not nullable - private readonly JetBoolTypeMapping _bool = new("smallint"); + private readonly JetBoolTypeMapping _bool = JetBoolTypeMapping.Default; // We just map counter etc. to integer. Whether an integer property/column is actually a counter // is determined by the value generation type. - private readonly IntTypeMapping _counter = new JetIntTypeMapping("integer"); + private readonly JetIntTypeMapping _counter = JetIntTypeMapping.Default; - private readonly JetByteTypeMapping _byte = new("byte", DbType.Byte); // unsigned, there is no signed byte in Jet + private readonly JetByteTypeMapping _byte = JetByteTypeMapping.Default; // unsigned, there is no signed byte in Jet private readonly ShortTypeMapping _smallint = new("smallint", DbType.Int16); - private readonly IntTypeMapping _integer = new JetIntTypeMapping("integer"); - private readonly JetLongTypeMapping _bigint = new("decimal(20, 0)", precision: 20, scale: 0, StoreTypePostfix.PrecisionAndScale); + private readonly JetIntTypeMapping _integer = JetIntTypeMapping.Default; + private readonly JetLongTypeMapping _bigint = JetLongTypeMapping.Default; - private readonly JetFloatTypeMapping _single = new("single"); - private readonly JetDoubleTypeMapping _double = new("double"); + private readonly JetFloatTypeMapping _single = JetFloatTypeMapping.Default; + private readonly JetDoubleTypeMapping _double = JetDoubleTypeMapping.Default; private readonly JetDecimalTypeMapping _decimal = new("decimal(18,2)", DbType.Decimal, precision: 18, scale: 2, StoreTypePostfix.PrecisionAndScale); private readonly JetDecimalTypeMapping _decimal18_0 = new("decimal", DbType.Decimal, precision: 18, scale: 0); @@ -80,18 +80,18 @@ public JetTypeMappingSource( // https://sourcedaddy.com/ms-access/sql-data-types.html _guid = options.DataAccessProviderType == DataAccessProviderType.Odbc - ? new JetOdbcGuidTypeMapping("uniqueidentifier") - : new JetGuidTypeMapping("uniqueidentifier", DbType.Guid); + ? JetOdbcGuidTypeMapping.Default + : JetGuidTypeMapping.Default; // TODO: Check the types and their mappings against // https://docs.microsoft.com/en-us/previous-versions/office/developer/office2000/aa140015(v=office.10) - _datetime = new JetDateTimeTypeMapping("datetime", options, dbType: DbType.DateTime); - _dateasdatetime = new JetDateTimeTypeMapping("date", options, dbType: DbType.Date); - _datetimeoffset = new JetDateTimeOffsetTypeMapping("datetime", options); - _dateonly = new JetDateOnlyTypeMapping("date", options, dbType: DbType.Date); - _timeonly = new JetTimeOnlyTypeMapping("time", options); - _timespan = new JetTimeSpanTypeMapping("datetime", options); + _datetime = JetDateTimeTypeMapping.Default; + _dateasdatetime = new JetDateTimeTypeMapping("date", dbType: DbType.Date); + _datetimeoffset = JetDateTimeOffsetTypeMapping.Default; + _dateonly = JetDateOnlyTypeMapping.Default; + _timeonly = JetTimeOnlyTypeMapping.Default; + _timespan = JetTimeSpanTypeMapping.Default; _storeTypeMappings = new Dictionary(StringComparer.OrdinalIgnoreCase) @@ -126,9 +126,10 @@ public JetTypeMappingSource( {"integer2", [_smallint] }, {"integer", [_integer] }, - {"long", [_bigint] }, + {"long", [_bigint] },//is this right {"int", [_integer] }, {"integer4", [_integer] }, + {"bigint", [_bigint] }, {"single", [_single] }, {"real", [_single] }, From e264a630cb58a9112771821a7558b5f077be5885 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 2 Jun 2026 20:38:11 +0800 Subject: [PATCH 05/43] Properly handle Date.ToDateTime --- .../Internal/JetDateOnlyMethodTranslator.cs | 40 ++++++++++++------- .../Internal/JetDateTimeMethodTranslator.cs | 4 +- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetDateOnlyMethodTranslator.cs b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetDateOnlyMethodTranslator.cs index 12bf624a..a5755c9d 100644 --- a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetDateOnlyMethodTranslator.cs +++ b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetDateOnlyMethodTranslator.cs @@ -58,21 +58,31 @@ private static readonly MethodInfo ToDateTimeMethodInfo return null; } - return _sqlExpressionFactory.Function( - "DATETIME2FROMPARTS", - [ - MapDatePartExpression("yyyy", instance), - MapDatePartExpression("m", instance), - MapDatePartExpression("d", instance), - MapDatePartExpression("h", timeOnly), - MapDatePartExpression("n", timeOnly), - MapDatePartExpression("s", timeOnly), - MapDatePartExpression("fraction", timeOnly), - _sqlExpressionFactory.Constant(7, typeof(int)), - ], - nullable: true, - argumentsPropagateNullability: [true, true, true, true, true, true, true, false], - typeof(DateTime)); + var datePart1 = + _sqlExpressionFactory.Function( + "DateSerial", + [ + MapDatePartExpression("yyyy", instance), + MapDatePartExpression("m", instance), + MapDatePartExpression("d", instance) + ], + nullable: true, + argumentsPropagateNullability: [true, true, true], + typeof(DateTime)); + + var timePart = + _sqlExpressionFactory.Function( + "TimeSerial", + [ + MapDatePartExpression("h", timeOnly), + MapDatePartExpression("n", timeOnly), + MapDatePartExpression("s", timeOnly) + ], + nullable: true, + argumentsPropagateNullability: [true, true, true], + typeof(DateTime)); + + return _sqlExpressionFactory.Add(datePart1, timePart); } if (_methodInfoDatePartMapping.TryGetValue(method, out var datePart)) diff --git a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetDateTimeMethodTranslator.cs b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetDateTimeMethodTranslator.cs index ccd4dc33..77f05b76 100644 --- a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetDateTimeMethodTranslator.cs +++ b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetDateTimeMethodTranslator.cs @@ -20,14 +20,14 @@ public class JetDateTimeMethodTranslator(ISqlExpressionFactory sqlExpressionFact {typeof(DateTime).GetRuntimeMethod(nameof(DateTime.AddHours), [typeof(double)])!, "h"}, {typeof(DateTime).GetRuntimeMethod(nameof(DateTime.AddMinutes), [typeof(double)])!, "n"}, {typeof(DateTime).GetRuntimeMethod(nameof(DateTime.AddSeconds), [typeof(double)])!, "s"}, - {typeof(DateTime).GetRuntimeMethod(nameof(DateTime.AddMilliseconds), [typeof(double)])!, "millisecond"}, + //{typeof(DateTime).GetRuntimeMethod(nameof(DateTime.AddMilliseconds), [typeof(double)])!, "millisecond"}, {typeof(DateTimeOffset).GetRuntimeMethod(nameof(DateTimeOffset.AddYears), [typeof(int)])!, "yyyy"}, {typeof(DateTimeOffset).GetRuntimeMethod(nameof(DateTimeOffset.AddMonths), [typeof(int)])!, "m"}, {typeof(DateTimeOffset).GetRuntimeMethod(nameof(DateTimeOffset.AddDays), [typeof(double)])!, "d"}, {typeof(DateTimeOffset).GetRuntimeMethod(nameof(DateTimeOffset.AddHours), [typeof(double)])!, "h"}, {typeof(DateTimeOffset).GetRuntimeMethod(nameof(DateTimeOffset.AddMinutes), [typeof(double)])!, "n"}, {typeof(DateTimeOffset).GetRuntimeMethod(nameof(DateTimeOffset.AddSeconds), [typeof(double)])!, "s"}, - {typeof(DateTimeOffset).GetRuntimeMethod(nameof(DateTimeOffset.AddMilliseconds), [typeof(double)])!, "millisecond"} + //{typeof(DateTimeOffset).GetRuntimeMethod(nameof(DateTimeOffset.AddMilliseconds), [typeof(double)])!, "millisecond"} }; private static readonly Dictionary _methodInfoDateDiffMapping = new() From 824517cc6d7402673152072f69dbba510595462a Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 2 Jun 2026 20:39:06 +0800 Subject: [PATCH 06/43] Scaffold the identity seed and increment --- .../Scaffolding/Internal/JetDatabaseModelFactory.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/EFCore.Jet/Scaffolding/Internal/JetDatabaseModelFactory.cs b/src/EFCore.Jet/Scaffolding/Internal/JetDatabaseModelFactory.cs index c01665d3..439194bf 100644 --- a/src/EFCore.Jet/Scaffolding/Internal/JetDatabaseModelFactory.cs +++ b/src/EFCore.Jet/Scaffolding/Internal/JetDatabaseModelFactory.cs @@ -5,6 +5,7 @@ using System.Globalization; using System.Text.RegularExpressions; using EntityFrameworkCore.Jet.Internal; +using EntityFrameworkCore.Jet.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding.Metadata; using EntityFrameworkCore.Jet.Utilities; @@ -269,6 +270,10 @@ private void GetColumns(DbConnection connection, IReadOnlyList ta : default(ValueGenerated?) }; + column[JetAnnotationNames.IdentitySeed] = identitySeed; + column[JetAnnotationNames.IdentityIncrement] = identityIncrement; + column[JetAnnotationNames.Identity] = $"(${identitySeed}, ${identityIncrement})"; + if (storeType == "timestamp") { // Note: annotation name must match `ScaffoldingAnnotationNames.ConcurrencyToken` From d130c12bb329ef03beb995dfbe11d4ac71027afb Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 2 Jun 2026 20:44:51 +0800 Subject: [PATCH 07/43] Update tests. Remove ComplexJson, OwnedJson, OwnedTableSplittingPrimitiveCollection as would never work BasicTypesQueryJetFixture: Update the expected value for DateTimeOffset to be utc Scaffolding tests: Add Compiled model test and its baselines --- .../Sql/Internal/JetQuerySqlGenerator.cs | 2 +- .../NorthwindBulkUpdatesJetTest.cs | 26 +- .../EFCore.Jet.FunctionalTests.csproj | 20 + .../GraphUpdates/GraphUpdatesJetOwnedTest.cs | 2 + .../GraphUpdates/GraphUpdatesJetTestBase.cs | 2 + .../JetComplianceTest.cs | 33 +- .../JetEndToEndTest.cs | 187 -- .../LazyLoadProxyJetTest.cs | 44 +- .../Migrations/MigrationsJetTest.cs | 17 +- .../Query/AdHocComplexTypeQueryJetTest.cs | 25 +- .../ComplexJsonBulkUpdateJetTest.cs | 435 ---- .../ComplexJsonCollectionJetTest.cs | 201 -- .../ComplexJson/ComplexJsonJetFixture.cs | 21 - .../ComplexJsonMiscellaneousJetTest.cs | 108 - .../ComplexJsonPrimitiveCollectionJetTest.cs | 101 - .../ComplexJsonProjectionJetTest.cs | 375 ---- .../ComplexJsonSetOperationsJetTest.cs | 105 - .../ComplexJsonStructuralEqualityJetTest.cs | 284 --- .../ComplexTableSplittingProjectionJetTest.cs | 17 + .../NavigationsProjectionJetTest.cs | 24 + .../OwnedJson/OwnedJsonBulkUpdateJetTest.cs | 9 - .../OwnedJson/OwnedJsonCollectionJetTest.cs | 269 --- .../OwnedJson/OwnedJsonJetFixture.cs | 18 - .../OwnedJsonMiscellaneousJetTest.cs | 70 - .../OwnedJsonPrimitiveCollectionJetTest.cs | 101 - .../OwnedJson/OwnedJsonProjectionJetTest.cs | 372 ---- .../OwnedJsonStructuralEqualityJetTest.cs | 165 -- .../OwnedJson/OwnedJsonTypeJetFixture.cs | 23 - .../OwnedNavigationsProjectionJetTest.cs | 27 + ...ableSplittingPrimitiveCollectionJetTest.cs | 153 -- .../OwnedTableSplittingProjectionJetTest.cs | 25 + .../Query/EntitySplittingQueryJetTest.cs | 12 + .../Query/GearsOfWarQueryJetTest.cs | 16 +- .../Query/NorthwindGroupByQueryJetTest.cs | 2 +- .../NorthwindMiscellaneousQueryJetTest.cs | 14 + .../Query/NorthwindSelectQueryJetTest.cs | 2 +- .../Query/NullSemanticsQueryJetTest.cs | 4 +- .../Query/PrimitiveCollectionsQueryJetTest.cs | 7 + .../Query/SqlQueryJetTest.cs | 2 +- .../Query/TPCGearsOfWarQueryJetTest.cs | 8 +- .../Query/TPTGearsOfWarQueryJetTest.cs | 8 +- .../Translations/BasicTypesQueryJetFixture.cs | 4 +- .../Translations/StringTranslationsJetTest.cs | 17 +- .../Temporal/DateOnlyTranslationsJetTest.cs | 18 +- .../DateTimeOffsetTranslationsJetTest.cs | 21 +- ...terTypeMappingContextAssemblyAttributes.cs | 9 + ...unctionParameterTypeMappingContextModel.cs | 48 + ...ParameterTypeMappingContextModelBuilder.cs | 103 + ...ionTypeMappingContextAssemblyAttributes.cs | 9 + .../FunctionTypeMappingContextModel.cs | 48 + .../FunctionTypeMappingContextModelBuilder.cs | 103 + .../Baselines/DbFunctions/DataEntityType.cs | 124 ++ .../DbFunctions/DataUnsafeAccessors.cs | 16 + .../DbFunctionContextAssemblyAttributes.cs | 9 + .../DbFunctions/DbFunctionContextModel.cs | 48 + .../DbFunctionContextModelBuilder.cs | 321 +++ .../Baselines/DbFunctions/ObjectEntityType.cs | 64 + .../Dynamic_schema/DataEntityType.cs | 171 ++ .../Dynamic_schema/DataUnsafeAccessors.cs | 16 + .../DbContextAssemblyAttributes.cs | 9 + .../Dynamic_schema/DbContextModel.cs | 48 + .../Dynamic_schema/DbContextModelBuilder.cs | 88 + .../DbContextAssemblyAttributes.cs | 9 + .../Baselines/No_NativeAOT/DbContextModel.cs | 48 + .../No_NativeAOT/DbContextModelBuilder.cs | 57 + .../No_NativeAOT/DependentBaseEntityType.cs | 127 ++ .../DependentDerivedEntityType.cs | 60 + .../No_NativeAOT/ManyTypesEntityType.cs | 1876 +++++++++++++++++ .../No_NativeAOT/OwnedType0EntityType.cs | 176 ++ .../No_NativeAOT/OwnedTypeEntityType.cs | 230 ++ .../No_NativeAOT/PrincipalBaseEntityType.cs | 213 ++ ...cipalDerivedDependentBasebyteEntityType.cs | 114 + .../PrincipalDerivedEntityType.cs | 84 + .../Sequences/DbContextAssemblyAttributes.cs | 9 + .../Baselines/Sequences/DbContextModel.cs | 48 + .../Sequences/DbContextModelBuilder.cs | 49 + .../DbContextAssemblyAttributes.cs | 9 + .../Baselines/SimpleModel/DbContextModel.cs | 48 + .../SimpleModel/DbContextModelBuilder.cs | 87 + .../DependentBaseUnsafeAccessors.cs | 15 + .../SimpleModel/DependentDerivedEntityType.cs | 183 ++ .../DependentDerivedUnsafeAccessors.cs | 16 + .../Tpc_Sprocs/DbContextAssemblyAttributes.cs | 9 + .../Baselines/Tpc_Sprocs/DbContextModel.cs | 48 + .../Tpc_Sprocs/DbContextModelBuilder.cs | 1124 ++++++++++ .../Tpc_Sprocs/DependentBaseEntityType.cs | 254 +++ .../DependentBaseUnsafeAccessors.cs | 18 + .../Tpc_Sprocs/PrincipalBaseEntityType.cs | 1249 +++++++++++ .../PrincipalBaseUnsafeAccessors.cs | 57 + .../Tpc_Sprocs/PrincipalDerivedEntityType.cs | 183 ++ .../PrincipalDerivedUnsafeAccessors.cs | 20 + .../Scaffolding/CompiledModelJetTest.cs | 263 +++ .../JetDatabaseModelFactoryTest.cs | 30 - .../Update/StoredProcedureUpdateJetTest.cs | 715 ------- 94 files changed, 8220 insertions(+), 3838 deletions(-) delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonJetFixture.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonBulkUpdateJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonJetFixture.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonTypeJetFixture.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextAssemblyAttributes.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextModel.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextModelBuilder.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextAssemblyAttributes.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextModel.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextModelBuilder.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataUnsafeAccessors.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextAssemblyAttributes.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextModel.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextModelBuilder.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataUnsafeAccessors.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextAssemblyAttributes.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextModel.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextModelBuilder.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextAssemblyAttributes.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextModel.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextModelBuilder.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DependentBaseEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DependentDerivedEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/ManyTypesEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/OwnedType0EntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/OwnedTypeEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalBaseEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalDerivedEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextAssemblyAttributes.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextModel.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextModelBuilder.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextAssemblyAttributes.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextModel.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextModelBuilder.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentBaseUnsafeAccessors.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentDerivedEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentDerivedUnsafeAccessors.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextAssemblyAttributes.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextModel.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextModelBuilder.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DependentBaseEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DependentBaseUnsafeAccessors.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalBaseEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalBaseUnsafeAccessors.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalDerivedEntityType.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalDerivedUnsafeAccessors.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Scaffolding/CompiledModelJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs diff --git a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs index 6f0fe25c..224a3151 100644 --- a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs +++ b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs @@ -561,7 +561,7 @@ protected override Expression VisitSqlConstant(SqlConstantExpression sqlConstant { if (sqlConstantExpression.TypeMapping == RelationalTypeMapping.NullMapping && sqlConstantExpression.Value is DateTime) { - sqlConstantExpression = (SqlConstantExpression)sqlConstantExpression.ApplyTypeMapping(new JetDateTimeTypeMapping("datetime", _options)); + sqlConstantExpression = (SqlConstantExpression)sqlConstantExpression.ApplyTypeMapping(new JetDateTimeTypeMapping("datetime")); } parent.TryPeek(out var exp); diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs index 7c956601..ea6e0f48 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs @@ -735,6 +735,18 @@ public override async Task Update_Where_set_constant_via_lambda(bool async) """); } + public override async Task Update_Where_set_nullable_int_constant_via_discard_lambda(bool async) + { + await base.Update_Where_set_nullable_int_constant_via_discard_lambda(async); + + AssertExecuteUpdateSql( + """ +UPDATE `Products` AS `p` +SET `p`.`SupplierID` = 1 +WHERE `p`.`ProductID` < 5 +"""); + } + public override async Task Update_Where_parameter_set_constant(bool async) { await base.Update_Where_parameter_set_constant(async); @@ -1652,7 +1664,7 @@ OFFSET @p ROWS """); } - /*public override async Task Update_with_select_mixed_entity_scalar_anonymous_projection(bool async) + public override async Task Update_with_select_mixed_entity_scalar_anonymous_projection(bool async) { await base.Update_with_select_mixed_entity_scalar_anonymous_projection(async); @@ -1660,9 +1672,8 @@ OFFSET @p ROWS """ @p='Updated' (Size = 30) -UPDATE [c] -SET [c].[ContactName] = @p -FROM [Customers] AS [c] +UPDATE `Customers` AS `c` +SET `c`.`ContactName` = @p """); } @@ -1674,12 +1685,11 @@ public override async Task Update_with_select_scalar_anonymous_projection(bool a """ @p='Updated' (Size = 30) -UPDATE [c] -SET [c].[ContactName] = @p -FROM [Customers] AS [c] +UPDATE `Customers` AS `c` +SET `c`.`ContactName` = @p """); } - */ + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); diff --git a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj index 65edce24..06908149 100644 --- a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj +++ b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj @@ -8,6 +8,14 @@ true + + + + + + + + %(RecursiveDir)%(Filename)%(Extension) @@ -72,6 +80,10 @@ + + + + @@ -104,6 +116,14 @@ + + + + + + + + diff --git a/test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetOwnedTest.cs b/test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetOwnedTest.cs index 8a9e62c4..6a84f49e 100644 --- a/test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetOwnedTest.cs +++ b/test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetOwnedTest.cs @@ -629,6 +629,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(x => x.Id).HasColumnType("int"); modelBuilder.Entity().Property(x => x.Id).HasColumnType("int"); modelBuilder.Entity().Property(x => x.Id).HasColumnType("int"); + + modelBuilder.Entity().Property(x => x.Id).HasColumnType("int"); } } } diff --git a/test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetTestBase.cs b/test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetTestBase.cs index 78171590..de14d6b9 100644 --- a/test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/GraphUpdates/GraphUpdatesJetTestBase.cs @@ -218,6 +218,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(x => x.Id).HasColumnType("int"); modelBuilder.Entity().Property(x => x.Id).HasColumnType("int"); modelBuilder.Entity().Property(x => x.Id).HasColumnType("int"); + + modelBuilder.Entity().Property(x => x.Id).HasConversion(); } protected override async Task SeedAsync(PoolableDbContext context) diff --git a/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs b/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs index f4d32c81..1f190812 100644 --- a/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs @@ -1,9 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexProperties; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedTableSplitting; using Microsoft.EntityFrameworkCore.Update; +using System; +using System.Collections.Generic; +using System.Reflection; namespace EntityFrameworkCore.Jet.FunctionalTests { @@ -21,8 +25,28 @@ public class JetComplianceTest : RelationalComplianceTestBase typeof(NonSharedPrimitiveCollectionsQueryTestBase), typeof(NonSharedPrimitiveCollectionsQueryRelationalTestBase), //No Json query support in Jet + typeof(BadDataJsonDeserializationTestBase), typeof(JsonQueryTestBase<>), + typeof(JsonQueryRelationalTestBase<>), typeof(JsonUpdateTestBase<>), + typeof(AdHocJsonQueryRelationalTestBase), + typeof(AdHocJsonQueryTestBase), + typeof(OwnedJsonBulkUpdateRelationalTestBase<>), + typeof(OwnedJsonCollectionRelationalTestBase<>), + typeof(OwnedJsonMiscellaneousRelationalTestBase<>), + typeof(OwnedJsonPrimitiveCollectionRelationalTestBase<>), + typeof(OwnedJsonProjectionRelationalTestBase<>), + typeof(OwnedJsonStructuralEqualityRelationalTestBase<>), + typeof(ComplexJsonBulkUpdateRelationalTestBase<>), + typeof(ComplexPropertiesCollectionTestBase<>), + typeof(ComplexJsonCollectionRelationalTestBase<>), + typeof(ComplexJsonMiscellaneousRelationalTestBase<>), + typeof(ComplexJsonPrimitiveCollectionRelationalTestBase<>), + typeof(ComplexJsonProjectionRelationalTestBase<>), + typeof(ComplexPropertiesSetOperationsTestBase<>), + typeof(ComplexJsonSetOperationsRelationalTestBase<>), + typeof(ComplexJsonStructuralEqualityRelationalTestBase<>), + typeof(OwnedTableSplittingPrimitiveCollectionRelationalTestBase<>), //Too complex table structure for Jet/MS Access. Too many indexes on table. //Caused by having too many navs (foreign keys) on a single table. //Also having a primary key (and its related foreign keys) being over more than 14 fields. @@ -35,6 +59,7 @@ public class JetComplianceTest : RelationalComplianceTestBase typeof(UpdatesRelationalTestBase<>), //No user defined functions in MS Access/Jet typeof(UdfDbFunctionTestBase<>), + typeof(StoredProcedureUpdateTestBase), ]; protected override Assembly TargetAssembly { get; } = typeof(JetComplianceTest).Assembly; diff --git a/test/EFCore.Jet.FunctionalTests/JetEndToEndTest.cs b/test/EFCore.Jet.FunctionalTests/JetEndToEndTest.cs index 4300527c..321437e3 100644 --- a/test/EFCore.Jet.FunctionalTests/JetEndToEndTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetEndToEndTest.cs @@ -37,193 +37,6 @@ public JetEndToEndTest(JetFixture fixture) Fixture.TestSqlLoggerFactory.Clear(); } - [ConditionalFact] - public async Task Can_use_decimal_and_byte_as_identity_columns() - { - await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); - var nownNum1 = new NownNum { Id = 77.0m, TheWalrus = "Crying" }; - var nownNum2 = new NownNum { Id = 78.0m, TheWalrus = "Walrus" }; - - var numNum1 = new NumNum { TheWalrus = "I" }; - var numNum2 = new NumNum { TheWalrus = "Am" }; - - var anNum1 = new AnNum { TheWalrus = "Goo goo" }; - var anNum2 = new AnNum { TheWalrus = "g'joob" }; - - var adNum1 = new AdNum { TheWalrus = "Eggman" }; - var adNum2 = new AdNum { TheWalrus = "Eggmen" }; - - var byteNownNum1 = new ByteNownNum { Id = 77, Lucy = "Tangerine" }; - var byteNownNum2 = new ByteNownNum { Id = 78, Lucy = "Trees" }; - - var byteNum1 = new ByteNum { Lucy = "Marmalade" }; - var byteNum2 = new ByteNum { Lucy = "Skies" }; - - var byteAnNum1 = new ByteAnNum { Lucy = "Cellophane" }; - var byteAnNum2 = new ByteAnNum { Lucy = "Flowers" }; - - var byteAdNum1 = new ByteAdNum { Lucy = "Kaleidoscope" }; - var byteAdNum2 = new ByteAdNum { Lucy = "Eyes" }; - - decimal[] preSaveValues; - byte[] preSaveByteValues; - - var options = Fixture.CreateOptions(testDatabase); - using (var context = new NumNumContext(options)) - { - context.Database.EnsureCreatedResiliently(); - - context.AddRange( - nownNum1, nownNum2, numNum1, numNum2, adNum1, adNum2, anNum1, anNum2, - byteNownNum1, byteNownNum2, byteNum1, byteNum2, byteAdNum1, byteAdNum2, byteAnNum1, byteAnNum2); - - preSaveValues = [numNum1.Id, numNum2.Id, adNum1.Id, adNum2.Id, anNum1.Id, anNum2.Id]; - - preSaveByteValues = [byteNum1.Id, byteNum2.Id, byteAdNum1.Id, byteAdNum2.Id, byteAnNum1.Id, byteAnNum2.Id]; - - context.SaveChanges(); - } - - using (var context = new NumNumContext(options)) - { - Assert.Equal(nownNum1.Id, context.NownNums.Single(e => e.TheWalrus == "Crying").Id); - Assert.Equal(nownNum2.Id, context.NownNums.Single(e => e.TheWalrus == "Walrus").Id); - Assert.Equal(77.0m, nownNum1.Id); - Assert.Equal(78.0m, nownNum2.Id); - - Assert.Equal(numNum1.Id, context.NumNums.Single(e => e.TheWalrus == "I").Id); - Assert.Equal(numNum2.Id, context.NumNums.Single(e => e.TheWalrus == "Am").Id); - Assert.NotEqual(numNum1.Id, preSaveValues[0]); - Assert.NotEqual(numNum2.Id, preSaveValues[1]); - - Assert.Equal(anNum1.Id, context.AnNums.Single(e => e.TheWalrus == "Goo goo").Id); - Assert.Equal(anNum2.Id, context.AnNums.Single(e => e.TheWalrus == "g'joob").Id); - Assert.NotEqual(adNum1.Id, preSaveValues[2]); - Assert.NotEqual(adNum2.Id, preSaveValues[3]); - - Assert.Equal(adNum1.Id, context.AdNums.Single(e => e.TheWalrus == "Eggman").Id); - Assert.Equal(adNum2.Id, context.AdNums.Single(e => e.TheWalrus == "Eggmen").Id); - Assert.NotEqual(anNum1.Id, preSaveValues[4]); - Assert.NotEqual(anNum2.Id, preSaveValues[5]); - - Assert.Equal(byteNownNum1.Id, context.ByteNownNums.Single(e => e.Lucy == "Tangerine").Id); - Assert.Equal(byteNownNum2.Id, context.ByteNownNums.Single(e => e.Lucy == "Trees").Id); - Assert.Equal(77, byteNownNum1.Id); - Assert.Equal(78, byteNownNum2.Id); - - Assert.Equal(byteNum1.Id, context.ByteNums.Single(e => e.Lucy == "Marmalade").Id); - Assert.Equal(byteNum2.Id, context.ByteNums.Single(e => e.Lucy == "Skies").Id); - Assert.NotEqual(byteNum1.Id, preSaveByteValues[0]); - Assert.NotEqual(byteNum2.Id, preSaveByteValues[1]); - - Assert.Equal(byteAnNum1.Id, context.ByteAnNums.Single(e => e.Lucy == "Cellophane").Id); - Assert.Equal(byteAnNum2.Id, context.ByteAnNums.Single(e => e.Lucy == "Flowers").Id); - Assert.NotEqual(byteAdNum1.Id, preSaveByteValues[2]); - Assert.NotEqual(byteAdNum2.Id, preSaveByteValues[3]); - - Assert.Equal(byteAdNum1.Id, context.ByteAdNums.Single(e => e.Lucy == "Kaleidoscope").Id); - Assert.Equal(byteAdNum2.Id, context.ByteAdNums.Single(e => e.Lucy == "Eyes").Id); - Assert.NotEqual(byteAnNum1.Id, preSaveByteValues[4]); - Assert.NotEqual(byteAnNum2.Id, preSaveByteValues[5]); - } - } - - private class NumNumContext(DbContextOptions options) : DbContext(options) - { - public DbSet NownNums { get; set; } - public DbSet NumNums { get; set; } - public DbSet AnNums { get; set; } - public DbSet AdNums { get; set; } - - public DbSet ByteNownNums { get; set; } - public DbSet ByteNums { get; set; } - public DbSet ByteAnNums { get; set; } - public DbSet ByteAdNums { get; set; } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder - .Entity() - .Property(e => e.Id) - .HasColumnType("numeric(18, 0)") - .UseJetIdentityColumn(); - - modelBuilder - .Entity() - .Property(e => e.Id) - .HasColumnType("decimal(10, 0)") - .ValueGeneratedOnAdd(); - - modelBuilder - .Entity() - .Property(e => e.Id) - .UseJetIdentityColumn(); - - modelBuilder - .Entity() - .Property(e => e.Id) - .ValueGeneratedOnAdd(); - - modelBuilder - .Entity() - .Property(e => e.Id) - .HasColumnType("numeric(18, 0)"); - } - } - - private class NownNum - { - public decimal Id { get; set; } - public string TheWalrus { get; set; } - } - - private class NumNum - { - public decimal Id { get; set; } - public string TheWalrus { get; set; } - } - - private class AnNum - { - [Column(TypeName = "decimal(18, 0)")] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public decimal Id { get; set; } - - public string TheWalrus { get; set; } - } - - private class AdNum - { - public decimal Id { get; set; } - public string TheWalrus { get; set; } - } - - private class ByteNownNum - { - public byte Id { get; set; } - public string Lucy { get; set; } - } - - private class ByteNum - { - public byte Id { get; set; } - public string Lucy { get; set; } - } - - private class ByteAnNum - { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public byte Id { get; set; } - - public string Lucy { get; set; } - } - - private class ByteAdNum - { - public byte Id { get; set; } - public string Lucy { get; set; } - } - [ConditionalFact] public async Task Can_use_string_enum_or_byte_array_as_key() { diff --git a/test/EFCore.Jet.FunctionalTests/LazyLoadProxyJetTest.cs b/test/EFCore.Jet.FunctionalTests/LazyLoadProxyJetTest.cs index d4647fae..226b1e93 100644 --- a/test/EFCore.Jet.FunctionalTests/LazyLoadProxyJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/LazyLoadProxyJetTest.cs @@ -11,7 +11,7 @@ #nullable disable namespace EntityFrameworkCore.Jet.FunctionalTests { - public class LazyLoadProxyJetTest : LazyLoadProxyTestBase + public class LazyLoadProxyJetTest : LazyLoadProxyRelationalTestBase { public LazyLoadProxyJetTest(LoadJetFixture fixture) : base(fixture) @@ -45,7 +45,7 @@ public override void Lazy_load_many_to_one_reference_to_principal(EntityState st : $""" @p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); @@ -61,7 +61,7 @@ public override void Lazy_load_one_to_one_reference_to_principal(EntityState sta : $""" @p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); @@ -91,7 +91,7 @@ public override void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(Entity $""" @p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); @@ -147,7 +147,7 @@ public override void Lazy_load_many_to_one_reference_to_principal_not_found(Enti $""" @p='787' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); @@ -161,7 +161,7 @@ public override void Lazy_load_one_to_one_reference_to_principal_not_found(Entit $""" @p='787' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); @@ -235,7 +235,7 @@ public override void Lazy_load_many_to_one_reference_to_principal_alternate_key( $""" @p='Root' (Size = 255) -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); @@ -249,7 +249,7 @@ public override void Lazy_load_one_to_one_reference_to_principal_alternate_key(E $""" @p='Root' (Size = 255) -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); @@ -307,7 +307,7 @@ public override void Lazy_load_many_to_one_reference_to_principal_shadow_fk(Enti : $""" @p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); @@ -323,7 +323,7 @@ public override void Lazy_load_one_to_one_reference_to_principal_shadow_fk(Entit : $""" @p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); @@ -381,7 +381,7 @@ public override void Lazy_load_many_to_one_reference_to_principal_composite_key( @p='Root' (Size = 255) @p1='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p1")} """); @@ -396,7 +396,7 @@ public override void Lazy_load_one_to_one_reference_to_principal_composite_key(E @p='Root' (Size = 255) @p1='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p1")} """); @@ -455,7 +455,7 @@ public override void Top_level_projection_track_entities_before_passing_to_clien AssertSql( $""" -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` FROM `Parent` AS `p` ORDER BY `p`.`Id` @@ -498,25 +498,25 @@ private void AssertSql(string expected) StringSplitOptions.RemoveEmptyEntries)[2][6..]; var indexMethodEnding = methodCallLine.IndexOf(')') + 1; - var testName = methodCallLine[..indexMethodEnding]; + var testName = methodCallLine.Substring(0, indexMethodEnding); var parts = methodCallLine[indexMethodEnding..].Split(" ", StringSplitOptions.RemoveEmptyEntries); var fileName = parts[1][..^5]; var lineNumber = int.Parse(parts[2]); var currentDirectory = Directory.GetCurrentDirectory(); - var logFile = currentDirectory[..(currentDirectory.LastIndexOf( + var logFile = currentDirectory.Substring( + 0, + currentDirectory.LastIndexOf( $"{Path.DirectorySeparatorChar}artifacts{Path.DirectorySeparatorChar}", StringComparison.Ordinal) - + 1)] + + 1) + "QueryBaseline.txt"; var testInfo = testName + " : " + lineNumber + FileNewLine; - var newBaseLine = $""" - AssertSql( - {"@\"" + sql.Replace("\"", "\"\"") + "\""}); - + var newBaseLine = $@" AssertSql( + {"@\"" + sql.Replace("\"", "\"\"") + "\""}); - """; +"; var contents = testInfo + newBaseLine + FileNewLine + "--------------------" + FileNewLine; @@ -537,7 +537,7 @@ private void AssertSql(string expected) private string Sql { get; set; } - public class LoadJetFixture : LoadFixtureBase + public class LoadJetFixture : LoadRelationalFixtureBase { public TestSqlLoggerFactory TestSqlLoggerFactory => (TestSqlLoggerFactory)ListLoggerFactory; protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs index b364910c..a88b9019 100644 --- a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs @@ -451,7 +451,7 @@ await Test( AssertSql( """ -ALTER TABLE `People` ADD `Age` datetime NOT NULL DEFAULT TIMEVALUE('12:34:56'); +ALTER TABLE `People` ADD `Age` time NOT NULL DEFAULT TIMEVALUE('12:34:56'); """); } @@ -713,9 +713,8 @@ await Test( var table = Assert.Single(model.Tables); var column = Assert.Single(table.Columns, c => c.Name == "IdentityColumn"); Assert.Equal(ValueGenerated.OnAdd, column.ValueGenerated); - // TODO: Do we not reverse-engineer identity facets? - // Assert.Equal(100, column[SqlServerAnnotationNames.IdentitySeed]); - // Assert.Equal(5, column[SqlServerAnnotationNames.IdentityIncrement]); + Assert.Equal(100, column[JetAnnotationNames.IdentitySeed]); + Assert.Equal(5, column[JetAnnotationNames.IdentityIncrement]); }); AssertSql( @@ -757,18 +756,16 @@ await Test( Assert.Equal("Cats", t.Name); var column = Assert.Single(t.Columns, c => c.Name == "IdentityColumn"); Assert.Equal(ValueGenerated.OnAdd, column.ValueGenerated); - // TODO: Do we not reverse-engineer identity facets? - // Assert.Equal(100, column[SqlServerAnnotationNames.IdentitySeed]); - // Assert.Equal(5, column[SqlServerAnnotationNames.IdentityIncrement]); + Assert.Equal(100, column[JetAnnotationNames.IdentitySeed]); + Assert.Equal(5, column[JetAnnotationNames.IdentityIncrement]); }, t => { Assert.Equal("Dogs", t.Name); var column = Assert.Single(t.Columns, c => c.Name == "IdentityColumn"); Assert.Equal(ValueGenerated.OnAdd, column.ValueGenerated); - // TODO: Do we not reverse-engineer identity facets? - // Assert.Equal(100, column[SqlServerAnnotationNames.IdentitySeed]); - // Assert.Equal(5, column[SqlServerAnnotationNames.IdentityIncrement]); + Assert.Equal(100, column[JetAnnotationNames.IdentitySeed]); + Assert.Equal(5, column[JetAnnotationNames.IdentityIncrement]); }); }); diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs index c7458c90..594ed1aa 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs @@ -9,7 +9,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class AdHocComplexTypeQueryJetTest(NonSharedFixture fixture) : AdHocComplexTypeQueryTestBase(fixture) +public class AdHocComplexTypeQueryJetTest(NonSharedFixture fixture) : AdHocComplexTypeQueryRelationalTestBase(fixture) { public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() { @@ -27,6 +27,29 @@ public override async Task Complex_type_equals_parameter_with_nested_types_with_ """); } + public override async Task Projecting_complex_property_does_not_auto_include_owned_types() + { + await base.Projecting_complex_property_does_not_auto_include_owned_types(); + + AssertSql( + """ +SELECT `e`.`Complex_Name`, `e`.`Complex_Number` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Complex_type_equality_with_non_default_type_mapping() + { + await base.Complex_type_equality_with_non_default_type_mapping(); + + AssertSql( + """ +SELECT COUNT(*) +FROM `EntityType` AS `e` +WHERE `e`.`ComplexThing_DateTime` = #2020-01-01 01:01:01# +"""); + } + protected TestSqlLoggerFactory TestSqlLoggerFactory => (TestSqlLoggerFactory)ListLoggerFactory; diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateJetTest.cs deleted file mode 100644 index 34a17296..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateJetTest.cs +++ /dev/null @@ -1,435 +0,0 @@ -using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; - -public class ComplexJsonBulkUpdateJetTest( - ComplexJsonJetFixture fixture, - ITestOutputHelper testOutputHelper) - : ComplexJsonBulkUpdateRelationalTestBase(fixture, testOutputHelper) -{ - #region Delete - - public override async Task Delete_entity_with_associations() - { - await base.Delete_entity_with_associations(); - - AssertSql( - """ -@deletableEntity_Name='Root3_With_different_values' (Size = 255) - -DELETE FROM `RootEntity` AS `r` -WHERE `r`.`Name` = @deletableEntity_Name -"""); - } - - public override async Task Delete_required_associate() - { - await base.Delete_required_associate(); - - AssertSql(); - } - - public override async Task Delete_optional_associate() - { - await base.Delete_optional_associate(); - - AssertSql(); - } - - #endregion Delete - - #region Update properties - - public override async Task Update_property_inside_associate() - { - await base.Update_property_inside_associate(); - - AssertExecuteUpdateSql( - """ -@p='foo_updated' (Size = 4000) - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', @p) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_property_inside_associate_with_special_chars() - { - await base.Update_property_inside_associate_with_special_chars(); - - AssertExecuteUpdateSql( - """ -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', N'{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }') -FROM [RootEntity] AS [r] -WHERE JSON_VALUE([r].[RequiredAssociate], '$.String') = N'{ this may/look:like JSON but it [isn''t]: ממש ממש לאéèéè }' -"""); - } - - public override async Task Update_property_inside_nested_associate() - { - await base.Update_property_inside_nested_associate(); - - AssertExecuteUpdateSql( - """ -@p='foo_updated' (Size = 4000) - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.RequiredNestedAssociate.String', @p) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_property_on_projected_associate() - { - await base.Update_property_on_projected_associate(); - - AssertExecuteUpdateSql( - """ -@p='foo_updated' (Size = 4000) - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', @p) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_property_on_projected_associate_with_OrderBy_Skip() - { - await base.Update_property_on_projected_associate_with_OrderBy_Skip(); - - AssertExecuteUpdateSql(); - } - - public override async Task Update_associate_with_null_required_property() - { - await base.Update_associate_with_null_required_property(); - - AssertExecuteUpdateSql(); - } - - #endregion Update properties - - #region Update association - - public override async Task Update_associate_to_parameter() - { - await base.Update_associate_to_parameter(); - - AssertExecuteUpdateSql( - """ -@complex_type_p='{"Id":1000,"Int":80,"Ints":[1,2,3],"Name":"Updated associate name","String":"Updated nested string","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,3],"Name":"Updated nested name","String":"Updated nested string"}}' (Size = 277) - -UPDATE `RootEntity` AS `r` -SET `r`.`RequiredAssociate` = @complex_type_p -"""); - } - - public override async Task Update_nested_associate_to_parameter() - { - await base.Update_nested_associate_to_parameter(); - - AssertExecuteUpdateSql( - """ -@complex_type_p='{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}' (Size = 97) - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.RequiredNestedAssociate', JSON_QUERY(@complex_type_p)) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_associate_to_another_associate() - { - await base.Update_associate_to_another_associate(); - - AssertExecuteUpdateSql( - """ -UPDATE `RootEntity` AS `r` -SET `r`.`OptionalAssociate` = `r`.`RequiredAssociate` -"""); - } - - public override async Task Update_nested_associate_to_another_nested_associate() - { - await base.Update_nested_associate_to_another_nested_associate(); - - AssertExecuteUpdateSql( - """ -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.OptionalNestedAssociate', JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate')) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_associate_to_inline() - { - await base.Update_associate_to_inline(); - - AssertExecuteUpdateSql( - """ -@complex_type_p='{"Id":1000,"Int":70,"Ints":[1,2,4],"Name":"Updated associate name","String":"Updated associate string","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}}' (Size = 280) - -UPDATE `RootEntity` AS `r` -SET `r`.`RequiredAssociate` = @complex_type_p -"""); - } - - public override async Task Update_associate_to_inline_with_lambda() - { - await base.Update_associate_to_inline_with_lambda(); - - AssertExecuteUpdateSql( - """ -UPDATE [r] -SET [r].[RequiredAssociate] = '{"Id":1000,"Int":70,"Ints":[1,2,4],"Name":"Updated associate name","String":"Updated associate string","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}}' -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_nested_associate_to_inline_with_lambda() - { - await base.Update_nested_associate_to_inline_with_lambda(); - - AssertExecuteUpdateSql( - """ -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.RequiredNestedAssociate', JSON_QUERY('{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}')) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_associate_to_null() - { - await base.Update_associate_to_null(); - - AssertExecuteUpdateSql( - """ -UPDATE `RootEntity` AS `r` -SET `r`.`OptionalAssociate` = NULL -"""); - } - - public override async Task Update_associate_to_null_with_lambda() - { - await base.Update_associate_to_null_with_lambda(); - - AssertExecuteUpdateSql( - """ -UPDATE `RootEntity` AS `r` -SET `r`.`OptionalAssociate` = NULL -"""); - } - - public override async Task Update_associate_to_null_parameter() - { - await base.Update_associate_to_null_parameter(); - - AssertExecuteUpdateSql( - """ -UPDATE `RootEntity` AS `r` -SET `r`.`OptionalAssociate` = NULL -"""); - } - - public override async Task Update_required_nested_associate_to_null() - { - await base.Update_required_nested_associate_to_null(); - - AssertExecuteUpdateSql(); - } - - #endregion Update association - - #region Update collection - - public override async Task Update_collection_to_parameter() - { - await base.Update_collection_to_parameter(); - - AssertExecuteUpdateSql( - """ -@complex_type_p='[{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated associate name1","String":"Updated associate string1","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name1","String":"Updated nested string1"}},{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated associate name2","String":"Updated associate string2","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated nested name2","String":"Updated nested string2"}}]' (Size = 571) - -UPDATE `RootEntity` AS `r` -SET `r`.`AssociateCollection` = @complex_type_p -"""); - } - - public override async Task Update_nested_collection_to_parameter() - { - await base.Update_nested_collection_to_parameter(); - - AssertExecuteUpdateSql( - """ -@complex_type_p='[{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name1","String":"Updated nested string1"},{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated nested name2","String":"Updated nested string2"}]' (Size = 201) - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.NestedCollection', JSON_QUERY(@complex_type_p)) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_nested_collection_to_inline_with_lambda() - { - await base.Update_nested_collection_to_inline_with_lambda(); - - AssertExecuteUpdateSql( - """ -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.NestedCollection', JSON_QUERY('[{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name1","String":"Updated nested string1"},{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated nested name2","String":"Updated nested string2"}]')) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_nested_collection_to_another_nested_collection() - { - await base.Update_nested_collection_to_another_nested_collection(); - - AssertExecuteUpdateSql( - """ -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.NestedCollection', JSON_QUERY([r].[OptionalAssociate], '$.NestedCollection')) -FROM [RootEntity] AS [r] -WHERE [r].[OptionalAssociate] IS NOT NULL -"""); - } - - public override async Task Update_collection_referencing_the_original_collection() - { - await base.Update_collection_referencing_the_original_collection(); - - AssertExecuteUpdateSql(); - } - - public override async Task Update_inside_structural_collection() - { - await base.Update_inside_structural_collection(); - - AssertExecuteUpdateSql(); - } - - #endregion Update collection - - #region Update primitive collection - - public override async Task Update_primitive_collection_to_constant() - { - await base.Update_primitive_collection_to_constant(); - - AssertExecuteUpdateSql( - """ -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.Ints', JSON_QUERY(N'[1,2,4]')) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_primitive_collection_to_parameter() - { - await base.Update_primitive_collection_to_parameter(); - - AssertExecuteUpdateSql( - """ -@ints='[1,2,4]' (Size = 4000) - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.Ints', JSON_QUERY(@ints)) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_primitive_collection_to_another_collection() - { - await base.Update_primitive_collection_to_another_collection(); - - AssertExecuteUpdateSql( - """ -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.OptionalNestedAssociate.Ints', JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate.Ints')) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_inside_primitive_collection() - { - await base.Update_inside_primitive_collection(); - - AssertExecuteUpdateSql( - """ -@p='99' - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.Ints[1]', @p) -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) AS [i]) >= 2 -"""); - } - - #endregion Update primitive collection - - #region Multiple updates - - public override async Task Update_multiple_properties_inside_same_associate() - { - await base.Update_multiple_properties_inside_same_associate(); - - // Note that since two properties within the same JSON column are updated, SQL Server 2025 modify - // is not used (it only supports modifying a single property) - AssertExecuteUpdateSql( - """ -@p='foo_updated' (Size = 4000) -@p0='20' - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY(JSON_MODIFY([r].[RequiredAssociate], '$.String', @p), '$.Int', @p0) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Update_multiple_properties_inside_associates_and_on_entity_type() - { - await base.Update_multiple_properties_inside_associates_and_on_entity_type(); - - AssertExecuteUpdateSql( - """ -@p='foo_updated' (Size = 4000) - -UPDATE [r] -SET [r].[Name] = [r].[Name] + N'Modified', - [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', JSON_VALUE([r].[OptionalAssociate], '$.String')), - [r].[OptionalAssociate] = JSON_MODIFY([r].[OptionalAssociate], '$.RequiredNestedAssociate.String', @p) -FROM [RootEntity] AS [r] -WHERE [r].[OptionalAssociate] IS NOT NULL -"""); - } - - public override async Task Update_multiple_projected_associates_via_anonymous_type() - { - await base.Update_multiple_projected_associates_via_anonymous_type(); - - AssertExecuteUpdateSql( - """ -@p='foo_updated' (Size = 4000) - -UPDATE [r] -SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', JSON_VALUE([r].[OptionalAssociate], '$.String')), - [r].[OptionalAssociate] = JSON_MODIFY([r].[OptionalAssociate], '$.String', @p) -FROM [RootEntity] AS [r] -WHERE [r].[OptionalAssociate] IS NOT NULL -"""); - } - - #endregion Multiple updates - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionJetTest.cs deleted file mode 100644 index dc743ef3..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionJetTest.cs +++ /dev/null @@ -1,201 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; - -public class ComplexJsonCollectionJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : ComplexJsonCollectionRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Count() - { - await base.Count(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON([r].[AssociateCollection], '$') AS [a]) = 2 -"""); - } - - public override async Task Where() - { - await base.Where(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON([r].[AssociateCollection], '$') WITH ([Int] int '$.Int') AS [a] - WHERE [a].[Int] <> 8) = 2 -"""); - } - - public override async Task OrderBy_ElementAt() - { - await base.OrderBy_ElementAt(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT [a].[Int] - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int' - ) AS [a] - ORDER BY [a].[Id] - OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) = 8 -"""); - } - - #region Distinct - - public override async Task Distinct() - { - AssertSql( -); - } - - public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Distinct_projected(queryTrackingBehavior); - - AssertSql(); - } - - public override async Task Distinct_over_projected_nested_collection() - { - AssertSql( -); - } - - public override async Task Distinct_over_projected_filtered_nested_collection() - { - await base.Distinct_over_projected_filtered_nested_collection(); - - AssertSql(); - } - - #endregion Distinct - - #region Index - - public override async Task Index_constant() - { - await base.Index_constant(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[0].Int') AS int) = 8 -"""); - } - - public override async Task Index_parameter() - { - await base.Index_parameter(); - - AssertSql( - """ -@i='0' - -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[' + CAST(@i AS nvarchar(max)) + '].Int') AS int) = 8 -"""); - } - - public override async Task Index_column() - { - await base.Index_column(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[' + CAST([r].[Id] - 1 AS nvarchar(max)) + '].Int') AS int) = 8 -"""); - } - - public override async Task Index_on_nested_collection() - { - await base.Index_on_nested_collection(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.NestedCollection[0].Int') AS int) = 8 -"""); - } - - public override async Task Index_out_of_bounds() - { - await base.Index_out_of_bounds(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[9999].Int') AS int) = 8 -"""); - } - - #endregion Index - - #region GroupBy - - [ConditionalFact] - public override async Task GroupBy() - { - await base.GroupBy(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE 16 IN ( - SELECT COALESCE(SUM([a].[Int]), 0) - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Int] int '$.Int', - [String] nvarchar(max) '$.String' - ) AS [a] - GROUP BY [a].[String] -) -"""); - } - - #endregion GroupBy - - public override async Task Select_within_Select_within_Select_with_aggregates() - { - await base.Select_within_Select_within_Select_with_aggregates(); - - AssertSql( - """ -SELECT ( - SELECT COALESCE(SUM([s].[value]), 0) - FROM OPENJSON([r].[AssociateCollection], '$') WITH ([NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON) AS [a] - OUTER APPLY ( - SELECT MAX([n].[Int]) AS [value] - FROM OPENJSON([a].[NestedCollection], '$') WITH ([Int] int '$.Int') AS [n] - ) AS [s]) -FROM [RootEntity] AS [r] -"""); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonJetFixture.cs deleted file mode 100644 index 294fb54d..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonJetFixture.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; -using Microsoft.EntityFrameworkCore.TestUtilities; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; - -public class ComplexJsonJetFixture : ComplexJsonRelationalFixtureBase -{ - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; - - public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - { - var options = base.AddOptions(builder); - return options; - } -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousJetTest.cs deleted file mode 100644 index 16a5b1e6..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousJetTest.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; - -public class ComplexJsonMiscellaneousJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : ComplexJsonMiscellaneousRelationalTestBase(fixture, testOutputHelper) -{ - #region Simple filters - - public override async Task Where_on_associate_scalar_property() - { - await base.Where_on_associate_scalar_property(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.Int') AS int) = 8 -"""); - } - - public override async Task Where_on_optional_associate_scalar_property() - { - await base.Where_on_optional_associate_scalar_property(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[OptionalAssociate], '$.Int') AS int) = 8 -"""); - } - - public override async Task Where_on_nested_associate_scalar_property() - { - await base.Where_on_nested_associate_scalar_property(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.RequiredNestedAssociate.Int') AS int) = 8 -"""); - } - - #endregion Simple filters - - #region Value types - - public override async Task Where_property_on_non_nullable_value_type() - { - await base.Where_property_on_non_nullable_value_type(); - - AssertSql( - """ -SELECT [v].[Id], [v].[Name], [v].[AssociateCollection], [v].[OptionalAssociate], [v].[RequiredAssociate] -FROM [ValueRootEntity] AS [v] -WHERE CAST(JSON_VALUE([v].[RequiredAssociate], '$.Int') AS int) = 8 -"""); - } - - public override async Task Where_property_on_nullable_value_type_Value() - { - await base.Where_property_on_nullable_value_type_Value(); - - AssertSql( - """ -SELECT [v].[Id], [v].[Name], [v].[AssociateCollection], [v].[OptionalAssociate], [v].[RequiredAssociate] -FROM [ValueRootEntity] AS [v] -WHERE CAST(JSON_VALUE([v].[OptionalAssociate], '$.Int') AS int) = 8 -"""); - } - - public override async Task Where_HasValue_on_nullable_value_type() - { - await base.Where_HasValue_on_nullable_value_type(); - - AssertSql( - """ -SELECT `v`.`Id`, `v`.`Name`, `v`.`AssociateCollection`, `v`.`OptionalAssociate`, `v`.`RequiredAssociate` -FROM `ValueRootEntity` AS `v` -WHERE (`v`.`OptionalAssociate`) IS NOT NULL -"""); - } - - #endregion Value types - - public override async Task FromSql_on_root() - { - await base.FromSql_on_root(); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`Name`, `m`.`AssociateCollection`, `m`.`OptionalAssociate`, `m`.`RequiredAssociate` -FROM ( - SELECT * FROM `RootEntity` -) AS `m` -"""); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionJetTest.cs deleted file mode 100644 index 553c00fd..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionJetTest.cs +++ /dev/null @@ -1,101 +0,0 @@ -using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; - -public class ComplexJsonPrimitiveCollectionJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : ComplexJsonPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Count() - { - await base.Count(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) AS [i]) = 3 -"""); - } - - public override async Task Index() - { - await base.Index(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.Ints[0]') AS int) = 1 -"""); - } - - public override async Task Contains() - { - await base.Contains(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE 3 IN ( - SELECT [i].[value] - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i] -) -"""); - } - - public override async Task Any_predicate() - { - await base.Any_predicate(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE 2 IN ( - SELECT [i].[value] - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i] -) -"""); - } - - public override async Task Nested_Count() - { - await base.Nested_Count(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate.Ints')) AS [i]) = 3 -"""); - } - - public override async Task Select_Sum() - { - await base.Select_Sum(); - - AssertSql( - """ -SELECT ( - SELECT COALESCE(SUM([i0].[value]), 0) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i0]) -FROM [RootEntity] AS [r] -WHERE ( - SELECT COALESCE(SUM([i].[value]), 0) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i]) >= 6 -"""); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionJetTest.cs deleted file mode 100644 index b871b5ba..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionJetTest.cs +++ /dev/null @@ -1,375 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; - -public class ComplexJsonProjectionJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : ComplexJsonProjectionRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_root(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -"""); - } - - #region Scalar properties - - public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_VALUE([r].[RequiredAssociate], '$.String') -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_property_on_optional_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_VALUE([r].[OptionalAssociate], '$.String') -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); - - AssertSql( -); - } - - public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT CAST(JSON_VALUE([r].[OptionalAssociate], '$.Int') AS int) -FROM [RootEntity] AS [r] -"""); - } - - #endregion Scalar properties - - #region Structural properties - - public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -"""); - } - - public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_optional_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r`.`OptionalAssociate` -FROM `RootEntity` AS `r` -"""); - } - - public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_required_nested_on_required_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate') -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_QUERY([r].[RequiredAssociate], '$.OptionalNestedAssociate') -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_QUERY([r].[OptionalAssociate], '$.RequiredNestedAssociate') -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_QUERY([r].[OptionalAssociate], '$.OptionalNestedAssociate') -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r0`.`RequiredAssociate` -FROM `RootReferencingEntity` AS `r` -LEFT JOIN `RootEntity` AS `r0` ON `r`.`RootEntityId` = `r0`.`Id` -"""); - } - - public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -"""); - } - - public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); - - AssertSql( - """ -SELECT CAST(JSON_VALUE([r].[RequiredAssociate], '$.Int') AS int) -FROM [RootEntity] AS [r] -"""); - } - - #endregion Structural properties - - #region Structural collection properties - - public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_associate_collection(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r`.`AssociateCollection` -FROM `RootEntity` AS `r` -ORDER BY `r`.`Id` -"""); - } - - public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection') -FROM [RootEntity] AS [r] -ORDER BY [r].[Id] -"""); - } - - public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_QUERY([r].[OptionalAssociate], '$.NestedCollection') -FROM [RootEntity] AS [r] -ORDER BY [r].[Id] -"""); - } - - public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) - { - await base.SelectMany_associate_collection(queryTrackingBehavior); - - AssertSql( - """ -SELECT [a].[Id], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[NestedCollection], [a].[OptionalNestedAssociate], [a].[RequiredNestedAssociate] -FROM [RootEntity] AS [r] -CROSS APPLY OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String', - [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, - [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, - [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON -) AS [a] -"""); - } - - public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT [n].[Id], [n].[Int], [n].[Ints], [n].[Name], [n].[String] -FROM [RootEntity] AS [r] -CROSS APPLY OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' -) AS [n] -"""); - } - - public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT [n].[Id], [n].[Int], [n].[Ints], [n].[Name], [n].[String] -FROM [RootEntity] AS [r] -CROSS APPLY OPENJSON([r].[OptionalAssociate], '$.NestedCollection') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' -) AS [n] -"""); - } - - #endregion Structural collection properties - - #region Multiple - - public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_root_duplicated(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -"""); - } - - #endregion Multiple - - #region Subquery - - public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); - - AssertSql( - """ -SELECT [r1].[c] -FROM [RootEntity] AS [r] -OUTER APPLY ( - SELECT TOP(1) JSON_QUERY([r0].[RequiredAssociate], '$.RequiredNestedAssociate') AS [c] - FROM [RootEntity] AS [r0] - ORDER BY [r0].[Id] -) AS [r1] -"""); - } - - public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); - - AssertSql( - """ -SELECT [r1].[c] -FROM [RootEntity] AS [r] -OUTER APPLY ( - SELECT TOP(1) JSON_QUERY([r0].[OptionalAssociate], '$.RequiredNestedAssociate') AS [c] - FROM [RootEntity] AS [r0] - ORDER BY [r0].[Id] -) AS [r1] -"""); - } - - #endregion Subquery - - #region Value types - - public override async Task Select_root_with_value_types(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_root_with_value_types(queryTrackingBehavior); - - AssertSql( - """ -SELECT `v`.`Id`, `v`.`Name`, `v`.`AssociateCollection`, `v`.`OptionalAssociate`, `v`.`RequiredAssociate` -FROM `ValueRootEntity` AS `v` -"""); - } - - public override async Task Select_non_nullable_value_type(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_non_nullable_value_type(queryTrackingBehavior); - - AssertSql( - """ -SELECT `v`.`RequiredAssociate` -FROM `ValueRootEntity` AS `v` -ORDER BY `v`.`Id` -"""); - } - - public override async Task Select_nullable_value_type(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_nullable_value_type(queryTrackingBehavior); - - AssertSql( - """ -SELECT `v`.`OptionalAssociate` -FROM `ValueRootEntity` AS `v` -ORDER BY `v`.`Id` -"""); - } - - public override async Task Select_nullable_value_type_with_Value(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_nullable_value_type_with_Value(queryTrackingBehavior); - - AssertSql( - """ -SELECT `v`.`OptionalAssociate` -FROM `ValueRootEntity` AS `v` -ORDER BY `v`.`Id` -"""); - } - - #endregion Value types - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsJetTest.cs deleted file mode 100644 index df4241bf..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsJetTest.cs +++ /dev/null @@ -1,105 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; - -public class ComplexJsonSetOperationsJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : ComplexJsonSetOperationsRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Over_associate_collections() - { - await base.Over_associate_collections(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM ( - SELECT 1 AS empty - FROM OPENJSON([r].[AssociateCollection], '$') WITH ([Int] int '$.Int') AS [a] - WHERE [a].[Int] = 8 - UNION ALL - SELECT 1 AS empty - FROM OPENJSON([r].[AssociateCollection], '$') WITH ([String] nvarchar(max) '$.String') AS [a0] - WHERE [a0].[String] = N'foo' - ) AS [u]) = 4 -"""); - } - - public override async Task Over_associate_collection_projected(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Over_associate_collection_projected(queryTrackingBehavior); - - AssertSql(); - } - - public override async Task Over_assocate_collection_Select_nested_with_aggregates_projected(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Over_assocate_collection_Select_nested_with_aggregates_projected(queryTrackingBehavior); - - AssertSql( - """ -SELECT ( - SELECT COALESCE(SUM([s].[value]), 0) - FROM ( - SELECT [a].[NestedCollection] AS [NestedCollection] - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Int] int '$.Int', - [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON - ) AS [a] - WHERE [a].[Int] = 8 - UNION ALL - SELECT [a0].[NestedCollection] AS [NestedCollection] - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [String] nvarchar(max) '$.String', - [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON - ) AS [a0] - WHERE [a0].[String] = N'foo' - ) AS [u] - OUTER APPLY ( - SELECT COALESCE(SUM([n].[Int]), 0) AS [value] - FROM OPENJSON([u].[NestedCollection], '$') WITH ([Int] int '$.Int') AS [n] - ) AS [s]) -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Over_nested_associate_collection() - { - await base.Over_nested_associate_collection(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM ( - SELECT 1 AS empty - FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ([Int] int '$.Int') AS [n] - WHERE [n].[Int] = 8 - UNION ALL - SELECT 1 AS empty - FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ([String] nvarchar(max) '$.String') AS [n0] - WHERE [n0].[String] = N'foo' - ) AS [u]) = 4 -"""); - } - - public override async Task Over_different_collection_properties() - { - await base.Over_different_collection_properties(); - - AssertSql(); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityJetTest.cs deleted file mode 100644 index 053a8fb2..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityJetTest.cs +++ /dev/null @@ -1,284 +0,0 @@ -// 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.Query.Associations.ComplexJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; - -public class ComplexJsonStructuralEqualityJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : ComplexJsonStructuralEqualityRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Two_associates() - { - await base.Two_associates(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE (`r`.`RequiredAssociate`) = (`r`.`OptionalAssociate`) -"""); - } - - public override async Task Two_nested_associates() - { - await base.Two_nested_associates(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate') = JSON_QUERY([r].[OptionalAssociate], '$.RequiredNestedAssociate') -"""); - } - - public override async Task Not_equals() - { - await base.Not_equals(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE (`r`.`RequiredAssociate`) <> (`r`.`OptionalAssociate`) OR (`r`.`OptionalAssociate`) IS NULL -"""); - } - - public override async Task Associate_with_inline_null() - { - await base.Associate_with_inline_null(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE (`r`.`OptionalAssociate`) IS NULL -"""); - } - - public override async Task Associate_with_parameter_null() - { - await base.Associate_with_parameter_null(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE (`r`.`OptionalAssociate`) IS NULL -"""); - } - - public override async Task Nested_associate_with_inline_null() - { - await base.Nested_associate_with_inline_null(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE JSON_QUERY([r].[RequiredAssociate], '$.OptionalNestedAssociate') IS NULL -"""); - } - - public override async Task Nested_associate_with_inline() - { - await base.Nested_associate_with_inline(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate') = '{"Id":1000,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_RequiredNestedAssociate","String":"foo"}' -"""); - } - - public override async Task Nested_associate_with_parameter() - { - await base.Nested_associate_with_parameter(); - - AssertSql( - """ -@entity_equality_nested='{"Id":1000,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_RequiredNestedAssociate","String":"foo"}' (Size = 106) - -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate') = @entity_equality_nested -"""); - } - - public override async Task Two_nested_collections() - { - await base.Two_nested_collections(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection') = JSON_QUERY([r].[OptionalAssociate], '$.NestedCollection') -"""); - } - - public override async Task Nested_collection_with_inline() - { - await base.Nested_collection_with_inline(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection') = '[{"Id":1002,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_1","String":"foo"},{"Id":1003,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_2","String":"foo"}]' -"""); - } - - public override async Task Nested_collection_with_parameter() - { - await base.Nested_collection_with_parameter(); - - AssertSql( - """ -@entity_equality_nestedCollection='[{"Id":1002,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_1","String":"foo"},{"Id":1003,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_2","String":"foo"}]' (Size = 205) - -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection') = @entity_equality_nestedCollection -"""); - } - - #region Contains - - public override async Task Contains_with_inline() - { - await base.Contains_with_inline(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE EXISTS ( - SELECT 1 - FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' - ) AS [n] - WHERE [n].[Id] = 1002 AND [n].[Int] = 8 AND [n].[Ints] = N'[1,2,3]' AND [n].[Name] = N'Root1_RequiredAssociate_NestedCollection_1' AND [n].[String] = N'foo') -"""); - } - - public override async Task Contains_with_parameter() - { - await base.Contains_with_parameter(); - - AssertSql( - """ -@entity_equality_nested_Id='1002' (Nullable = true) -@entity_equality_nested_Int='8' (Nullable = true) -@entity_equality_nested_Ints='[1,2,3]' (Size = 4000) -@entity_equality_nested_Name='Root1_RequiredAssociate_NestedCollection_1' (Size = 4000) -@entity_equality_nested_String='foo' (Size = 4000) - -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE EXISTS ( - SELECT 1 - FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' - ) AS [n] - WHERE [n].[Id] = @entity_equality_nested_Id AND [n].[Int] = @entity_equality_nested_Int AND [n].[Ints] = @entity_equality_nested_Ints AND [n].[Name] = @entity_equality_nested_Name AND [n].[String] = @entity_equality_nested_String) -"""); - } - - public override async Task Contains_with_operators_composed_on_the_collection() - { - await base.Contains_with_operators_composed_on_the_collection(); - - AssertSql( - """ -@get_Item_Int='106' -@entity_equality_get_Item_Id='3003' (Nullable = true) -@entity_equality_get_Item_Int='108' (Nullable = true) -@entity_equality_get_Item_Ints='[8,9,109]' (Size = 4000) -@entity_equality_get_Item_Name='Root3_RequiredAssociate_NestedCollection_2' (Size = 4000) -@entity_equality_get_Item_String='foo104' (Size = 4000) - -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE EXISTS ( - SELECT 1 - FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' - ) AS [n] - WHERE [n].[Int] > @get_Item_Int AND [n].[Id] = @entity_equality_get_Item_Id AND [n].[Int] = @entity_equality_get_Item_Int AND [n].[Ints] = @entity_equality_get_Item_Ints AND [n].[Name] = @entity_equality_get_Item_Name AND [n].[String] = @entity_equality_get_Item_String) -"""); - } - - public override async Task Contains_with_nested_and_composed_operators() - { - await base.Contains_with_nested_and_composed_operators(); - - AssertSql( - """ -@get_Item_Id='302' -@entity_equality_get_Item_Id='303' (Nullable = true) -@entity_equality_get_Item_Int='130' (Nullable = true) -@entity_equality_get_Item_Ints='[8,9,131]' (Size = 4000) -@entity_equality_get_Item_Name='Root3_AssociateCollection_2' (Size = 4000) -@entity_equality_get_Item_String='foo115' (Size = 4000) -@entity_equality_get_Item_NestedCollection='[{"Id":3014,"Int":136,"Ints":[8,9,137],"Name":"Root3_AssociateCollection_2_NestedCollection_1","String":"foo118"},{"Id":3015,"Int":138,"Ints":[8,9,139],"Name":"Root3_Root1_AssociateCollection_2_NestedCollection_2","String":"foo119"}]' (Size = 233) -@entity_equality_get_Item_OptionalNestedAssociate='{"Id":3013,"Int":134,"Ints":[8,9,135],"Name":"Root3_AssociateCollection_2_OptionalNestedAssociate","String":"foo117"}' (Size = 117) -@entity_equality_get_Item_RequiredNestedAssociate='{"Id":3012,"Int":132,"Ints":[8,9,133],"Name":"Root3_AssociateCollection_2_RequiredNestedAssociate","String":"foo116"}' (Size = 117) - -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE EXISTS ( - SELECT 1 - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String', - [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, - [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, - [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON - ) AS [a] - WHERE [a].[Id] > @get_Item_Id AND [a].[Id] = @entity_equality_get_Item_Id AND [a].[Int] = @entity_equality_get_Item_Int AND [a].[Ints] = @entity_equality_get_Item_Ints AND [a].[Name] = @entity_equality_get_Item_Name AND [a].[String] = @entity_equality_get_Item_String AND [a].[NestedCollection] = @entity_equality_get_Item_NestedCollection AND [a].[OptionalNestedAssociate] = @entity_equality_get_Item_OptionalNestedAssociate AND [a].[RequiredNestedAssociate] = @entity_equality_get_Item_RequiredNestedAssociate) -"""); - } - - #endregion Contains - - #region Value types - - public override async Task Nullable_value_type_with_null() - { - await base.Nullable_value_type_with_null(); - - AssertSql( - """ -SELECT `v`.`Id`, `v`.`Name`, `v`.`AssociateCollection`, `v`.`OptionalAssociate`, `v`.`RequiredAssociate` -FROM `ValueRootEntity` AS `v` -WHERE (`v`.`OptionalAssociate`) IS NULL -"""); - } - - #endregion Value types - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionJetTest.cs index f958980d..fec1da44 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionJetTest.cs @@ -257,6 +257,23 @@ public override async Task Select_root_duplicated(QueryTrackingBehavior queryTra #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r1].[Id], [r1].[Name], [r1].[OptionalAssociate_Id], [r1].[OptionalAssociate_Int], [r1].[OptionalAssociate_Ints], [r1].[OptionalAssociate_Name], [r1].[OptionalAssociate_String], [r1].[OptionalAssociate_OptionalNestedAssociate_Id], [r1].[OptionalAssociate_OptionalNestedAssociate_Int], [r1].[OptionalAssociate_OptionalNestedAssociate_Ints], [r1].[OptionalAssociate_OptionalNestedAssociate_Name], [r1].[OptionalAssociate_OptionalNestedAssociate_String], [r1].[OptionalAssociate_RequiredNestedAssociate_Id], [r1].[OptionalAssociate_RequiredNestedAssociate_Int], [r1].[OptionalAssociate_RequiredNestedAssociate_Ints], [r1].[OptionalAssociate_RequiredNestedAssociate_Name], [r1].[OptionalAssociate_RequiredNestedAssociate_String], [r1].[RequiredAssociate_Id], [r1].[RequiredAssociate_Int], [r1].[RequiredAssociate_Ints], [r1].[RequiredAssociate_Name], [r1].[RequiredAssociate_String], [r1].[RequiredAssociate_OptionalNestedAssociate_Id], [r1].[RequiredAssociate_OptionalNestedAssociate_Int], [r1].[RequiredAssociate_OptionalNestedAssociate_Ints], [r1].[RequiredAssociate_OptionalNestedAssociate_Name], [r1].[RequiredAssociate_OptionalNestedAssociate_String], [r1].[RequiredAssociate_RequiredNestedAssociate_Id], [r1].[RequiredAssociate_RequiredNestedAssociate_Int], [r1].[RequiredAssociate_RequiredNestedAssociate_Ints], [r1].[RequiredAssociate_RequiredNestedAssociate_Name], [r1].[RequiredAssociate_RequiredNestedAssociate_String], [r1].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[Id], [r0].[Name], [r0].[OptionalAssociate_Id], [r0].[OptionalAssociate_Int], [r0].[OptionalAssociate_Ints], [r0].[OptionalAssociate_Name], [r0].[OptionalAssociate_String], [r0].[OptionalAssociate_OptionalNestedAssociate_Id], [r0].[OptionalAssociate_OptionalNestedAssociate_Int], [r0].[OptionalAssociate_OptionalNestedAssociate_Ints], [r0].[OptionalAssociate_OptionalNestedAssociate_Name], [r0].[OptionalAssociate_OptionalNestedAssociate_String], [r0].[OptionalAssociate_RequiredNestedAssociate_Id], [r0].[OptionalAssociate_RequiredNestedAssociate_Int], [r0].[OptionalAssociate_RequiredNestedAssociate_Ints], [r0].[OptionalAssociate_RequiredNestedAssociate_Name], [r0].[OptionalAssociate_RequiredNestedAssociate_String], [r0].[RequiredAssociate_Id], [r0].[RequiredAssociate_Int], [r0].[RequiredAssociate_Ints], [r0].[RequiredAssociate_Name], [r0].[RequiredAssociate_String], [r0].[RequiredAssociate_OptionalNestedAssociate_Id], [r0].[RequiredAssociate_OptionalNestedAssociate_Int], [r0].[RequiredAssociate_OptionalNestedAssociate_Ints], [r0].[RequiredAssociate_OptionalNestedAssociate_Name], [r0].[RequiredAssociate_OptionalNestedAssociate_String], [r0].[RequiredAssociate_RequiredNestedAssociate_Id], [r0].[RequiredAssociate_RequiredNestedAssociate_Int], [r0].[RequiredAssociate_RequiredNestedAssociate_Ints], [r0].[RequiredAssociate_RequiredNestedAssociate_Name], [r0].[RequiredAssociate_RequiredNestedAssociate_String], 1 AS [c] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs index f79cbed0..96fa114f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs @@ -365,6 +365,30 @@ LEFT JOIN ( #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r].[Id], [r1].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [r1].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +LEFT JOIN ( + SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n].[Id] AS [Id0], [n0].[Id] AS [Id1], [n1].[Id] AS [Id2], [n1].[CollectionAssociateId], [n1].[Int] AS [Int0], [n1].[Ints] AS [Ints0], [n1].[Name] AS [Name0], [n1].[String] AS [String0], [n].[CollectionAssociateId] AS [CollectionAssociateId0], [n].[Int] AS [Int1], [n].[Ints] AS [Ints1], [n].[Name] AS [Name1], [n].[String] AS [String1], [n0].[CollectionAssociateId] AS [CollectionAssociateId1], [n0].[Int] AS [Int2], [n0].[Ints] AS [Ints2], [n0].[Name] AS [Name2], [n0].[String] AS [String2] + FROM [AssociateType] AS [a] + LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] + INNER JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] + LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] +) AS [s] ON [r1].[Id] = [s].[CollectionRootId] +ORDER BY [r].[Id], [r1].[Id], [s].[Id], [s].[Id0], [s].[Id1] +"""); + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonBulkUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonBulkUpdateJetTest.cs deleted file mode 100644 index 9848b7ec..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonBulkUpdateJetTest.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; - -public class OwnedJsonBulkUpdateJetTest( - OwnedJsonJetFixture fixture, - ITestOutputHelper testOutputHelper) - : OwnedJsonBulkUpdateRelationalTestBase(fixture, testOutputHelper); diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionJetTest.cs deleted file mode 100644 index 16208a52..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionJetTest.cs +++ /dev/null @@ -1,269 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; - -public class OwnedJsonCollectionJetTest(OwnedJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : OwnedJsonCollectionRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Count() - { - await base.Count(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON([r].[AssociateCollection], '$') AS [a]) = 2 -"""); - } - - public override async Task Where() - { - await base.Where(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' - ) AS [a] - WHERE [a].[Int] <> 8) = 2 -"""); - } - - public override async Task OrderBy_ElementAt() - { - await base.OrderBy_ElementAt(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT [a].[Int] - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' - ) AS [a] - ORDER BY [a].[Id] - OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) = 8 -"""); - } - - #region Distinct - - public override async Task Distinct() - { - await base.Distinct(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM ( - SELECT DISTINCT [r].[Id], [a].[Id] AS [Id0], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[NestedCollection] AS [c], [a].[OptionalNestedAssociate] AS [c0], [a].[RequiredNestedAssociate] AS [c1] - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String', - [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, - [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, - [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON - ) AS [a] - ) AS [a0]) = 2 -"""); - } - - public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) - { - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - await base.Distinct_projected(queryTrackingBehavior); - } - else - { - await base.Distinct_projected(queryTrackingBehavior); - - AssertSql( - """ -SELECT [r].[Id], [a0].[Id], [a0].[Id0], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[String], [a0].[c], [a0].[c0], [a0].[c1] -FROM [RootEntity] AS [r] -OUTER APPLY ( - SELECT DISTINCT [r].[Id], [a].[Id] AS [Id0], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[NestedCollection] AS [c], [a].[OptionalNestedAssociate] AS [c0], [a].[RequiredNestedAssociate] AS [c1] - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String', - [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, - [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, - [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON - ) AS [a] -) AS [a0] -ORDER BY [r].[Id], [a0].[Id0], [a0].[Int], [a0].[Ints], [a0].[Name] -"""); - } - } - - public override async Task Distinct_over_projected_nested_collection() - { - await base.Distinct_over_projected_nested_collection(); - - AssertSql(); - } - - public override async Task Distinct_over_projected_filtered_nested_collection() - { - await base.Distinct_over_projected_filtered_nested_collection(); - - AssertSql(); - } - - #endregion Distinct - - #region Index - - public override async Task Index_constant() - { - await base.Index_constant(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[0].Int') AS int) = 8 -"""); - } - - - public override async Task Index_parameter() - { - await base.Index_parameter(); - - AssertSql( - """ -@i='0' - -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[' + CAST(@i AS nvarchar(max)) + '].Int') AS int) = 8 -"""); - } - - public override async Task Index_column() - { - await base.Index_column(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[' + CAST([r].[Id] - 1 AS nvarchar(max)) + '].Int') AS int) = 8 -"""); - } - - public override async Task Index_on_nested_collection() - { - await base.Index_on_nested_collection(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.NestedCollection[0].Int') AS int) = 8 -"""); - } - - public override async Task Index_out_of_bounds() - { - await base.Index_out_of_bounds(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[9999].Int') AS int) = 8 -"""); - } - - #endregion Index - - #region GroupBy - - [ConditionalFact] - public override async Task GroupBy() - { - await base.GroupBy(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE 16 IN ( - SELECT COALESCE(SUM([a0].[Int]), 0) - FROM ( - SELECT [a].[Id] AS [Id0], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[String] AS [Key0] - FROM OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' - ) AS [a] - ) AS [a0] - GROUP BY [a0].[Key0] -) -"""); - } - - #endregion GroupBy - - public override async Task Select_within_Select_within_Select_with_aggregates() - { - await base.Select_within_Select_within_Select_with_aggregates(); - - AssertSql( - """ -SELECT ( - SELECT COALESCE(SUM([s].[value]), 0) - FROM OPENJSON([r].[AssociateCollection], '$') WITH ([NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON) AS [a] - OUTER APPLY ( - SELECT MAX([n].[Int]) AS [value] - FROM OPENJSON([a].[NestedCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' - ) AS [n] - ) AS [s]) -FROM [RootEntity] AS [r] -"""); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonJetFixture.cs deleted file mode 100644 index 1fe7c50f..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonJetFixture.cs +++ /dev/null @@ -1,18 +0,0 @@ -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; -using Microsoft.EntityFrameworkCore.TestUtilities; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; - -public class OwnedJsonJetFixture : OwnedJsonRelationalFixtureBase -{ - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; - - public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - { - var options = base.AddOptions(builder); - return options; - } -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousJetTest.cs deleted file mode 100644 index eca2c336..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousJetTest.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; - -public class OwnedJsonMiscellaneousJetTest( - OwnedJsonJetFixture fixture, - ITestOutputHelper testOutputHelper) - : OwnedJsonMiscellaneousRelationalTestBase(fixture, testOutputHelper) -{ - #region Simple filters - - public override async Task Where_on_associate_scalar_property() - { - await base.Where_on_associate_scalar_property(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.Int') AS int) = 8 -"""); - } - - public override async Task Where_on_optional_associate_scalar_property() - { - await base.Where_on_optional_associate_scalar_property(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[OptionalAssociate], '$.Int') AS int) = 8 -"""); - } - - public override async Task Where_on_nested_associate_scalar_property() - { - await base.Where_on_nested_associate_scalar_property(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.RequiredNestedAssociate.Int') AS int) = 8 -"""); - } - - #endregion Simple filters - - public override async Task FromSql_on_root() - { - await base.FromSql_on_root(); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`Name`, `m`.`AssociateCollection`, `m`.`OptionalAssociate`, `m`.`RequiredAssociate` -FROM ( - SELECT * FROM `RootEntity` -) AS `m` -"""); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionJetTest.cs deleted file mode 100644 index b9500483..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionJetTest.cs +++ /dev/null @@ -1,101 +0,0 @@ -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; - -public class OwnedJsonPrimitiveCollectionJetTest(OwnedJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : OwnedJsonPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Count() - { - await base.Count(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) AS [i]) = 3 -"""); - } - - public override async Task Index() - { - await base.Index(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.Ints[0]') AS int) = 1 -"""); - } - - public override async Task Contains() - { - await base.Contains(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE 3 IN ( - SELECT [i].[value] - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i] -) -"""); - } - - public override async Task Any_predicate() - { - await base.Any_predicate(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE 2 IN ( - SELECT [i].[value] - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i] -) -"""); - } - - public override async Task Nested_Count() - { - await base.Nested_Count(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate.Ints')) AS [i]) = 3 -"""); - } - - public override async Task Select_Sum() - { - await base.Select_Sum(); - - AssertSql( - """ -SELECT ( - SELECT COALESCE(SUM([i0].[value]), 0) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i0]) -FROM [RootEntity] AS [r] -WHERE ( - SELECT COALESCE(SUM([i].[value]), 0) - FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i]) >= 6 -"""); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionJetTest.cs deleted file mode 100644 index 73ac404b..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionJetTest.cs +++ /dev/null @@ -1,372 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; - -public class OwnedJsonProjectionJetTest(OwnedJsonJetFixture fixture, ITestOutputHelper testOutputHelper) - : OwnedJsonProjectionRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_root(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -"""); - } - - #region Scalar properties - - public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_VALUE([r].[RequiredAssociate], '$.String') -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_property_on_optional_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT JSON_VALUE([r].[OptionalAssociate], '$.String') -FROM [RootEntity] AS [r] -"""); - } - - public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); - - AssertSql( -); - } - - public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); - - AssertSql( - """ -SELECT CAST(JSON_VALUE([r].[OptionalAssociate], '$.Int') AS int) -FROM [RootEntity] AS [r] -"""); - } - - #endregion Scalar properties - - #region Structural properties - - public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT `r`.`RequiredAssociate`, `r`.`Id` -FROM `RootEntity` AS `r` -"""); - } - } - - public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_optional_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT `r`.`OptionalAssociate`, `r`.`Id` -FROM `RootEntity` AS `r` -"""); - } - } - - public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_required_nested_on_required_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate'), [r].[Id] -FROM [RootEntity] AS [r] -"""); - } - } - - public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT JSON_QUERY([r].[RequiredAssociate], '$.OptionalNestedAssociate'), [r].[Id] -FROM [RootEntity] AS [r] -"""); - } - } - - public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT JSON_QUERY([r].[OptionalAssociate], '$.RequiredNestedAssociate'), [r].[Id] -FROM [RootEntity] AS [r] -"""); - } - } - - public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT JSON_QUERY([r].[OptionalAssociate], '$.OptionalNestedAssociate'), [r].[Id] -FROM [RootEntity] AS [r] -"""); - } - } - - public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT `r0`.`RequiredAssociate`, `r0`.`Id` -FROM `RootReferencingEntity` AS `r` -LEFT JOIN `RootEntity` AS `r0` ON `r`.`RootEntityId` = `r0`.`Id` -"""); - } - } - - public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT `r`.`RequiredAssociate`, `r`.`Id` -FROM `RootEntity` AS `r` -"""); - } - } - - public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); - - AssertSql( - """ -SELECT CAST(JSON_VALUE([r].[RequiredAssociate], '$.Int') AS int) -FROM [RootEntity] AS [r] -"""); - } - - #endregion Structural properties - - #region Structural collection properties - - public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_associate_collection(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT `r`.`AssociateCollection`, `r`.`Id` -FROM `RootEntity` AS `r` -ORDER BY `r`.`Id` -"""); - } - } - - public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection'), [r].[Id] -FROM [RootEntity] AS [r] -ORDER BY [r].[Id] -"""); - } - } - - public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT JSON_QUERY([r].[OptionalAssociate], '$.NestedCollection'), [r].[Id] -FROM [RootEntity] AS [r] -ORDER BY [r].[Id] -"""); - } - } - - public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) - { - await base.SelectMany_associate_collection(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT [r].[Id], [a].[Id], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[NestedCollection], [a].[OptionalNestedAssociate], [a].[RequiredNestedAssociate] -FROM [RootEntity] AS [r] -CROSS APPLY OPENJSON([r].[AssociateCollection], '$') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String', - [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, - [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, - [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON -) AS [a] -"""); - } - } - - public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT [r].[Id], [n].[Id], [n].[Int], [n].[Ints], [n].[Name], [n].[String] -FROM [RootEntity] AS [r] -CROSS APPLY OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' -) AS [n] -"""); - } - } - - public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) - { - await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT [r].[Id], [n].[Id], [n].[Int], [n].[Ints], [n].[Name], [n].[String] -FROM [RootEntity] AS [r] -CROSS APPLY OPENJSON([r].[OptionalAssociate], '$.NestedCollection') WITH ( - [Id] int '$.Id', - [Int] int '$.Int', - [Ints] nvarchar(max) '$.Ints' AS JSON, - [Name] nvarchar(max) '$.Name', - [String] nvarchar(max) '$.String' -) AS [n] -"""); - } - } - - #endregion Structural collection properties - - #region Multiple - - public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_root_duplicated(queryTrackingBehavior); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -"""); - } - - #endregion Multiple - - #region Subquery - - public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT [r1].[c], [r1].[Id] -FROM [RootEntity] AS [r] -OUTER APPLY ( - SELECT TOP(1) JSON_QUERY([r0].[RequiredAssociate], '$.RequiredNestedAssociate') AS [c], [r0].[Id] - FROM [RootEntity] AS [r0] - ORDER BY [r0].[Id] -) AS [r1] -"""); - } - } - - public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); - - if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT [r1].[c], [r1].[Id] -FROM [RootEntity] AS [r] -OUTER APPLY ( - SELECT TOP(1) JSON_QUERY([r0].[OptionalAssociate], '$.RequiredNestedAssociate') AS [c], [r0].[Id] - FROM [RootEntity] AS [r0] - ORDER BY [r0].[Id] -) AS [r1] -"""); - } - } - - #endregion Subquery - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityJetTest.cs deleted file mode 100644 index 56a32f30..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityJetTest.cs +++ /dev/null @@ -1,165 +0,0 @@ -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; - -public class OwnedJsonStructuralEqualityJetTest( - OwnedJsonJetFixture fixture, - ITestOutputHelper testOutputHelper) - : OwnedJsonStructuralEqualityRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Two_associates() - { - await base.Two_associates(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE FALSE -"""); - } - - public override async Task Two_nested_associates() - { - await base.Two_nested_associates(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE FALSE -"""); - } - - public override async Task Not_equals() - { - await base.Not_equals(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE FALSE -"""); - } - - public override async Task Associate_with_inline_null() - { - await base.Associate_with_inline_null(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE (`r`.`OptionalAssociate`) IS NULL -"""); - } - - public override async Task Associate_with_parameter_null() - { - await base.Associate_with_parameter_null(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE FALSE -"""); - } - - public override async Task Nested_associate_with_inline_null() - { - await base.Nested_associate_with_inline_null(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] -FROM [RootEntity] AS [r] -WHERE JSON_QUERY([r].[RequiredAssociate], '$.OptionalNestedAssociate') IS NULL -"""); - } - - public override async Task Nested_associate_with_inline() - { - await base.Nested_associate_with_inline(); - - AssertSql( - ); - } - - public override async Task Nested_associate_with_parameter() - { - await base.Nested_associate_with_parameter(); - - AssertSql( - ); - } - - public override async Task Two_nested_collections() - { - await base.Two_nested_collections(); - - AssertSql( - """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` -FROM `RootEntity` AS `r` -WHERE FALSE -"""); - } - - public override async Task Nested_collection_with_inline() - { - await base.Nested_collection_with_inline(); - - AssertSql( - ); - } - - public override async Task Nested_collection_with_parameter() - { - await base.Nested_collection_with_parameter(); - - AssertSql( - ); - } - - #region Contains - - public override async Task Contains_with_inline() - { - await base.Contains_with_inline(); - - AssertSql(); - } - - public override async Task Contains_with_parameter() - { - await base.Contains_with_parameter(); - - AssertSql(); - } - - public override async Task Contains_with_operators_composed_on_the_collection() - { - await base.Contains_with_operators_composed_on_the_collection(); - - AssertSql(); - } - - public override async Task Contains_with_nested_and_composed_operators() - { - await base.Contains_with_nested_and_composed_operators(); - - AssertSql(); - } - - #endregion Contains - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonTypeJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonTypeJetFixture.cs deleted file mode 100644 index b43758dd..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonTypeJetFixture.cs +++ /dev/null @@ -1,23 +0,0 @@ -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; -using Microsoft.EntityFrameworkCore.TestUtilities; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; - -public class OwnedJsonTypeJetFixture : OwnedJsonRelationalFixtureBase -{ - protected override string StoreName - => "OwnedJsonTypeRelationshipsQueryTest"; - - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; - - // protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) - // { - // base.OnModelCreating(modelBuilder, context); - - // modelBuilder.Entity().OwnsOne(x => x.RequiredTrunk).HasColumnType("json"); - // modelBuilder.Entity().OwnsOne(x => x.OptionalTrunk).HasColumnType("json"); - // modelBuilder.Entity().OwnsMany(x => x.CollectionTrunk).HasColumnType("json"); - // } -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionJetTest.cs index 5be4a352..9d9a8062 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionJetTest.cs @@ -401,6 +401,33 @@ LEFT JOIN ( #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [r5].[Id], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [r5].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r5] +LEFT JOIN ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r3].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r3].[AssociateTypeId] AS [AssociateTypeId0], [r4].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r4].[AssociateTypeId] AS [AssociateTypeId1], [r4].[Id] AS [Id0], [r4].[Int] AS [Int0], [r4].[Ints] AS [Ints0], [r4].[Name] AS [Name0], [r4].[String] AS [String0], [r2].[Id] AS [Id1], [r2].[Int] AS [Int1], [r2].[Ints] AS [Ints1], [r2].[Name] AS [Name1], [r2].[String] AS [String1], [r3].[Id] AS [Id2], [r3].[Int] AS [Int2], [r3].[Ints] AS [Ints2], [r3].[Name] AS [Name2], [r3].[String] AS [String2] + FROM [RelatedCollection] AS [r1] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r3] ON [r1].[RootEntityId] = [r3].[AssociateTypeRootEntityId] AND [r1].[Id] = [r3].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r4] ON [r1].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r1].[Id] = [r4].[AssociateTypeId] +) AS [s] ON [r5].[Id] = [s].[RootEntityId] +ORDER BY [r].[Id], [r5].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1] +"""); + } + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionJetTest.cs deleted file mode 100644 index ed041afb..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionJetTest.cs +++ /dev/null @@ -1,153 +0,0 @@ -using Microsoft.EntityFrameworkCore.Query.Associations.OwnedTableSplitting; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting; - -public class OwnedTableSplittingPrimitiveCollectionJetTest( - OwnedTableSplittingJetFixture fixture, - ITestOutputHelper testOutputHelper) - : OwnedTableSplittingPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) -{ - public override async Task Count() - { - await base.Count(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r3].[AssociateTypeRootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] -FROM [RootEntity] AS [r] -LEFT JOIN ( - SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] - FROM [RelatedCollection] AS [r1] - LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] -) AS [s] ON [r].[Id] = [s].[RootEntityId] -LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE - WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] -END = [o].[AssociateTypeRootEntityId] -LEFT JOIN [RequiredRelated_NestedCollection] AS [r3] ON [r].[Id] = [r3].[AssociateTypeRootEntityId] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON([r].[RequiredAssociate_Ints]) AS [r0]) = 3 -ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r3].[AssociateTypeRootEntityId] -"""); - } - - public override async Task Index() - { - await base.Index(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] -FROM [RootEntity] AS [r] -LEFT JOIN ( - SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] - FROM [RelatedCollection] AS [r0] - LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] -) AS [s] ON [r].[Id] = [s].[RootEntityId] -LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE - WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] -END = [o].[AssociateTypeRootEntityId] -LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] -WHERE CAST(JSON_VALUE([r].[RequiredAssociate_Ints], '$[0]') AS int) = 1 -ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] -"""); - } - - public override async Task Contains() - { - await base.Contains(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r3].[AssociateTypeRootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] -FROM [RootEntity] AS [r] -LEFT JOIN ( - SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] - FROM [RelatedCollection] AS [r1] - LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] -) AS [s] ON [r].[Id] = [s].[RootEntityId] -LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE - WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] -END = [o].[AssociateTypeRootEntityId] -LEFT JOIN [RequiredRelated_NestedCollection] AS [r3] ON [r].[Id] = [r3].[AssociateTypeRootEntityId] -WHERE 3 IN ( - SELECT [r0].[value] - FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0] -) -ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r3].[AssociateTypeRootEntityId] -"""); - } - - public override async Task Any_predicate() - { - await base.Any_predicate(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r3].[AssociateTypeRootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] -FROM [RootEntity] AS [r] -LEFT JOIN ( - SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] - FROM [RelatedCollection] AS [r1] - LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] -) AS [s] ON [r].[Id] = [s].[RootEntityId] -LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE - WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] -END = [o].[AssociateTypeRootEntityId] -LEFT JOIN [RequiredRelated_NestedCollection] AS [r3] ON [r].[Id] = [r3].[AssociateTypeRootEntityId] -WHERE 2 IN ( - SELECT [r0].[value] - FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0] -) -ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r3].[AssociateTypeRootEntityId] -"""); - } - - public override async Task Nested_Count() - { - await base.Nested_Count(); - - AssertSql( - """ -SELECT [r].[Id], [r].[Name], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r3].[AssociateTypeRootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] -FROM [RootEntity] AS [r] -LEFT JOIN ( - SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] - FROM [RelatedCollection] AS [r1] - LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] -) AS [s] ON [r].[Id] = [s].[RootEntityId] -LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE - WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] -END = [o].[AssociateTypeRootEntityId] -LEFT JOIN [RequiredRelated_NestedCollection] AS [r3] ON [r].[Id] = [r3].[AssociateTypeRootEntityId] -WHERE ( - SELECT COUNT(*) - FROM OPENJSON([r].[RequiredAssociate_RequiredNestedAssociate_Ints]) AS [r0]) = 3 -ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r3].[AssociateTypeRootEntityId] -"""); - } - - public override async Task Select_Sum() - { - await base.Select_Sum(); - - AssertSql( - """ -SELECT ( - SELECT COALESCE(SUM([r1].[value]), 0) - FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r1]) -FROM [RootEntity] AS [r] -WHERE ( - SELECT COALESCE(SUM([r0].[value]), 0) - FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0]) >= 6 -"""); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionJetTest.cs index c62c6768..b4c2f7a1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionJetTest.cs @@ -360,6 +360,31 @@ WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS N #region Subquery + public override async Task Select_subquery_FirstOrDefault_complex_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [r3].[Id], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r3].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r3] +LEFT JOIN ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r1] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] +) AS [s] ON [r3].[Id] = [s].[RootEntityId] +ORDER BY [r].[Id], [r3].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId] +"""); + } + } + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); diff --git a/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs index 68b73c80..3e3f0d61 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs @@ -766,4 +766,16 @@ public override async Task Tpc_entity_owning_a_split_collection_on_leaf(bool asy AssertSql(); } + + public override async Task Compare_split_entity_to_null(bool async) + { + await base.Compare_split_entity_to_null(async); + + AssertSql( + """ +SELECT `e`.`Id`, `e`.`EntityThreeId`, `e`.`IntValue1`, `e`.`IntValue2`, `s`.`IntValue3`, `e`.`IntValue4`, `e`.`StringValue1`, `e`.`StringValue2`, `e`.`StringValue3`, `e`.`StringValue4` +FROM `EntityOne` AS `e` +INNER JOIN `SplitEntityOnePart` AS `s` ON `e`.`Id` = `s`.`Id` +"""); + } } diff --git a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs index b29969aa..f7438e12 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs @@ -5878,11 +5878,11 @@ public override async Task await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation(isAsync); AssertSql( -""" + """ SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` -WHERE IIF(`g`.`SquadId` IS NULL, NULL, MID(`t`.`Note`, 0 + 1, `g`.`SquadId`)) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `g`.`SquadId` IS NULL) AND `t`.`GearNickName` IS NULL) +WHERE IIF(`g`.`SquadId` IS NULL, NULL, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, `g`.`SquadId`)) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR IIF(0 = -1, 0, 0) IS NULL OR `g`.`SquadId` IS NULL) AND `t`.`GearNickName` IS NULL) """); } @@ -5893,12 +5893,12 @@ await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_tak isAsync); AssertSql( -""" + """ SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Squads` AS `s` ON `g`.`SquadId` = `s`.`Id` -WHERE IIF(LEN(`s`.`Name`) IS NULL, NULL, MID(`t`.`Note`, 0 + 1, IIF(LEN(`s`.`Name`) IS NULL, NULL, CLNG(LEN(`s`.`Name`))))) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `s`.`Name` IS NULL) AND `t`.`GearNickName` IS NULL) +WHERE IIF(LEN(`s`.`Name`) IS NULL, NULL, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, IIF(LEN(`s`.`Name`) IS NULL, NULL, CLNG(LEN(`s`.`Name`))))) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR IIF(0 = -1, 0, 0) IS NULL OR `s`.`Name` IS NULL) AND `t`.`GearNickName` IS NULL) """); } @@ -7905,8 +7905,8 @@ public override async Task Projecting_property_converted_to_nullable_with_functi await base.Projecting_property_converted_to_nullable_with_function_call(async); AssertSql( -""" -SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL), 0 + 1, 3) + """ +SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL), IIF(0 = -1, 0, 0) + 1, 3) FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` """); @@ -7917,8 +7917,8 @@ public override async Task Projecting_property_converted_to_nullable_with_functi await base.Projecting_property_converted_to_nullable_with_function_call2(async); AssertSql( -""" -SELECT `t`.`Note`, MID(`t`.`Note`, 0 + 1, IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL)) AS `Function` + """ +SELECT `t`.`Note`, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL)) AS `Function` FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs index ea4451da..b53ce599 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs @@ -1487,7 +1487,7 @@ public override async Task GroupBy_complex_key_aggregate(bool async) """ SELECT `s`.`Key`, COUNT(*) AS `Count` FROM ( - SELECT MID(`c`.`CustomerID`, 0 + 1, 1) AS `Key` + SELECT MID(`c`.`CustomerID`, IIF(0 = -1, 0, 0) + 1, 1) AS `Key` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ) AS `s` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs index 1b19186d..7cd3b39a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs @@ -3254,6 +3254,20 @@ public override async Task Parameter_extraction_short_circuits_3(bool isAsync) """); } + public override async Task Captured_variable_from_switch_case_pattern_matching(bool async) + { + await base.Captured_variable_from_switch_case_pattern_matching(async); + + AssertSql( + """ +@customerId='ALFKI' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerId +"""); + } + public override async Task Subquery_member_pushdown_does_not_change_original_subquery_model(bool isAsync) { await base.Subquery_member_pushdown_does_not_change_original_subquery_model(isAsync); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs index d9ea12a6..103f4e46 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs @@ -2141,7 +2141,7 @@ public override async Task Projection_Distinct_projection_preserves_columns_used """ SELECT (IIF(`c0`.`FirstLetter` IS NULL, '', `c0`.`FirstLetter`) & ' ') & `c0`.`Foo` AS `Aggregate` FROM ( - SELECT DISTINCT `c`.`CustomerID`, MID(`c`.`CustomerID`, 0 + 1, 1) AS `FirstLetter`, 'Foo' AS `Foo` + SELECT DISTINCT `c`.`CustomerID`, MID(`c`.`CustomerID`, IIF(0 = -1, 0, 0) + 1, 1) AS `FirstLetter`, 'Foo' AS `Foo` FROM `Customers` AS `c` ) AS `c0` """); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs index cbd39fbc..baa43ed0 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs @@ -3227,10 +3227,10 @@ public override async Task Null_semantics_function(bool async) await base.Null_semantics_function(async); AssertSql( -""" + """ SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE (MID(`e`.`NullableStringA`, 0 + 1, `e`.`IntA`) <> `e`.`NullableStringB` OR `e`.`NullableStringA` IS NULL OR `e`.`NullableStringB` IS NULL) AND (`e`.`NullableStringA` IS NOT NULL OR `e`.`NullableStringB` IS NOT NULL) +WHERE (MID(`e`.`NullableStringA`, IIF(0 = -1, 0, 0) + 1, `e`.`IntA`) <> `e`.`NullableStringB` OR `e`.`NullableStringA` IS NULL OR IIF(0 = -1, 0, 0) IS NULL OR `e`.`NullableStringB` IS NULL) AND ((`e`.`NullableStringA` IS NOT NULL AND IIF(0 = -1, 0, 0) IS NOT NULL) OR `e`.`NullableStringB` IS NOT NULL) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs index 357f9067..864233d3 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs @@ -686,6 +686,13 @@ public override async Task Parameter_collection_of_nullable_ints_Contains_nullab """); } + public override async Task Parameter_collection_of_nullable_ints_Contains_nullable_int_with_EF_Parameter() + { + await Assert.ThrowsAsync(base.Parameter_collection_of_nullable_ints_Contains_nullable_int_with_EF_Parameter); + + AssertSql(); + } + public override async Task Parameter_collection_of_strings_Contains_string() { await base.Parameter_collection_of_strings_Contains_string(); diff --git a/test/EFCore.Jet.FunctionalTests/Query/SqlQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/SqlQueryJetTest.cs index cef2b524..11cbfd83 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/SqlQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/SqlQueryJetTest.cs @@ -470,7 +470,7 @@ public override async Task SqlQueryRaw_composed_with_predicate(bool async) FROM ( SELECT * FROM `Customers` ) AS `m` -WHERE MID(`m`.`ContactName`, 0 + 1, 1) = MID(`m`.`CompanyName`, 0 + 1, 1) +WHERE MID(`m`.`ContactName`, IIF(0 = -1, 0, 0) + 1, 1) = MID(`m`.`CompanyName`, IIF(0 = -1, 0, 0) + 1, 1) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs index 8dd28b6f..07254eea 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs @@ -8002,7 +8002,7 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`u`.`SquadId` IS NULL, NULL, MID(`t`.`Note`, 0 + 1, `u`.`SquadId`)) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `u`.`SquadId` IS NULL) AND `t`.`GearNickName` IS NULL) +WHERE IIF(`u`.`SquadId` IS NULL, NULL, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, `u`.`SquadId`)) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR IIF(0 = -1, 0, 0) IS NULL OR `u`.`SquadId` IS NULL) AND `t`.`GearNickName` IS NULL) """); } @@ -8024,7 +8024,7 @@ UNION ALL FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` -WHERE IIF(LEN(`s`.`Name`) IS NULL, NULL, MID(`t`.`Note`, 0 + 1, IIF(LEN(`s`.`Name`) IS NULL, NULL, CLNG(LEN(`s`.`Name`))))) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `s`.`Name` IS NULL) AND `t`.`GearNickName` IS NULL) +WHERE IIF(LEN(`s`.`Name`) IS NULL, NULL, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, IIF(LEN(`s`.`Name`) IS NULL, NULL, CLNG(LEN(`s`.`Name`))))) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR IIF(0 = -1, 0, 0) IS NULL OR `s`.`Name` IS NULL) AND `t`.`GearNickName` IS NULL) """); } @@ -10625,7 +10625,7 @@ public override async Task Projecting_property_converted_to_nullable_with_functi AssertSql( """ -SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL), 0 + 1, 3) +SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL), IIF(0 = -1, 0, 0) + 1, 3) FROM `Tags` AS `t` LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId` @@ -10643,7 +10643,7 @@ public override async Task Projecting_property_converted_to_nullable_with_functi AssertSql( """ -SELECT `t`.`Note`, MID(`t`.`Note`, 0 + 1, IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL)) AS `Function` +SELECT `t`.`Note`, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL)) AS `Function` FROM `Tags` AS `t` LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId` diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs index c77f01d3..6f6957e7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs @@ -6409,7 +6409,7 @@ LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`s`.`SquadId` IS NULL, NULL, MID(`t`.`Note`, 0 + 1, `s`.`SquadId`)) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `s`.`SquadId` IS NULL) AND `t`.`GearNickName` IS NULL) +WHERE IIF(`s`.`SquadId` IS NULL, NULL, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, `s`.`SquadId`)) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR IIF(0 = -1, 0, 0) IS NULL OR `s`.`SquadId` IS NULL) AND `t`.`GearNickName` IS NULL) """); } @@ -6428,7 +6428,7 @@ LEFT JOIN ( FROM `Gears` AS `g` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) LEFT JOIN `Squads` AS `s0` ON `s`.`SquadId` = `s0`.`Id` -WHERE IIF(LEN(`s0`.`Name`) IS NULL, NULL, MID(`t`.`Note`, 0 + 1, IIF(LEN(`s0`.`Name`) IS NULL, NULL, CLNG(LEN(`s0`.`Name`))))) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `s0`.`Name` IS NULL) AND `t`.`GearNickName` IS NULL) +WHERE IIF(LEN(`s0`.`Name`) IS NULL, NULL, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, IIF(LEN(`s0`.`Name`) IS NULL, NULL, CLNG(LEN(`s0`.`Name`))))) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR IIF(0 = -1, 0, 0) IS NULL OR `s0`.`Name` IS NULL) AND `t`.`GearNickName` IS NULL) """); } @@ -8492,7 +8492,7 @@ public override async Task Projecting_property_converted_to_nullable_with_functi AssertSql( """ -SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL), 0 + 1, 3) +SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL), IIF(0 = -1, 0, 0) + 1, 3) FROM `Tags` AS `t` LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId` @@ -8507,7 +8507,7 @@ public override async Task Projecting_property_converted_to_nullable_with_functi AssertSql( """ -SELECT `t`.`Note`, MID(`t`.`Note`, 0 + 1, IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL)) AS `Function` +SELECT `t`.`Note`, MID(`t`.`Note`, IIF(0 = -1, 0, 0) + 1, IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL)) AS `Function` FROM `Tags` AS `t` LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId` diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/BasicTypesQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/BasicTypesQueryJetFixture.cs index 9c6b85e5..7a368f24 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/BasicTypesQueryJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/BasicTypesQueryJetFixture.cs @@ -94,7 +94,7 @@ public override ISetSource GetExpectedData() result.BasicTypesEntities.ForEach(b => { b.DateTime = new DateTime(b.DateTime.Year, b.DateTime.Month, b.DateTime.Day, b.DateTime.Hour, b.DateTime.Minute, b.DateTime.Second); - b.DateTimeOffset = new DateTimeOffset(b.DateTimeOffset.Year, b.DateTimeOffset.Month, b.DateTimeOffset.Day, b.DateTimeOffset.Hour, b.DateTimeOffset.Minute, b.DateTimeOffset.Second, b.DateTimeOffset.Offset); + b.DateTimeOffset = new DateTimeOffset(b.DateTimeOffset.Year, b.DateTimeOffset.Month, b.DateTimeOffset.Day, b.DateTimeOffset.Hour, b.DateTimeOffset.Minute, b.DateTimeOffset.Second, b.DateTimeOffset.Offset).ToUniversalTime(); b.TimeOnly = new TimeOnly(b.TimeOnly.Hour, b.TimeOnly.Minute, b.TimeOnly.Second); b.TimeSpan = new TimeSpan(b.TimeSpan.Days, b.TimeSpan.Hours, b.TimeSpan.Minutes, b.TimeSpan.Seconds); if (b.DateOnly.Year < 100) @@ -119,7 +119,7 @@ public override ISetSource GetExpectedData() } if (b.DateTimeOffset.HasValue) { - b.DateTimeOffset = new DateTimeOffset(b.DateTimeOffset.Value.Year, b.DateTimeOffset.Value.Month, b.DateTimeOffset.Value.Day, b.DateTimeOffset.Value.Hour, b.DateTimeOffset.Value.Minute, b.DateTimeOffset.Value.Second, b.DateTimeOffset.Value.Offset); + b.DateTimeOffset = new DateTimeOffset(b.DateTimeOffset.Value.Year, b.DateTimeOffset.Value.Month, b.DateTimeOffset.Value.Day, b.DateTimeOffset.Value.Hour, b.DateTimeOffset.Value.Minute, b.DateTimeOffset.Value.Second, b.DateTimeOffset.Value.Offset).ToUniversalTime(); } if (b.TimeOnly.HasValue) { diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs index 823f837d..0ca51885 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs @@ -336,7 +336,7 @@ public override async Task Substring() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 3 AND MID(`b`.`String`, 1 + 1, 2) = 'ea' +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 3 AND MID(`b`.`String`, IIF(1 = -1, 0, 1) + 1, 2) = 'ea' """); } @@ -386,7 +386,7 @@ public override async Task Substring_with_two_args_with_zero_startIndex() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 3 AND MID(`b`.`String`, 0 + 1, 3) = 'Sea' +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 3 AND MID(`b`.`String`, IIF(0 = -1, 0, 0) + 1, 3) = 'Sea' """); } @@ -398,7 +398,7 @@ public override async Task Substring_with_two_args_with_zero_length() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 2 AND MID(`b`.`String`, 2 + 1, 0) = '' +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 2 AND MID(`b`.`String`, IIF(2 = -1, 0, 2) + 1, 0) = '' """); } @@ -409,10 +409,11 @@ public override async Task Substring_with_two_args_with_parameter() AssertSql( """ @start='2' +@start='2' SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 5 AND MID(`b`.`String`, @start + 1, 3) = 'att' +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 5 AND MID(`b`.`String`, IIF(@start = -1, 0, @start) + 1, 3) = 'att' """); } @@ -1028,7 +1029,7 @@ public override async Task Compare_nested() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE `b`.`String` <> MID(`b`.`String`, 0 + 1, 0) +WHERE `b`.`String` <> MID(`b`.`String`, IIF(0 = -1, 0, 0) + 1, 0) """, // """ @@ -1046,7 +1047,7 @@ public override async Task Compare_nested() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE `b`.`String` > MID(`b`.`String`, 0 + 1, 0) +WHERE `b`.`String` > MID(`b`.`String`, IIF(0 = -1, 0, 0) + 1, 0) """, // """ @@ -1244,7 +1245,7 @@ public override async Task CompareTo_nested() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE `b`.`String` <> MID(`b`.`String`, 0 + 1, 0) +WHERE `b`.`String` <> MID(`b`.`String`, IIF(0 = -1, 0, 0) + 1, 0) """, // """ @@ -1262,7 +1263,7 @@ public override async Task CompareTo_nested() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE `b`.`String` > MID(`b`.`String`, 0 + 1, 0) +WHERE `b`.`String` > MID(`b`.`String`, IIF(0 = -1, 0, 0) + 1, 0) """, // """ diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs index 3de84e3d..f063834f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs @@ -179,9 +179,9 @@ public override async Task ToDateTime_property_with_constant_TimeOnly() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE DATETIME2FROMPARTS(DATEPART(year, [b].[DateOnly]), DATEPART(month, [b].[DateOnly]), DATEPART(day, [b].[DateOnly]), 21, 5, 19, 9405000, 7) = '2020-01-01T21:05:19.9405000' +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (DateSerial(DATEPART('yyyy', `b`.`DateOnly`), DATEPART('m', `b`.`DateOnly`), DATEPART('d', `b`.`DateOnly`)) + TimeSerial(21, 5, 19)) = #2020-01-01 21:05:19# """); } @@ -191,9 +191,9 @@ public override async Task ToDateTime_property_with_property_TimeOnly() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE DATETIME2FROMPARTS(DATEPART(year, [b].[DateOnly]), DATEPART(month, [b].[DateOnly]), DATEPART(day, [b].[DateOnly]), DATEPART(hour, [b].[TimeOnly]), DATEPART(minute, [b].[TimeOnly]), DATEPART(second, [b].[TimeOnly]), DATEPART(nanosecond, [b].[TimeOnly]) / 100, 7) = '2020-01-01T15:30:10.0000000' +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (DateSerial(DATEPART('yyyy', `b`.`DateOnly`), DATEPART('m', `b`.`DateOnly`), DATEPART('d', `b`.`DateOnly`)) + TimeSerial(DATEPART('h', `b`.`TimeOnly`), DATEPART('n', `b`.`TimeOnly`), DATEPART('s', `b`.`TimeOnly`))) = #2020-01-01 15:30:10# """); } @@ -203,9 +203,9 @@ public override async Task ToDateTime_constant_DateTime_with_property_TimeOnly() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE DATETIME2FROMPARTS(1990, 11, 10, DATEPART(hour, [b].[TimeOnly]), DATEPART(minute, [b].[TimeOnly]), DATEPART(second, [b].[TimeOnly]), DATEPART(nanosecond, [b].[TimeOnly]) / 100, 7) = '1990-11-10T15:30:10.0000000' +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (DateSerial(1990, 11, 10) + TimeSerial(DATEPART('h', `b`.`TimeOnly`), DATEPART('n', `b`.`TimeOnly`), DATEPART('s', `b`.`TimeOnly`))) = #1990-11-10 15:30:10# """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsJetTest.cs index fd9618d9..a7e24513 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsJetTest.cs @@ -110,9 +110,9 @@ public override async Task Hour() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE DATEPART(hour, [b].[DateTimeOffset]) = 15 +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('h', `b`.`DateTimeOffset`) = 15 """); } @@ -122,9 +122,9 @@ public override async Task Minute() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE DATEPART(minute, [b].[DateTimeOffset]) = 30 +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('n', `b`.`DateTimeOffset`) = 30 """); } @@ -182,8 +182,8 @@ public override async Task TimeOfDay() AssertSql( """ -SELECT CONVERT(time, [b].[DateTimeOffset]) -FROM [BasicTypesEntities] AS [b] +SELECT TIMEVALUE(`b`.`DateTimeOffset`) +FROM `BasicTypesEntities` AS `b` """); } @@ -253,14 +253,15 @@ SELECT DATEADD('s', 1.0, `b`.`DateTimeOffset`) """); } + //Note: AddMilliseconds is unsupported but the shape of this has the column top-level and ef core falls back to client-side public override async Task AddMilliseconds() { await base.AddMilliseconds(); AssertSql( """ -SELECT DATEADD(millisecond, CAST(300.0E0 AS int), [b].[DateTimeOffset]) -FROM [BasicTypesEntities] AS [b] +SELECT `b`.`DateTimeOffset` +FROM `BasicTypesEntities` AS `b` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextAssemblyAttributes.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextAssemblyAttributes.cs new file mode 100644 index 00000000..188db793 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Scaffolding; +using TestNamespace; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(CompiledModelRelationalTestBase.FunctionParameterTypeMappingContext), typeof(FunctionParameterTypeMappingContextModel))] diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextModel.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextModel.cs new file mode 100644 index 00000000..3cd9c09d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextModel.cs @@ -0,0 +1,48 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [DbContext(typeof(CompiledModelRelationalTestBase.FunctionParameterTypeMappingContext))] + public partial class FunctionParameterTypeMappingContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static FunctionParameterTypeMappingContextModel() + { + var model = new FunctionParameterTypeMappingContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (FunctionParameterTypeMappingContextModel)model.FinalizeModel(); + } + + private static FunctionParameterTypeMappingContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextModelBuilder.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextModelBuilder.cs new file mode 100644 index 00000000..a975dad2 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_parameter_type_mapping/FunctionParameterTypeMappingContextModelBuilder.cs @@ -0,0 +1,103 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using EntityFrameworkCore.Jet.Metadata; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public partial class FunctionParameterTypeMappingContextModel + { + private FunctionParameterTypeMappingContextModel() + : base(skipDetectChanges: true, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 0) + { + } + + partial void Initialize() + { + var functions = new Dictionary(); + var getSqlFragmentStatic = new RuntimeDbFunction( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+FunctionParameterTypeMappingContext.GetSqlFragmentStatic(string)", + this, + typeof(string), + "GetSqlFragmentStatic", + storeType: "varchar(255)", + methodInfo: typeof(CompiledModelRelationalTestBase.FunctionParameterTypeMappingContext).GetMethod( + "GetSqlFragmentStatic", + BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly, + null, + new Type[] { typeof(string) }, + null), + scalar: true, + nullable: true); + + var param = getSqlFragmentStatic.AddParameter( + "param", + typeof(string), + false, + "varchar"); + param.TypeMapping = StringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar", + dbType: System.Data.DbType.AnsiString)); + + getSqlFragmentStatic.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255)); + functions["Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+FunctionParameterTypeMappingContext.GetSqlFragmentStatic(string)"] = getSqlFragmentStatic; + + AddAnnotation("Relational:DbFunctions", functions); + AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + AddAnnotation("Relational:MaxIdentifierLength", 64); + AddRuntimeAnnotation("Relational:RelationalModelFactory", () => CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + var getSqlFragmentStatic = (IRuntimeDbFunction)this.FindDbFunction("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+FunctionParameterTypeMappingContext.GetSqlFragmentStatic(string)")!; + var getSqlFragmentStaticFunction = new StoreFunction(getSqlFragmentStatic, relationalModel); + var paramFunctionParameter = getSqlFragmentStaticFunction.FindParameter("param")!; + relationalModel.Functions.Add( + ("GetSqlFragmentStatic", null, new[] { "varchar" }), + getSqlFragmentStaticFunction); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextAssemblyAttributes.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextAssemblyAttributes.cs new file mode 100644 index 00000000..7ab16249 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Scaffolding; +using TestNamespace; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(CompiledModelRelationalTestBase.FunctionTypeMappingContext), typeof(FunctionTypeMappingContextModel))] diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextModel.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextModel.cs new file mode 100644 index 00000000..ead6c2fb --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextModel.cs @@ -0,0 +1,48 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [DbContext(typeof(CompiledModelRelationalTestBase.FunctionTypeMappingContext))] + public partial class FunctionTypeMappingContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static FunctionTypeMappingContextModel() + { + var model = new FunctionTypeMappingContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (FunctionTypeMappingContextModel)model.FinalizeModel(); + } + + private static FunctionTypeMappingContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextModelBuilder.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextModelBuilder.cs new file mode 100644 index 00000000..0826f5d3 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Custom_function_type_mapping/FunctionTypeMappingContextModelBuilder.cs @@ -0,0 +1,103 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using EntityFrameworkCore.Jet.Metadata; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public partial class FunctionTypeMappingContextModel + { + private FunctionTypeMappingContextModel() + : base(skipDetectChanges: true, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 0) + { + } + + partial void Initialize() + { + var functions = new Dictionary(); + var getSqlFragmentStatic = new RuntimeDbFunction( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+FunctionTypeMappingContext.GetSqlFragmentStatic(string)", + this, + typeof(string), + "GetSqlFragmentStatic", + storeType: "varchar", + methodInfo: typeof(CompiledModelRelationalTestBase.FunctionTypeMappingContext).GetMethod( + "GetSqlFragmentStatic", + BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly, + null, + new Type[] { typeof(string) }, + null), + scalar: true, + nullable: true); + + var param = getSqlFragmentStatic.AddParameter( + "param", + typeof(string), + false, + "varchar(255)"); + param.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255)); + + getSqlFragmentStatic.TypeMapping = StringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar", + dbType: System.Data.DbType.AnsiString)); + functions["Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+FunctionTypeMappingContext.GetSqlFragmentStatic(string)"] = getSqlFragmentStatic; + + AddAnnotation("Relational:DbFunctions", functions); + AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + AddAnnotation("Relational:MaxIdentifierLength", 64); + AddRuntimeAnnotation("Relational:RelationalModelFactory", () => CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + var getSqlFragmentStatic = (IRuntimeDbFunction)this.FindDbFunction("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+FunctionTypeMappingContext.GetSqlFragmentStatic(string)")!; + var getSqlFragmentStaticFunction = new StoreFunction(getSqlFragmentStatic, relationalModel); + var paramFunctionParameter = getSqlFragmentStaticFunction.FindParameter("param")!; + relationalModel.Functions.Add( + ("GetSqlFragmentStatic", null, new[] { "varchar(255)" }), + getSqlFragmentStaticFunction); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs new file mode 100644 index 00000000..ff65213b --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs @@ -0,0 +1,124 @@ +// +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class DataEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data", + typeof(CompiledModelTestBase.Data), + baseEntityType, + propertyCount: 1); + + var blob = runtimeEntityType.AddProperty( + "Blob", + typeof(byte[]), + propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + blob.SetGetter( + byte[] (CompiledModelTestBase.Data instance) => DataUnsafeAccessors.Blob(instance), + bool (CompiledModelTestBase.Data instance) => DataUnsafeAccessors.Blob(instance) == null); + blob.SetSetter( + CompiledModelTestBase.Data (CompiledModelTestBase.Data instance, byte[] value) => + { + DataUnsafeAccessors.Blob(instance) = value; + return instance; + }); + blob.SetMaterializationSetter( + CompiledModelTestBase.Data (CompiledModelTestBase.Data instance, byte[] value) => + { + DataUnsafeAccessors.Blob(instance) = value; + return instance; + }); + blob.SetAccessors( + byte[] (IInternalEntry entry) => DataUnsafeAccessors.Blob(((CompiledModelTestBase.Data)(entry.Entity))), + byte[] (IInternalEntry entry) => DataUnsafeAccessors.Blob(((CompiledModelTestBase.Data)(entry.Entity))), + byte[] (IInternalEntry entry) => entry.ReadOriginalValue(blob, 0), + byte[] (IInternalEntry entry) => entry.GetCurrentValue(blob)); + blob.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + blob.TypeMapping = JetByteArrayTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(((object)v1), ((object)v2)), + int (byte[] v) => ((object)v).GetHashCode(), + byte[] (byte[] v) => v), + keyComparer: new ValueComparer( + bool (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(((object)v1), ((object)v2)), + int (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(((object)v)), + byte[] (byte[] source) => source.ToArray()), + providerValueComparer: new ValueComparer( + bool (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(((object)v1), ((object)v2)), + int (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(((object)v)), + byte[] (byte[] source) => source.ToArray()), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "longbinary"), + storeTypePostfix: StoreTypePostfix.None); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + var blob = runtimeEntityType.FindProperty("Blob"); + runtimeEntityType.SetOriginalValuesFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.Data)(source.Entity)); + return ((ISnapshot)(new Snapshot((source.GetCurrentValue(blob) == null ? null : ((ValueComparer)(((IProperty)blob).GetValueComparer())).Snapshot(source.GetCurrentValue(blob)))))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + ISnapshot () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + ISnapshot (IInternalEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + ISnapshot (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + ISnapshot () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + ISnapshot (IInternalEntry source) => Snapshot.Empty); + runtimeEntityType.SetCounts(new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + complexCollectionCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 0, + storeGeneratedCount: 0)); + runtimeEntityType.AddAnnotation("Relational:FunctionName", "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData()"); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", null); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataUnsafeAccessors.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataUnsafeAccessors.cs new file mode 100644 index 00000000..193c8970 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataUnsafeAccessors.cs @@ -0,0 +1,16 @@ +// +using System; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public static class DataUnsafeAccessors + { + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref byte[] Blob(CompiledModelTestBase.Data @this); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextAssemblyAttributes.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextAssemblyAttributes.cs new file mode 100644 index 00000000..a248efef --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Scaffolding; +using TestNamespace; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(CompiledModelRelationalTestBase.DbFunctionContext), typeof(DbFunctionContextModel))] diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextModel.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextModel.cs new file mode 100644 index 00000000..8d6f346c --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextModel.cs @@ -0,0 +1,48 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [DbContext(typeof(CompiledModelRelationalTestBase.DbFunctionContext))] + public partial class DbFunctionContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static DbFunctionContextModel() + { + var model = new DbFunctionContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (DbFunctionContextModel)model.FinalizeModel(); + } + + private static DbFunctionContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextModelBuilder.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextModelBuilder.cs new file mode 100644 index 00000000..3c61e23b --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/DbFunctionContextModelBuilder.cs @@ -0,0 +1,321 @@ +// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using EntityFrameworkCore.Jet.Metadata; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public partial class DbFunctionContextModel + { + private DbFunctionContextModel() + : base(skipDetectChanges: false, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 2, typeConfigurationCount: 1) + { + } + + partial void Initialize() + { + var data = DataEntityType.Create(this); + var @object = ObjectEntityType.Create(this); + + DataEntityType.CreateAnnotations(data); + ObjectEntityType.CreateAnnotations(@object); + + var type = this.AddTypeMappingConfiguration( + typeof(string), + maxLength: 256); + type.AddAnnotation("Relational:IsFixedLength", true); + + var functions = new Dictionary(); + var getBlobs = new RuntimeDbFunction( + "GetBlobs()", + this, + typeof(IQueryable), + "GetBlobs"); + + functions["GetBlobs()"] = getBlobs; + + var getCount = new RuntimeDbFunction( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetCount(System.Guid?,string)", + this, + typeof(int), + "CustomerOrderCount", + schema: "dbf", + storeType: "integer", + methodInfo: typeof(CompiledModelRelationalTestBase.DbFunctionContext).GetMethod( + "GetCount", + BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly, + null, + new Type[] { typeof(Guid?), typeof(string) }, + null), + scalar: true); + + var id = getCount.AddParameter( + "id", + typeof(Guid?), + true, + "uniqueidentifier"); + id.TypeMapping = JetGuidTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (Guid v1, Guid v2) => v1 == v2, + int (Guid v) => ((object)v).GetHashCode(), + Guid (Guid v) => v), + keyComparer: new ValueComparer( + bool (Guid v1, Guid v2) => v1 == v2, + int (Guid v) => ((object)v).GetHashCode(), + Guid (Guid v) => v), + providerValueComparer: new ValueComparer( + bool (Guid v1, Guid v2) => v1 == v2, + int (Guid v) => ((object)v).GetHashCode(), + Guid (Guid v) => v)); + id.AddAnnotation("MyAnnotation", new[] { 1L }); + + var condition = getCount.AddParameter( + "condition", + typeof(string), + false, + "char(256)"); + condition.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "char(256)", + size: 256, + fixedLength: true)); + + getCount.TypeMapping = JetIntTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + keyComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + providerValueComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v)); + functions["Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetCount(System.Guid?,string)"] = getCount; + + var getData = new RuntimeDbFunction( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData()", + this, + typeof(IQueryable), + "GetAllData", + methodInfo: typeof(CompiledModelRelationalTestBase.DbFunctionContext).GetMethod( + "GetData", + BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, + null, + new Type[] { }, + null)); + + functions["Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData()"] = getData; + + var getData0 = new RuntimeDbFunction( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData(int)", + this, + typeof(IQueryable), + "GetData", + methodInfo: typeof(CompiledModelRelationalTestBase.DbFunctionContext).GetMethod( + "GetData", + BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, + null, + new Type[] { typeof(int) }, + null)); + + var id0 = getData0.AddParameter( + "id", + typeof(int), + false, + "integer"); + id0.TypeMapping = JetIntTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + keyComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + providerValueComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v)); + + functions["Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData(int)"] = getData0; + + var isDateStatic = new RuntimeDbFunction( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.IsDateStatic(string)", + this, + typeof(bool), + "IsDate", + storeType: "smallint", + methodInfo: typeof(CompiledModelRelationalTestBase.DbFunctionContext).GetMethod( + "IsDateStatic", + BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly, + null, + new Type[] { typeof(string) }, + null), + scalar: true, + nullable: true, + builtIn: true); + + var date = isDateStatic.AddParameter( + "date", + typeof(string), + false, + "char(256)"); + date.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "char(256)", + size: 256, + fixedLength: true)); + + isDateStatic.TypeMapping = JetBoolTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (bool v1, bool v2) => v1 == v2, + int (bool v) => ((object)v).GetHashCode(), + bool (bool v) => v), + keyComparer: new ValueComparer( + bool (bool v1, bool v2) => v1 == v2, + int (bool v) => ((object)v).GetHashCode(), + bool (bool v) => v), + providerValueComparer: new ValueComparer( + bool (bool v1, bool v2) => v1 == v2, + int (bool v) => ((object)v).GetHashCode(), + bool (bool v) => v)); + isDateStatic.AddAnnotation("MyGuid", new Guid("00000000-0000-0000-0000-000000000000")); + functions["Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.IsDateStatic(string)"] = isDateStatic; + + AddAnnotation("Relational:DbFunctions", functions); + AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + AddAnnotation("Relational:MaxIdentifierLength", 64); + AddRuntimeAnnotation("Relational:RelationalModelFactory", () => CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var data = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data")!; + + var defaultTableMappings = new List>(); + data.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data", null, relationalModel); + var blobColumnBase = new ColumnBase("Blob", "longbinary", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase.Columns.Add("Blob", blobColumnBase); + relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase = new TableMappingBase(data, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase, null); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase, false); + defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)blobColumnBase, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase); + + var functionMappings = new List(); + data.SetRuntimeAnnotation("Relational:FunctionMappings", functionMappings); + var getAllData = (IRuntimeDbFunction)this.FindDbFunction("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData()")!; + var getAllDataFunction = new StoreFunction(getAllData, relationalModel); + var blobFunctionColumn = new FunctionColumn("Blob", "longbinary", getAllDataFunction) + { + IsNullable = true + }; + getAllDataFunction.Columns.Add("Blob", blobFunctionColumn); + relationalModel.Functions.Add( + ("GetAllData", null, new string[0]), + getAllDataFunction); + var getAllDataFunctionMapping = new FunctionMapping(data, getAllDataFunction, getAllData, null); + getAllDataFunction.AddTypeMapping(getAllDataFunctionMapping, false); + functionMappings.Add(getAllDataFunctionMapping); + getAllDataFunctionMapping.IsDefaultFunctionMapping = true; + RelationalModel.CreateFunctionColumnMapping(blobFunctionColumn, data.FindProperty("Blob")!, getAllDataFunctionMapping); + var getData = (IRuntimeDbFunction)this.FindDbFunction("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData(int)")!; + var getDataFunction = new StoreFunction(getData, relationalModel); + var idFunctionParameter = getDataFunction.FindParameter("id")!; + var blobFunctionColumn0 = new FunctionColumn("Blob", "longbinary", getDataFunction) + { + IsNullable = true + }; + getDataFunction.Columns.Add("Blob", blobFunctionColumn0); + relationalModel.Functions.Add( + ("GetData", null, new[] { "integer" }), + getDataFunction); + var getDataFunctionMapping = new FunctionMapping(data, getDataFunction, getData, null); + getDataFunction.AddTypeMapping(getDataFunctionMapping, false); + functionMappings.Add(getDataFunctionMapping); + RelationalModel.CreateFunctionColumnMapping(blobFunctionColumn0, data.FindProperty("Blob")!, getDataFunctionMapping); + + var @object = FindEntityType("object")!; + + var defaultTableMappings0 = new List>(); + @object.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var objectTableBase = new TableBase("object", null, relationalModel); + relationalModel.DefaultTables.Add("object", objectTableBase); + var objectMappingBase = new TableMappingBase(@object, objectTableBase, null); + objectTableBase.AddTypeMapping(objectMappingBase, false); + defaultTableMappings0.Add(objectMappingBase); + + var functionMappings0 = new List(); + @object.SetRuntimeAnnotation("Relational:FunctionMappings", functionMappings0); + var getBlobs = (IRuntimeDbFunction)this.FindDbFunction("GetBlobs()")!; + var getBlobsFunction = new StoreFunction(getBlobs, relationalModel); + relationalModel.Functions.Add( + ("GetBlobs", null, new string[0]), + getBlobsFunction); + var getBlobsFunctionMapping = new FunctionMapping(@object, getBlobsFunction, getBlobs, null); + getBlobsFunction.AddTypeMapping(getBlobsFunctionMapping, false); + functionMappings0.Add(getBlobsFunctionMapping); + getBlobsFunctionMapping.IsDefaultFunctionMapping = true; + var customerOrderCount = (IRuntimeDbFunction)this.FindDbFunction("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetCount(System.Guid?,string)")!; + var customerOrderCountFunction = new StoreFunction(customerOrderCount, relationalModel); + var idFunctionParameter0 = customerOrderCountFunction.FindParameter("id")!; + var conditionFunctionParameter = customerOrderCountFunction.FindParameter("condition")!; + relationalModel.Functions.Add( + ("CustomerOrderCount", "dbf", new[] { "uniqueidentifier", "char(256)" }), + customerOrderCountFunction); + var isDate = (IRuntimeDbFunction)this.FindDbFunction("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.IsDateStatic(string)")!; + var isDateFunction = new StoreFunction(isDate, relationalModel); + var dateFunctionParameter = isDateFunction.FindParameter("date")!; + relationalModel.Functions.Add( + ("IsDate", null, new[] { "char(256)" }), + isDateFunction); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs new file mode 100644 index 00000000..9b854116 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs @@ -0,0 +1,64 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class ObjectEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "object", + typeof(object), + baseEntityType, + propertyCount: 0); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.SetOriginalValuesFactory( + ISnapshot (IInternalEntry source) => Snapshot.Empty); + runtimeEntityType.SetStoreGeneratedValuesFactory( + ISnapshot () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + ISnapshot (IInternalEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + ISnapshot (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + ISnapshot () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + ISnapshot (IInternalEntry source) => Snapshot.Empty); + runtimeEntityType.SetCounts(new PropertyCounts( + propertyCount: 0, + navigationCount: 0, + complexPropertyCount: 0, + complexCollectionCount: 0, + originalValueCount: 0, + shadowCount: 0, + relationshipCount: 0, + storeGeneratedCount: 0)); + runtimeEntityType.AddAnnotation("Relational:FunctionName", "GetBlobs()"); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", null); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs new file mode 100644 index 00000000..d1482abb --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs @@ -0,0 +1,171 @@ +// +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using EntityFrameworkCore.Jet.Metadata; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class DataEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data", + typeof(CompiledModelTestBase.Data), + baseEntityType, + propertyCount: 2, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.SetAccessors( + int (IInternalEntry entry) => (entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : (entry.FlaggedAsTemporary(0) && entry.ReadShadowValue(0) == 0 ? entry.ReadTemporaryValue(0) : entry.ReadShadowValue(0))), + int (IInternalEntry entry) => entry.ReadShadowValue(0), + int (IInternalEntry entry) => entry.ReadOriginalValue(id, 0), + int (IInternalEntry entry) => ((InternalEntityEntry)entry).ReadRelationshipSnapshotValue(id, 0)); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); + id.TypeMapping = JetIntTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + keyComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + providerValueComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); + id.AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + + var blob = runtimeEntityType.AddProperty( + "Blob", + typeof(byte[]), + propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + blob.SetGetter( + byte[] (CompiledModelTestBase.Data instance) => DataUnsafeAccessors.Blob(instance), + bool (CompiledModelTestBase.Data instance) => DataUnsafeAccessors.Blob(instance) == null); + blob.SetSetter( + CompiledModelTestBase.Data (CompiledModelTestBase.Data instance, byte[] value) => + { + DataUnsafeAccessors.Blob(instance) = value; + return instance; + }); + blob.SetMaterializationSetter( + CompiledModelTestBase.Data (CompiledModelTestBase.Data instance, byte[] value) => + { + DataUnsafeAccessors.Blob(instance) = value; + return instance; + }); + blob.SetAccessors( + byte[] (IInternalEntry entry) => DataUnsafeAccessors.Blob(((CompiledModelTestBase.Data)(entry.Entity))), + byte[] (IInternalEntry entry) => DataUnsafeAccessors.Blob(((CompiledModelTestBase.Data)(entry.Entity))), + byte[] (IInternalEntry entry) => entry.ReadOriginalValue(blob, 1), + byte[] (IInternalEntry entry) => entry.GetCurrentValue(blob)); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + blob.TypeMapping = JetByteArrayTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(((object)v1), ((object)v2)), + int (byte[] v) => ((object)v).GetHashCode(), + byte[] (byte[] v) => v), + keyComparer: new ValueComparer( + bool (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(((object)v1), ((object)v2)), + int (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(((object)v)), + byte[] (byte[] source) => source.ToArray()), + providerValueComparer: new ValueComparer( + bool (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(((object)v1), ((object)v2)), + int (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(((object)v)), + byte[] (byte[] source) => source.ToArray()), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "longbinary"), + storeTypePostfix: StoreTypePostfix.None); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + var id = runtimeEntityType.FindProperty("Id"); + var blob = runtimeEntityType.FindProperty("Blob"); + var key = runtimeEntityType.FindKey(new[] { id }); + key.SetPrincipalKeyValueFactory(KeyValueFactoryFactory.CreateSimpleNonNullableFactory(key)); + key.SetIdentityMapFactory(IdentityMapFactoryFactory.CreateFactory(key)); + runtimeEntityType.SetOriginalValuesFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.Data)(source.Entity)); + return ((ISnapshot)(new Snapshot(((ValueComparer)(((IProperty)id).GetValueComparer())).Snapshot(source.GetCurrentValue(id)), (source.GetCurrentValue(blob) == null ? null : ((ValueComparer)(((IProperty)blob).GetValueComparer())).Snapshot(source.GetCurrentValue(blob)))))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + ISnapshot () => ((ISnapshot)(new Snapshot(((ValueComparer)(((IProperty)id).GetValueComparer())).Snapshot(default(int)))))); + runtimeEntityType.SetTemporaryValuesFactory( + ISnapshot (IInternalEntry source) => ((ISnapshot)(new Snapshot(default(int))))); + runtimeEntityType.SetShadowValuesFactory( + ISnapshot (IDictionary source) => ((ISnapshot)(new Snapshot((source.ContainsKey("Id") ? ((int)(source["Id"])) : 0))))); + runtimeEntityType.SetEmptyShadowValuesFactory( + ISnapshot () => ((ISnapshot)(new Snapshot(default(int))))); + runtimeEntityType.SetRelationshipSnapshotFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.Data)(source.Entity)); + return ((ISnapshot)(new Snapshot(((ValueComparer)(((IProperty)id).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(id))))); + }); + runtimeEntityType.SetCounts(new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + complexCollectionCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1)); + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Data"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataUnsafeAccessors.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataUnsafeAccessors.cs new file mode 100644 index 00000000..193c8970 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataUnsafeAccessors.cs @@ -0,0 +1,16 @@ +// +using System; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public static class DataUnsafeAccessors + { + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref byte[] Blob(CompiledModelTestBase.Data @this); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextAssemblyAttributes.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextAssemblyAttributes.cs new file mode 100644 index 00000000..c224873f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using TestNamespace; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(DbContext), typeof(DbContextModel))] diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextModel.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextModel.cs new file mode 100644 index 00000000..583ee4d9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextModel.cs @@ -0,0 +1,48 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [DbContext(typeof(DbContext))] + public partial class DbContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static DbContextModel() + { + var model = new DbContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (DbContextModel)model.FinalizeModel(); + } + + private static DbContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextModelBuilder.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextModelBuilder.cs new file mode 100644 index 00000000..4642044e --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DbContextModelBuilder.cs @@ -0,0 +1,88 @@ +// +using System; +using System.Collections.Generic; +using EntityFrameworkCore.Jet.Metadata; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Update.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public partial class DbContextModel + { + private DbContextModel() + : base(skipDetectChanges: false, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 1) + { + } + + partial void Initialize() + { + var data = DataEntityType.Create(this); + + DataEntityType.CreateAnnotations(data); + + AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + AddAnnotation("Relational:MaxIdentifierLength", 64); + AddRuntimeAnnotation("Relational:RelationalModelFactory", () => CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var data = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data")!; + + var defaultTableMappings = new List>(); + data.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data", null, relationalModel); + var blobColumnBase = new ColumnBase("Blob", "longbinary", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase.Columns.Add("Blob", blobColumnBase); + var idColumnBase = new ColumnBase("Id", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase.Columns.Add("Id", idColumnBase); + relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase = new TableMappingBase(data, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase, null); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase, false); + defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, data.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)blobColumnBase, data.FindProperty("Blob")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDataMappingBase); + + var tableMappings = new List(); + data.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var dataTable = new Table("Data", null, relationalModel); + var idColumn = new Column("Id", "integer", dataTable); + dataTable.Columns.Add("Id", idColumn); + idColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(idColumn); + idColumn.AddAnnotation("Jet:Identity", "1, 1"); + var blobColumn = new Column("Blob", "longbinary", dataTable) + { + IsNullable = true + }; + dataTable.Columns.Add("Blob", blobColumn); + blobColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(blobColumn); + relationalModel.Tables.Add(("Data", null), dataTable); + var dataTableMapping = new TableMapping(data, dataTable, null); + dataTable.AddTypeMapping(dataTableMapping, false); + tableMappings.Add(dataTableMapping); + RelationalModel.CreateColumnMapping(idColumn, data.FindProperty("Id")!, dataTableMapping); + RelationalModel.CreateColumnMapping(blobColumn, data.FindProperty("Blob")!, dataTableMapping); + var pK_Data = new UniqueConstraint("PK_Data", dataTable, new[] { idColumn }); + dataTable.PrimaryKey = pK_Data; + pK_Data.SetRowKeyValueFactory(new SimpleRowKeyValueFactory(pK_Data)); + var pK_DataKey = RelationalModel.GetKey(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+Data", + new[] { "Id" }); + pK_Data.MappedKeys.Add(pK_DataKey); + RelationalModel.GetOrCreateUniqueConstraints(pK_DataKey).Add(pK_Data); + dataTable.UniqueConstraints.Add("PK_Data", pK_Data); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextAssemblyAttributes.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextAssemblyAttributes.cs new file mode 100644 index 00000000..c224873f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using TestNamespace; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(DbContext), typeof(DbContextModel))] diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextModel.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextModel.cs new file mode 100644 index 00000000..583ee4d9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextModel.cs @@ -0,0 +1,48 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [DbContext(typeof(DbContext))] + public partial class DbContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static DbContextModel() + { + var model = new DbContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (DbContextModel)model.FinalizeModel(); + } + + private static DbContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextModelBuilder.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextModelBuilder.cs new file mode 100644 index 00000000..faca8146 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DbContextModelBuilder.cs @@ -0,0 +1,57 @@ +// +using System; +using EntityFrameworkCore.Jet.Metadata; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public partial class DbContextModel + { + private DbContextModel() + : base(skipDetectChanges: false, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 8) + { + } + + partial void Initialize() + { + var dependentBase = DependentBaseEntityType.Create(this); + var manyTypes = ManyTypesEntityType.Create(this); + var principalBase = PrincipalBaseEntityType.Create(this); + var ownedType = OwnedTypeEntityType.Create(this); + var ownedType0 = OwnedType0EntityType.Create(this); + var principalBasePrincipalDerivedDependentBasebyte = PrincipalBasePrincipalDerivedDependentBasebyteEntityType.Create(this); + var dependentDerived = DependentDerivedEntityType.Create(this, dependentBase); + var principalDerived = PrincipalDerivedEntityType.Create(this, principalBase); + + DependentBaseEntityType.CreateForeignKey1(dependentBase, principalBase); + DependentBaseEntityType.CreateForeignKey2(dependentBase, principalDerived); + OwnedTypeEntityType.CreateForeignKey1(ownedType, principalBase); + OwnedTypeEntityType.CreateForeignKey2(ownedType, ownedType); + OwnedType0EntityType.CreateForeignKey1(ownedType0, principalDerived); + PrincipalBasePrincipalDerivedDependentBasebyteEntityType.CreateForeignKey1(principalBasePrincipalDerivedDependentBasebyte, principalDerived); + PrincipalBasePrincipalDerivedDependentBasebyteEntityType.CreateForeignKey2(principalBasePrincipalDerivedDependentBasebyte, principalBase); + PrincipalDerivedEntityType.CreateForeignKey1(principalDerived, principalBase); + + PrincipalBaseEntityType.CreateSkipNavigation1(principalBase, principalDerived, principalBasePrincipalDerivedDependentBasebyte); + PrincipalDerivedEntityType.CreateSkipNavigation1(principalDerived, principalBase, principalBasePrincipalDerivedDependentBasebyte); + + DependentBaseEntityType.CreateAnnotations(dependentBase); + ManyTypesEntityType.CreateAnnotations(manyTypes); + PrincipalBaseEntityType.CreateAnnotations(principalBase); + OwnedTypeEntityType.CreateAnnotations(ownedType); + OwnedType0EntityType.CreateAnnotations(ownedType0); + PrincipalBasePrincipalDerivedDependentBasebyteEntityType.CreateAnnotations(principalBasePrincipalDerivedDependentBasebyte); + DependentDerivedEntityType.CreateAnnotations(dependentDerived); + PrincipalDerivedEntityType.CreateAnnotations(principalDerived); + + AddAnnotation("Jet:IdentityIncrement", 2); + AddAnnotation("Jet:IdentitySeed", 3); + AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + AddAnnotation("Relational:MaxIdentifierLength", 64); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DependentBaseEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DependentBaseEntityType.cs new file mode 100644 index 00000000..c6a49c61 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DependentBaseEntityType.cs @@ -0,0 +1,127 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.ValueGeneration; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class DependentBaseEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase", + typeof(CompiledModelTestBase.DependentBase), + baseEntityType, + discriminatorProperty: "EnumDiscriminator", + discriminatorValue: CompiledModelTestBase.Enum1.One, + derivedTypesCount: 1, + propertyCount: 4, + navigationCount: 1, + foreignKeyCount: 2, + unnamedIndexCount: 1, + keyCount: 1); + + var principalId = runtimeEntityType.AddProperty( + "PrincipalId", + typeof(long), + afterSaveBehavior: PropertySaveBehavior.Throw, + providerPropertyType: typeof(int)); + principalId.SetSentinelFromProviderValue(0); + + var principalAlternateId = runtimeEntityType.AddProperty( + "PrincipalAlternateId", + typeof(Guid), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var enumDiscriminator = runtimeEntityType.AddProperty( + "EnumDiscriminator", + typeof(CompiledModelTestBase.Enum1), + afterSaveBehavior: PropertySaveBehavior.Throw, + valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + enumDiscriminator.SetSentinelFromProviderValue(0); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(byte?), + propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Id", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var key = runtimeEntityType.AddKey( + new[] { principalId, principalAlternateId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { principalId }, + unique: true); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalId"), declaringEntityType.FindProperty("PrincipalAlternateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id"), principalEntityType.FindProperty("AlternateId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.ClientNoAction, + unique: true, + required: true); + + var principal = declaringEntityType.AddNavigation("Principal", + runtimeForeignKey, + onDependent: true, + typeof(CompiledModelTestBase.PrincipalDerived>), + propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Principal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var dependent = principalEntityType.AddNavigation("Dependent", + runtimeForeignKey, + onDependent: false, + typeof(CompiledModelTestBase.DependentBase), + propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Dependent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + eagerLoaded: true, + lazyLoadingEnabled: false); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("DiscriminatorMappingComplete", false); + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPH"); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "DependentBase"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DependentDerivedEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DependentDerivedEntityType.cs new file mode 100644 index 00000000..ee41508b --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/DependentDerivedEntityType.cs @@ -0,0 +1,60 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class DependentDerivedEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentDerived", + typeof(CompiledModelTestBase.DependentDerived), + baseEntityType, + discriminatorProperty: "EnumDiscriminator", + discriminatorValue: CompiledModelTestBase.Enum1.Two, + propertyCount: 2); + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.DependentDerived).GetProperty("Data", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.DependentDerived).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 20, + unicode: false); + data.AddAnnotation("Relational:IsFixedLength", true); + + var money = runtimeEntityType.AddProperty( + "Money", + typeof(decimal), + precision: 9, + scale: 3, + sentinel: 0m); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "DependentBase"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/ManyTypesEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/ManyTypesEntityType.cs new file mode 100644 index 00000000..0616d04f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/ManyTypesEntityType.cs @@ -0,0 +1,1876 @@ +// +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.NetworkInformation; +using System.Reflection; +using System.Text; +using EntityFrameworkCore.Jet.Metadata; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.EntityFrameworkCore.Storage.Json; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class ManyTypesEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+ManyTypes", + typeof(CompiledModelTestBase.ManyTypes), + baseEntityType, + propertyCount: 241, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(CompiledModelTestBase.ManyTypesId), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + valueConverter: new CompiledModelTestBase.ManyTypesIdConverter()); + id.SetSentinelFromProviderValue(0); + id.AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + + var @bool = runtimeEntityType.AddProperty( + "Bool", + typeof(bool), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var boolArray = runtimeEntityType.AddProperty( + "BoolArray", + typeof(bool[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var boolArrayElementType = boolArray.SetElementType(typeof(bool)); + + var boolReadOnlyCollection = runtimeEntityType.AddProperty( + "BoolReadOnlyCollection", + typeof(IReadOnlyCollection), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolReadOnlyCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("_boolReadOnlyCollection", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var boolReadOnlyCollectionElementType = boolReadOnlyCollection.SetElementType(typeof(bool)); + + var boolToStringConverterProperty = runtimeEntityType.AddProperty( + "BoolToStringConverterProperty", + typeof(bool), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToStringConverterProperty.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (bool v1, bool v2) => v1 == v2, + int (bool v) => ((object)v).GetHashCode(), + bool (bool v) => v), + keyComparer: new ValueComparer( + bool (bool v1, bool v2) => v1 == v2, + int (bool v) => ((object)v).GetHashCode(), + bool (bool v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(1)", + size: 1), + converter: new ValueConverter( + string (bool v) => ((string)((v ? "B" : "A"))), + bool (string v) => !(string.IsNullOrEmpty(v)) && ((int)(v.ToUpperInvariant()[0])) == ((int)("B".ToUpperInvariant()[0]))), + jsonValueReaderWriter: new JsonConvertedValueReaderWriter( + JsonStringReaderWriter.Instance, + new ValueConverter( + string (bool v) => ((string)((v ? "B" : "A"))), + bool (string v) => !(string.IsNullOrEmpty(v)) && ((int)(v.ToUpperInvariant()[0])) == ((int)("B".ToUpperInvariant()[0]))))); + boolToStringConverterProperty.SetSentinelFromProviderValue("A"); + + var boolToTwoValuesConverterProperty = runtimeEntityType.AddProperty( + "BoolToTwoValuesConverterProperty", + typeof(bool), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToTwoValuesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToTwoValuesConverterProperty.SetValueConverter(new ValueConverter( + byte (bool v) => ((byte)((v ? 1 : 0))), + bool (byte v) => v == 1)); + boolToTwoValuesConverterProperty.SetSentinelFromProviderValue((byte)0); + + var boolToZeroOneConverterProperty = runtimeEntityType.AddProperty( + "BoolToZeroOneConverterProperty", + typeof(bool), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToZeroOneConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new BoolToZeroOneConverter()); + boolToZeroOneConverterProperty.SetSentinelFromProviderValue((short)0); + + var bytes = runtimeEntityType.AddProperty( + "Bytes", + typeof(byte[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var bytesArray = runtimeEntityType.AddProperty( + "BytesArray", + typeof(byte[][]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var bytesArrayElementType = bytesArray.SetElementType(typeof(byte[])); + + var bytesToStringConverterProperty = runtimeEntityType.AddProperty( + "BytesToStringConverterProperty", + typeof(byte[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BytesToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new BytesToStringConverter(), + valueComparer: new ArrayStructuralComparer()); + + var castingConverterProperty = runtimeEntityType.AddProperty( + "CastingConverterProperty", + typeof(int), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CastingConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new CastingConverter()); + castingConverterProperty.SetSentinelFromProviderValue(0m); + + var @char = runtimeEntityType.AddProperty( + "Char", + typeof(char), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Char", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + @char.SetSentinelFromProviderValue("\0"); + + var charArray = runtimeEntityType.AddProperty( + "CharArray", + typeof(char[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var charArrayElementType = charArray.SetElementType(typeof(char)); + + var charToStringConverterProperty = runtimeEntityType.AddProperty( + "CharToStringConverterProperty", + typeof(char), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new CharToStringConverter()); + charToStringConverterProperty.SetSentinelFromProviderValue("\0"); + charToStringConverterProperty.AddAnnotation("Relational:IsFixedLength", true); + + var dateOnly = runtimeEntityType.AddProperty( + "DateOnly", + typeof(DateOnly), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateOnly(1, 1, 1)); + + var dateOnlyArray = runtimeEntityType.AddProperty( + "DateOnlyArray", + typeof(DateOnly[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var dateOnlyArrayElementType = dateOnlyArray.SetElementType(typeof(DateOnly)); + + var dateOnlyToStringConverterProperty = runtimeEntityType.AddProperty( + "DateOnlyToStringConverterProperty", + typeof(DateOnly), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new DateOnlyToStringConverter()); + dateOnlyToStringConverterProperty.SetSentinelFromProviderValue("0001-01-01"); + + var dateTime = runtimeEntityType.AddProperty( + "DateTime", + typeof(DateTime), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dateTimeArray = runtimeEntityType.AddProperty( + "DateTimeArray", + typeof(DateTime[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var dateTimeArrayElementType = dateTimeArray.SetElementType(typeof(DateTime)); + + var dateTimeOffsetToBinaryConverterProperty = runtimeEntityType.AddProperty( + "DateTimeOffsetToBinaryConverterProperty", + typeof(DateTimeOffset), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new DateTimeOffsetToBinaryConverter()); + dateTimeOffsetToBinaryConverterProperty.SetSentinelFromProviderValue(0L); + + var dateTimeOffsetToBytesConverterProperty = runtimeEntityType.AddProperty( + "DateTimeOffsetToBytesConverterProperty", + typeof(DateTimeOffset), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new DateTimeOffsetToBytesConverter()); + dateTimeOffsetToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); + + var dateTimeOffsetToStringConverterProperty = runtimeEntityType.AddProperty( + "DateTimeOffsetToStringConverterProperty", + typeof(DateTimeOffset), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new DateTimeOffsetToStringConverter()); + dateTimeOffsetToStringConverterProperty.SetSentinelFromProviderValue("0001-01-01 00:00:00+00:00"); + + var dateTimeToBinaryConverterProperty = runtimeEntityType.AddProperty( + "DateTimeToBinaryConverterProperty", + typeof(DateTime), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new DateTimeToBinaryConverter()); + dateTimeToBinaryConverterProperty.SetSentinelFromProviderValue(0L); + + var dateTimeToStringConverterProperty = runtimeEntityType.AddProperty( + "DateTimeToStringConverterProperty", + typeof(DateTime), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new DateTimeToStringConverter()); + dateTimeToStringConverterProperty.SetSentinelFromProviderValue("0001-01-01 00:00:00"); + + var dateTimeToTicksConverterProperty = runtimeEntityType.AddProperty( + "DateTimeToTicksConverterProperty", + typeof(DateTime), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var @decimal = runtimeEntityType.AddProperty( + "Decimal", + typeof(decimal), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Decimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + + var decimalArray = runtimeEntityType.AddProperty( + "DecimalArray", + typeof(decimal[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var decimalArrayElementType = decimalArray.SetElementType(typeof(decimal)); + + var decimalNumberToBytesConverterProperty = runtimeEntityType.AddProperty( + "DecimalNumberToBytesConverterProperty", + typeof(decimal), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new NumberToBytesConverter()); + decimalNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); + + var decimalNumberToStringConverterProperty = runtimeEntityType.AddProperty( + "DecimalNumberToStringConverterProperty", + typeof(decimal), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new NumberToStringConverter()); + decimalNumberToStringConverterProperty.SetSentinelFromProviderValue("0"); + + var @double = runtimeEntityType.AddProperty( + "Double", + typeof(double), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Double", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0.0); + + var doubleArray = runtimeEntityType.AddProperty( + "DoubleArray", + typeof(double[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var doubleArrayElementType = doubleArray.SetElementType(typeof(double)); + + var doubleNumberToBytesConverterProperty = runtimeEntityType.AddProperty( + "DoubleNumberToBytesConverterProperty", + typeof(double), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new NumberToBytesConverter()); + doubleNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }); + + var doubleNumberToStringConverterProperty = runtimeEntityType.AddProperty( + "DoubleNumberToStringConverterProperty", + typeof(double), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new NumberToStringConverter()); + doubleNumberToStringConverterProperty.SetSentinelFromProviderValue("0"); + + var enum16 = runtimeEntityType.AddProperty( + "Enum16", + typeof(CompiledModelTestBase.Enum16), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16.SetSentinelFromProviderValue((short)0); + + var enum16Array = runtimeEntityType.AddProperty( + "Enum16Array", + typeof(CompiledModelTestBase.Enum16[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum16ArrayElementType = enum16Array.SetElementType(typeof(CompiledModelTestBase.Enum16)); + + var enum16AsString = runtimeEntityType.AddProperty( + "Enum16AsString", + typeof(CompiledModelTestBase.Enum16), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + enum16AsString.SetSentinelFromProviderValue("Default"); + + var enum16AsStringArray = runtimeEntityType.AddProperty( + "Enum16AsStringArray", + typeof(CompiledModelTestBase.Enum16[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum16AsStringArrayElementType = enum16AsStringArray.SetElementType(typeof(CompiledModelTestBase.Enum16), + providerClrType: typeof(string)); + + var enum16AsStringCollection = runtimeEntityType.AddProperty( + "Enum16AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum16AsStringCollectionElementType = enum16AsStringCollection.SetElementType(typeof(CompiledModelTestBase.Enum16), + providerClrType: typeof(string)); + + var enum16Collection = runtimeEntityType.AddProperty( + "Enum16Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum16CollectionElementType = enum16Collection.SetElementType(typeof(CompiledModelTestBase.Enum16)); + + var enum32 = runtimeEntityType.AddProperty( + "Enum32", + typeof(CompiledModelTestBase.Enum32), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32.SetSentinelFromProviderValue(0); + + var enum32Array = runtimeEntityType.AddProperty( + "Enum32Array", + typeof(CompiledModelTestBase.Enum32[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum32ArrayElementType = enum32Array.SetElementType(typeof(CompiledModelTestBase.Enum32)); + + var enum32AsString = runtimeEntityType.AddProperty( + "Enum32AsString", + typeof(CompiledModelTestBase.Enum32), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + enum32AsString.SetSentinelFromProviderValue("Default"); + + var enum32AsStringArray = runtimeEntityType.AddProperty( + "Enum32AsStringArray", + typeof(CompiledModelTestBase.Enum32[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum32AsStringArrayElementType = enum32AsStringArray.SetElementType(typeof(CompiledModelTestBase.Enum32), + providerClrType: typeof(string)); + + var enum32AsStringCollection = runtimeEntityType.AddProperty( + "Enum32AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum32AsStringCollectionElementType = enum32AsStringCollection.SetElementType(typeof(CompiledModelTestBase.Enum32), + providerClrType: typeof(string)); + + var enum32Collection = runtimeEntityType.AddProperty( + "Enum32Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum32CollectionElementType = enum32Collection.SetElementType(typeof(CompiledModelTestBase.Enum32)); + + var enum64 = runtimeEntityType.AddProperty( + "Enum64", + typeof(CompiledModelTestBase.Enum64), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64.SetSentinelFromProviderValue(0L); + + var enum64Array = runtimeEntityType.AddProperty( + "Enum64Array", + typeof(CompiledModelTestBase.Enum64[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum64ArrayElementType = enum64Array.SetElementType(typeof(CompiledModelTestBase.Enum64)); + + var enum64AsString = runtimeEntityType.AddProperty( + "Enum64AsString", + typeof(CompiledModelTestBase.Enum64), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + enum64AsString.SetSentinelFromProviderValue("Default"); + + var enum64AsStringArray = runtimeEntityType.AddProperty( + "Enum64AsStringArray", + typeof(CompiledModelTestBase.Enum64[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum64AsStringArrayElementType = enum64AsStringArray.SetElementType(typeof(CompiledModelTestBase.Enum64), + providerClrType: typeof(string)); + + var enum64AsStringCollection = runtimeEntityType.AddProperty( + "Enum64AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum64AsStringCollectionElementType = enum64AsStringCollection.SetElementType(typeof(CompiledModelTestBase.Enum64), + providerClrType: typeof(string)); + + var enum64Collection = runtimeEntityType.AddProperty( + "Enum64Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum64CollectionElementType = enum64Collection.SetElementType(typeof(CompiledModelTestBase.Enum64)); + + var enum8 = runtimeEntityType.AddProperty( + "Enum8", + typeof(CompiledModelTestBase.Enum8), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8.SetSentinelFromProviderValue((short)0); + + var enum8Array = runtimeEntityType.AddProperty( + "Enum8Array", + typeof(CompiledModelTestBase.Enum8[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum8ArrayElementType = enum8Array.SetElementType(typeof(CompiledModelTestBase.Enum8)); + + var enum8AsString = runtimeEntityType.AddProperty( + "Enum8AsString", + typeof(CompiledModelTestBase.Enum8), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + enum8AsString.SetSentinelFromProviderValue("Default"); + + var enum8AsStringArray = runtimeEntityType.AddProperty( + "Enum8AsStringArray", + typeof(CompiledModelTestBase.Enum8[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum8AsStringArrayElementType = enum8AsStringArray.SetElementType(typeof(CompiledModelTestBase.Enum8), + providerClrType: typeof(string)); + + var enum8AsStringCollection = runtimeEntityType.AddProperty( + "Enum8AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum8AsStringCollectionElementType = enum8AsStringCollection.SetElementType(typeof(CompiledModelTestBase.Enum8), + providerClrType: typeof(string)); + + var enum8Collection = runtimeEntityType.AddProperty( + "Enum8Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enum8CollectionElementType = enum8Collection.SetElementType(typeof(CompiledModelTestBase.Enum8)); + + var enumToNumberConverterProperty = runtimeEntityType.AddProperty( + "EnumToNumberConverterProperty", + typeof(CompiledModelTestBase.Enum32), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new EnumToNumberConverter()); + enumToNumberConverterProperty.SetSentinelFromProviderValue(0); + + var enumToStringConverterProperty = runtimeEntityType.AddProperty( + "EnumToStringConverterProperty", + typeof(CompiledModelTestBase.Enum32), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new EnumToStringConverter()); + enumToStringConverterProperty.SetSentinelFromProviderValue("Default"); + + var enumU16 = runtimeEntityType.AddProperty( + "EnumU16", + typeof(CompiledModelTestBase.EnumU16), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16.SetSentinelFromProviderValue(0); + + var enumU16Array = runtimeEntityType.AddProperty( + "EnumU16Array", + typeof(CompiledModelTestBase.EnumU16[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU16ArrayElementType = enumU16Array.SetElementType(typeof(CompiledModelTestBase.EnumU16)); + + var enumU16AsString = runtimeEntityType.AddProperty( + "EnumU16AsString", + typeof(CompiledModelTestBase.EnumU16), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + enumU16AsString.SetSentinelFromProviderValue("Min"); + + var enumU16AsStringArray = runtimeEntityType.AddProperty( + "EnumU16AsStringArray", + typeof(CompiledModelTestBase.EnumU16[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU16AsStringArrayElementType = enumU16AsStringArray.SetElementType(typeof(CompiledModelTestBase.EnumU16), + providerClrType: typeof(string)); + + var enumU16AsStringCollection = runtimeEntityType.AddProperty( + "EnumU16AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU16AsStringCollectionElementType = enumU16AsStringCollection.SetElementType(typeof(CompiledModelTestBase.EnumU16), + providerClrType: typeof(string)); + + var enumU16Collection = runtimeEntityType.AddProperty( + "EnumU16Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU16CollectionElementType = enumU16Collection.SetElementType(typeof(CompiledModelTestBase.EnumU16)); + + var enumU32 = runtimeEntityType.AddProperty( + "EnumU32", + typeof(CompiledModelTestBase.EnumU32), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32.SetSentinelFromProviderValue(0L); + + var enumU32Array = runtimeEntityType.AddProperty( + "EnumU32Array", + typeof(CompiledModelTestBase.EnumU32[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU32ArrayElementType = enumU32Array.SetElementType(typeof(CompiledModelTestBase.EnumU32)); + + var enumU32AsString = runtimeEntityType.AddProperty( + "EnumU32AsString", + typeof(CompiledModelTestBase.EnumU32), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + enumU32AsString.SetSentinelFromProviderValue("Min"); + + var enumU32AsStringArray = runtimeEntityType.AddProperty( + "EnumU32AsStringArray", + typeof(CompiledModelTestBase.EnumU32[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU32AsStringArrayElementType = enumU32AsStringArray.SetElementType(typeof(CompiledModelTestBase.EnumU32), + providerClrType: typeof(string)); + + var enumU32AsStringCollection = runtimeEntityType.AddProperty( + "EnumU32AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU32AsStringCollectionElementType = enumU32AsStringCollection.SetElementType(typeof(CompiledModelTestBase.EnumU32), + providerClrType: typeof(string)); + + var enumU32Collection = runtimeEntityType.AddProperty( + "EnumU32Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU32CollectionElementType = enumU32Collection.SetElementType(typeof(CompiledModelTestBase.EnumU32)); + + var enumU64 = runtimeEntityType.AddProperty( + "EnumU64", + typeof(CompiledModelTestBase.EnumU64), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64.SetSentinelFromProviderValue(0m); + + var enumU64Array = runtimeEntityType.AddProperty( + "EnumU64Array", + typeof(CompiledModelTestBase.EnumU64[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU64ArrayElementType = enumU64Array.SetElementType(typeof(CompiledModelTestBase.EnumU64)); + + var enumU64AsString = runtimeEntityType.AddProperty( + "EnumU64AsString", + typeof(CompiledModelTestBase.EnumU64), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + enumU64AsString.SetSentinelFromProviderValue("Min"); + + var enumU64AsStringArray = runtimeEntityType.AddProperty( + "EnumU64AsStringArray", + typeof(CompiledModelTestBase.EnumU64[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU64AsStringArrayElementType = enumU64AsStringArray.SetElementType(typeof(CompiledModelTestBase.EnumU64), + providerClrType: typeof(string)); + + var enumU64AsStringCollection = runtimeEntityType.AddProperty( + "EnumU64AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU64AsStringCollectionElementType = enumU64AsStringCollection.SetElementType(typeof(CompiledModelTestBase.EnumU64), + providerClrType: typeof(string)); + + var enumU64Collection = runtimeEntityType.AddProperty( + "EnumU64Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU64CollectionElementType = enumU64Collection.SetElementType(typeof(CompiledModelTestBase.EnumU64)); + + var enumU8 = runtimeEntityType.AddProperty( + "EnumU8", + typeof(CompiledModelTestBase.EnumU8), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8.SetSentinelFromProviderValue((byte)0); + + var enumU8Array = runtimeEntityType.AddProperty( + "EnumU8Array", + typeof(CompiledModelTestBase.EnumU8[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU8ArrayElementType = enumU8Array.SetElementType(typeof(CompiledModelTestBase.EnumU8)); + + var enumU8AsString = runtimeEntityType.AddProperty( + "EnumU8AsString", + typeof(CompiledModelTestBase.EnumU8), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + enumU8AsString.SetSentinelFromProviderValue("Min"); + + var enumU8AsStringArray = runtimeEntityType.AddProperty( + "EnumU8AsStringArray", + typeof(CompiledModelTestBase.EnumU8[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU8AsStringArrayElementType = enumU8AsStringArray.SetElementType(typeof(CompiledModelTestBase.EnumU8), + providerClrType: typeof(string)); + + var enumU8AsStringCollection = runtimeEntityType.AddProperty( + "EnumU8AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU8AsStringCollectionElementType = enumU8AsStringCollection.SetElementType(typeof(CompiledModelTestBase.EnumU8), + providerClrType: typeof(string)); + + var enumU8Collection = runtimeEntityType.AddProperty( + "EnumU8Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var enumU8CollectionElementType = enumU8Collection.SetElementType(typeof(CompiledModelTestBase.EnumU8)); + + var @float = runtimeEntityType.AddProperty( + "Float", + typeof(float), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Float", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0f); + + var floatArray = runtimeEntityType.AddProperty( + "FloatArray", + typeof(float[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("FloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var floatArrayElementType = floatArray.SetElementType(typeof(float)); + + var guid = runtimeEntityType.AddProperty( + "Guid", + typeof(Guid), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Guid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var guidArray = runtimeEntityType.AddProperty( + "GuidArray", + typeof(Guid[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var guidArrayElementType = guidArray.SetElementType(typeof(Guid)); + + var guidToBytesConverterProperty = runtimeEntityType.AddProperty( + "GuidToBytesConverterProperty", + typeof(Guid), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new GuidToBytesConverter()); + guidToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); + + var guidToStringConverterProperty = runtimeEntityType.AddProperty( + "GuidToStringConverterProperty", + typeof(Guid), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new GuidToStringConverter()); + guidToStringConverterProperty.SetSentinelFromProviderValue("00000000-0000-0000-0000-000000000000"); + + var iPAddress = runtimeEntityType.AddProperty( + "IPAddress", + typeof(IPAddress), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var iPAddressArray = runtimeEntityType.AddProperty( + "IPAddressArray", + typeof(IPAddress[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var iPAddressArrayElementType = iPAddressArray.SetElementType(typeof(IPAddress)); + + var iPAddressReadOnlyCollection = runtimeEntityType.AddProperty( + "IPAddressReadOnlyCollection", + typeof(IReadOnlyCollection), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressReadOnlyCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("_ipAddressReadOnlyCollection", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var iPAddressReadOnlyCollectionElementType = iPAddressReadOnlyCollection.SetElementType(typeof(IPAddress), + providerClrType: typeof(string)); + + var iPAddressToBytesConverterProperty = runtimeEntityType.AddProperty( + "IPAddressToBytesConverterProperty", + typeof(IPAddress), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new IPAddressToBytesConverter()); + + var iPAddressToStringConverterProperty = runtimeEntityType.AddProperty( + "IPAddressToStringConverterProperty", + typeof(IPAddress), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new IPAddressToStringConverter()); + + var int16 = runtimeEntityType.AddProperty( + "Int16", + typeof(short), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: (short)0); + + var int16Array = runtimeEntityType.AddProperty( + "Int16Array", + typeof(short[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var int16ArrayElementType = int16Array.SetElementType(typeof(short)); + + var int32 = runtimeEntityType.AddProperty( + "Int32", + typeof(int), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var int32Array = runtimeEntityType.AddProperty( + "Int32Array", + typeof(int[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var int32ArrayElementType = int32Array.SetElementType(typeof(int)); + + var int32ReadOnlyCollection = runtimeEntityType.AddProperty( + "Int32ReadOnlyCollection", + typeof(IReadOnlyCollection), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32ReadOnlyCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("_int32ReadOnlyCollection", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var int32ReadOnlyCollectionElementType = int32ReadOnlyCollection.SetElementType(typeof(int)); + + var int64 = runtimeEntityType.AddProperty( + "Int64", + typeof(long), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0L); + + var int64Array = runtimeEntityType.AddProperty( + "Int64Array", + typeof(long[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var int64ArrayElementType = int64Array.SetElementType(typeof(long)); + + var int8 = runtimeEntityType.AddProperty( + "Int8", + typeof(sbyte), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int8.SetSentinelFromProviderValue((short)0); + + var int8Array = runtimeEntityType.AddProperty( + "Int8Array", + typeof(sbyte[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var int8ArrayElementType = int8Array.SetElementType(typeof(sbyte)); + + var intNumberToBytesConverterProperty = runtimeEntityType.AddProperty( + "IntNumberToBytesConverterProperty", + typeof(int), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new NumberToBytesConverter()); + intNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0 }); + + var intNumberToStringConverterProperty = runtimeEntityType.AddProperty( + "IntNumberToStringConverterProperty", + typeof(int), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new NumberToStringConverter()); + intNumberToStringConverterProperty.SetSentinelFromProviderValue("0"); + + var nullIntToNullStringConverterProperty = runtimeEntityType.AddProperty( + "NullIntToNullStringConverterProperty", + typeof(int?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullIntToNullStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + valueConverter: new CompiledModelTestBase.NullIntToNullStringConverter()); + + var nullableBool = runtimeEntityType.AddProperty( + "NullableBool", + typeof(bool?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableBoolArray = runtimeEntityType.AddProperty( + "NullableBoolArray", + typeof(bool?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableBoolArrayElementType = nullableBoolArray.SetElementType(typeof(bool?), + nullable: true); + + var nullableBytes = runtimeEntityType.AddProperty( + "NullableBytes", + typeof(byte[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableBytesArray = runtimeEntityType.AddProperty( + "NullableBytesArray", + typeof(byte[][]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableBytesArrayElementType = nullableBytesArray.SetElementType(typeof(byte[]), + nullable: true); + + var nullableChar = runtimeEntityType.AddProperty( + "NullableChar", + typeof(char?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableChar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableCharArray = runtimeEntityType.AddProperty( + "NullableCharArray", + typeof(char?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableCharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableCharArrayElementType = nullableCharArray.SetElementType(typeof(char?), + nullable: true); + + var nullableDateOnly = runtimeEntityType.AddProperty( + "NullableDateOnly", + typeof(DateOnly?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableDateOnlyArray = runtimeEntityType.AddProperty( + "NullableDateOnlyArray", + typeof(DateOnly?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableDateOnlyArrayElementType = nullableDateOnlyArray.SetElementType(typeof(DateOnly?), + nullable: true); + + var nullableDateTime = runtimeEntityType.AddProperty( + "NullableDateTime", + typeof(DateTime?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableDateTimeArray = runtimeEntityType.AddProperty( + "NullableDateTimeArray", + typeof(DateTime?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableDateTimeArrayElementType = nullableDateTimeArray.SetElementType(typeof(DateTime?), + nullable: true); + + var nullableDecimal = runtimeEntityType.AddProperty( + "NullableDecimal", + typeof(decimal?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableDecimalArray = runtimeEntityType.AddProperty( + "NullableDecimalArray", + typeof(decimal?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableDecimalArrayElementType = nullableDecimalArray.SetElementType(typeof(decimal?), + nullable: true); + + var nullableDouble = runtimeEntityType.AddProperty( + "NullableDouble", + typeof(double?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDouble", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableDoubleArray = runtimeEntityType.AddProperty( + "NullableDoubleArray", + typeof(double?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableDoubleArrayElementType = nullableDoubleArray.SetElementType(typeof(double?), + nullable: true); + + var nullableEnum16 = runtimeEntityType.AddProperty( + "NullableEnum16", + typeof(CompiledModelTestBase.Enum16?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnum16Array = runtimeEntityType.AddProperty( + "NullableEnum16Array", + typeof(CompiledModelTestBase.Enum16?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum16ArrayElementType = nullableEnum16Array.SetElementType(typeof(CompiledModelTestBase.Enum16?), + nullable: true); + + var nullableEnum16AsString = runtimeEntityType.AddProperty( + "NullableEnum16AsString", + typeof(CompiledModelTestBase.Enum16?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnum16AsStringArray = runtimeEntityType.AddProperty( + "NullableEnum16AsStringArray", + typeof(CompiledModelTestBase.Enum16?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum16AsStringArrayElementType = nullableEnum16AsStringArray.SetElementType(typeof(CompiledModelTestBase.Enum16?), + nullable: true); + + var nullableEnum16AsStringCollection = runtimeEntityType.AddProperty( + "NullableEnum16AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum16AsStringCollectionElementType = nullableEnum16AsStringCollection.SetElementType(typeof(CompiledModelTestBase.Enum16?), + nullable: true); + + var nullableEnum16Collection = runtimeEntityType.AddProperty( + "NullableEnum16Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum16CollectionElementType = nullableEnum16Collection.SetElementType(typeof(CompiledModelTestBase.Enum16?), + nullable: true); + + var nullableEnum32 = runtimeEntityType.AddProperty( + "NullableEnum32", + typeof(CompiledModelTestBase.Enum32?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnum32Array = runtimeEntityType.AddProperty( + "NullableEnum32Array", + typeof(CompiledModelTestBase.Enum32?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum32ArrayElementType = nullableEnum32Array.SetElementType(typeof(CompiledModelTestBase.Enum32?), + nullable: true); + + var nullableEnum32AsString = runtimeEntityType.AddProperty( + "NullableEnum32AsString", + typeof(CompiledModelTestBase.Enum32?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnum32AsStringArray = runtimeEntityType.AddProperty( + "NullableEnum32AsStringArray", + typeof(CompiledModelTestBase.Enum32?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum32AsStringArrayElementType = nullableEnum32AsStringArray.SetElementType(typeof(CompiledModelTestBase.Enum32?), + nullable: true); + + var nullableEnum32AsStringCollection = runtimeEntityType.AddProperty( + "NullableEnum32AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum32AsStringCollectionElementType = nullableEnum32AsStringCollection.SetElementType(typeof(CompiledModelTestBase.Enum32?), + nullable: true); + + var nullableEnum32Collection = runtimeEntityType.AddProperty( + "NullableEnum32Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum32CollectionElementType = nullableEnum32Collection.SetElementType(typeof(CompiledModelTestBase.Enum32?), + nullable: true); + + var nullableEnum64 = runtimeEntityType.AddProperty( + "NullableEnum64", + typeof(CompiledModelTestBase.Enum64?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnum64Array = runtimeEntityType.AddProperty( + "NullableEnum64Array", + typeof(CompiledModelTestBase.Enum64?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum64ArrayElementType = nullableEnum64Array.SetElementType(typeof(CompiledModelTestBase.Enum64?), + nullable: true); + + var nullableEnum64AsString = runtimeEntityType.AddProperty( + "NullableEnum64AsString", + typeof(CompiledModelTestBase.Enum64?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnum64AsStringArray = runtimeEntityType.AddProperty( + "NullableEnum64AsStringArray", + typeof(CompiledModelTestBase.Enum64?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum64AsStringArrayElementType = nullableEnum64AsStringArray.SetElementType(typeof(CompiledModelTestBase.Enum64?), + nullable: true); + + var nullableEnum64AsStringCollection = runtimeEntityType.AddProperty( + "NullableEnum64AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum64AsStringCollectionElementType = nullableEnum64AsStringCollection.SetElementType(typeof(CompiledModelTestBase.Enum64?), + nullable: true); + + var nullableEnum64Collection = runtimeEntityType.AddProperty( + "NullableEnum64Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum64CollectionElementType = nullableEnum64Collection.SetElementType(typeof(CompiledModelTestBase.Enum64?), + nullable: true); + + var nullableEnum8 = runtimeEntityType.AddProperty( + "NullableEnum8", + typeof(CompiledModelTestBase.Enum8?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnum8Array = runtimeEntityType.AddProperty( + "NullableEnum8Array", + typeof(CompiledModelTestBase.Enum8?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum8ArrayElementType = nullableEnum8Array.SetElementType(typeof(CompiledModelTestBase.Enum8?), + nullable: true); + + var nullableEnum8AsString = runtimeEntityType.AddProperty( + "NullableEnum8AsString", + typeof(CompiledModelTestBase.Enum8?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnum8AsStringArray = runtimeEntityType.AddProperty( + "NullableEnum8AsStringArray", + typeof(CompiledModelTestBase.Enum8?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum8AsStringArrayElementType = nullableEnum8AsStringArray.SetElementType(typeof(CompiledModelTestBase.Enum8?), + nullable: true); + + var nullableEnum8AsStringCollection = runtimeEntityType.AddProperty( + "NullableEnum8AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum8AsStringCollectionElementType = nullableEnum8AsStringCollection.SetElementType(typeof(CompiledModelTestBase.Enum8?), + nullable: true); + + var nullableEnum8Collection = runtimeEntityType.AddProperty( + "NullableEnum8Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnum8CollectionElementType = nullableEnum8Collection.SetElementType(typeof(CompiledModelTestBase.Enum8?), + nullable: true); + + var nullableEnumU16 = runtimeEntityType.AddProperty( + "NullableEnumU16", + typeof(CompiledModelTestBase.EnumU16?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnumU16Array = runtimeEntityType.AddProperty( + "NullableEnumU16Array", + typeof(CompiledModelTestBase.EnumU16?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU16ArrayElementType = nullableEnumU16Array.SetElementType(typeof(CompiledModelTestBase.EnumU16?), + nullable: true); + + var nullableEnumU16AsString = runtimeEntityType.AddProperty( + "NullableEnumU16AsString", + typeof(CompiledModelTestBase.EnumU16?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnumU16AsStringArray = runtimeEntityType.AddProperty( + "NullableEnumU16AsStringArray", + typeof(CompiledModelTestBase.EnumU16?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU16AsStringArrayElementType = nullableEnumU16AsStringArray.SetElementType(typeof(CompiledModelTestBase.EnumU16?), + nullable: true); + + var nullableEnumU16AsStringCollection = runtimeEntityType.AddProperty( + "NullableEnumU16AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU16AsStringCollectionElementType = nullableEnumU16AsStringCollection.SetElementType(typeof(CompiledModelTestBase.EnumU16?), + nullable: true); + + var nullableEnumU16Collection = runtimeEntityType.AddProperty( + "NullableEnumU16Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU16CollectionElementType = nullableEnumU16Collection.SetElementType(typeof(CompiledModelTestBase.EnumU16?), + nullable: true); + + var nullableEnumU32 = runtimeEntityType.AddProperty( + "NullableEnumU32", + typeof(CompiledModelTestBase.EnumU32?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnumU32Array = runtimeEntityType.AddProperty( + "NullableEnumU32Array", + typeof(CompiledModelTestBase.EnumU32?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU32ArrayElementType = nullableEnumU32Array.SetElementType(typeof(CompiledModelTestBase.EnumU32?), + nullable: true); + + var nullableEnumU32AsString = runtimeEntityType.AddProperty( + "NullableEnumU32AsString", + typeof(CompiledModelTestBase.EnumU32?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnumU32AsStringArray = runtimeEntityType.AddProperty( + "NullableEnumU32AsStringArray", + typeof(CompiledModelTestBase.EnumU32?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU32AsStringArrayElementType = nullableEnumU32AsStringArray.SetElementType(typeof(CompiledModelTestBase.EnumU32?), + nullable: true); + + var nullableEnumU32AsStringCollection = runtimeEntityType.AddProperty( + "NullableEnumU32AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU32AsStringCollectionElementType = nullableEnumU32AsStringCollection.SetElementType(typeof(CompiledModelTestBase.EnumU32?), + nullable: true); + + var nullableEnumU32Collection = runtimeEntityType.AddProperty( + "NullableEnumU32Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU32CollectionElementType = nullableEnumU32Collection.SetElementType(typeof(CompiledModelTestBase.EnumU32?), + nullable: true); + + var nullableEnumU64 = runtimeEntityType.AddProperty( + "NullableEnumU64", + typeof(CompiledModelTestBase.EnumU64?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnumU64Array = runtimeEntityType.AddProperty( + "NullableEnumU64Array", + typeof(CompiledModelTestBase.EnumU64?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU64ArrayElementType = nullableEnumU64Array.SetElementType(typeof(CompiledModelTestBase.EnumU64?), + nullable: true); + + var nullableEnumU64AsString = runtimeEntityType.AddProperty( + "NullableEnumU64AsString", + typeof(CompiledModelTestBase.EnumU64?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnumU64AsStringArray = runtimeEntityType.AddProperty( + "NullableEnumU64AsStringArray", + typeof(CompiledModelTestBase.EnumU64?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU64AsStringArrayElementType = nullableEnumU64AsStringArray.SetElementType(typeof(CompiledModelTestBase.EnumU64?), + nullable: true); + + var nullableEnumU64AsStringCollection = runtimeEntityType.AddProperty( + "NullableEnumU64AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU64AsStringCollectionElementType = nullableEnumU64AsStringCollection.SetElementType(typeof(CompiledModelTestBase.EnumU64?), + nullable: true); + + var nullableEnumU64Collection = runtimeEntityType.AddProperty( + "NullableEnumU64Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU64CollectionElementType = nullableEnumU64Collection.SetElementType(typeof(CompiledModelTestBase.EnumU64?), + nullable: true); + + var nullableEnumU8 = runtimeEntityType.AddProperty( + "NullableEnumU8", + typeof(CompiledModelTestBase.EnumU8?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnumU8Array = runtimeEntityType.AddProperty( + "NullableEnumU8Array", + typeof(CompiledModelTestBase.EnumU8?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU8ArrayElementType = nullableEnumU8Array.SetElementType(typeof(CompiledModelTestBase.EnumU8?), + nullable: true); + + var nullableEnumU8AsString = runtimeEntityType.AddProperty( + "NullableEnumU8AsString", + typeof(CompiledModelTestBase.EnumU8?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableEnumU8AsStringArray = runtimeEntityType.AddProperty( + "NullableEnumU8AsStringArray", + typeof(CompiledModelTestBase.EnumU8?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU8AsStringArrayElementType = nullableEnumU8AsStringArray.SetElementType(typeof(CompiledModelTestBase.EnumU8?), + nullable: true); + + var nullableEnumU8AsStringCollection = runtimeEntityType.AddProperty( + "NullableEnumU8AsStringCollection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU8AsStringCollectionElementType = nullableEnumU8AsStringCollection.SetElementType(typeof(CompiledModelTestBase.EnumU8?), + nullable: true); + + var nullableEnumU8Collection = runtimeEntityType.AddProperty( + "NullableEnumU8Collection", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableEnumU8CollectionElementType = nullableEnumU8Collection.SetElementType(typeof(CompiledModelTestBase.EnumU8?), + nullable: true); + + var nullableFloat = runtimeEntityType.AddProperty( + "NullableFloat", + typeof(float?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloat", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableFloatArray = runtimeEntityType.AddProperty( + "NullableFloatArray", + typeof(float?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableFloatArrayElementType = nullableFloatArray.SetElementType(typeof(float?), + nullable: true); + + var nullableGuid = runtimeEntityType.AddProperty( + "NullableGuid", + typeof(Guid?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableGuidArray = runtimeEntityType.AddProperty( + "NullableGuidArray", + typeof(Guid?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableGuidArrayElementType = nullableGuidArray.SetElementType(typeof(Guid?), + nullable: true); + + var nullableIPAddress = runtimeEntityType.AddProperty( + "NullableIPAddress", + typeof(IPAddress), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableIPAddressArray = runtimeEntityType.AddProperty( + "NullableIPAddressArray", + typeof(IPAddress[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableIPAddressArrayElementType = nullableIPAddressArray.SetElementType(typeof(IPAddress), + nullable: true); + + var nullableInt16 = runtimeEntityType.AddProperty( + "NullableInt16", + typeof(short?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableInt16Array = runtimeEntityType.AddProperty( + "NullableInt16Array", + typeof(short?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableInt16ArrayElementType = nullableInt16Array.SetElementType(typeof(short?), + nullable: true); + + var nullableInt32 = runtimeEntityType.AddProperty( + "NullableInt32", + typeof(int?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableInt32Array = runtimeEntityType.AddProperty( + "NullableInt32Array", + typeof(int?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableInt32ArrayElementType = nullableInt32Array.SetElementType(typeof(int?), + nullable: true); + + var nullableInt64 = runtimeEntityType.AddProperty( + "NullableInt64", + typeof(long?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableInt64Array = runtimeEntityType.AddProperty( + "NullableInt64Array", + typeof(long?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableInt64ArrayElementType = nullableInt64Array.SetElementType(typeof(long?), + nullable: true); + + var nullableInt8 = runtimeEntityType.AddProperty( + "NullableInt8", + typeof(sbyte?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableInt8Array = runtimeEntityType.AddProperty( + "NullableInt8Array", + typeof(sbyte?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableInt8ArrayElementType = nullableInt8Array.SetElementType(typeof(sbyte?), + nullable: true); + + var nullablePhysicalAddress = runtimeEntityType.AddProperty( + "NullablePhysicalAddress", + typeof(PhysicalAddress), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullablePhysicalAddressArray = runtimeEntityType.AddProperty( + "NullablePhysicalAddressArray", + typeof(PhysicalAddress[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullablePhysicalAddressArrayElementType = nullablePhysicalAddressArray.SetElementType(typeof(PhysicalAddress), + nullable: true); + + var nullableString = runtimeEntityType.AddProperty( + "NullableString", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableStringArray = runtimeEntityType.AddProperty( + "NullableStringArray", + typeof(string[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableStringArrayElementType = nullableStringArray.SetElementType(typeof(string), + nullable: true); + + var nullableTimeOnly = runtimeEntityType.AddProperty( + "NullableTimeOnly", + typeof(TimeOnly?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableTimeOnlyArray = runtimeEntityType.AddProperty( + "NullableTimeOnlyArray", + typeof(TimeOnly?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableTimeOnlyArrayElementType = nullableTimeOnlyArray.SetElementType(typeof(TimeOnly?), + nullable: true); + + var nullableTimeSpan = runtimeEntityType.AddProperty( + "NullableTimeSpan", + typeof(TimeSpan?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableTimeSpanArray = runtimeEntityType.AddProperty( + "NullableTimeSpanArray", + typeof(TimeSpan?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableTimeSpanArrayElementType = nullableTimeSpanArray.SetElementType(typeof(TimeSpan?), + nullable: true); + + var nullableUInt16 = runtimeEntityType.AddProperty( + "NullableUInt16", + typeof(ushort?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableUInt16Array = runtimeEntityType.AddProperty( + "NullableUInt16Array", + typeof(ushort?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableUInt16ArrayElementType = nullableUInt16Array.SetElementType(typeof(ushort?), + nullable: true); + + var nullableUInt32 = runtimeEntityType.AddProperty( + "NullableUInt32", + typeof(uint?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableUInt32Array = runtimeEntityType.AddProperty( + "NullableUInt32Array", + typeof(uint?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableUInt32ArrayElementType = nullableUInt32Array.SetElementType(typeof(uint?), + nullable: true); + + var nullableUInt64 = runtimeEntityType.AddProperty( + "NullableUInt64", + typeof(ulong?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableUInt64Array = runtimeEntityType.AddProperty( + "NullableUInt64Array", + typeof(ulong?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableUInt64ArrayElementType = nullableUInt64Array.SetElementType(typeof(ulong?), + nullable: true); + + var nullableUInt8 = runtimeEntityType.AddProperty( + "NullableUInt8", + typeof(byte?), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableUInt8Array = runtimeEntityType.AddProperty( + "NullableUInt8Array", + typeof(byte?[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableUInt8ArrayElementType = nullableUInt8Array.SetElementType(typeof(byte?), + nullable: true); + + var nullableUri = runtimeEntityType.AddProperty( + "NullableUri", + typeof(Uri), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var nullableUriArray = runtimeEntityType.AddProperty( + "NullableUriArray", + typeof(Uri[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var nullableUriArrayElementType = nullableUriArray.SetElementType(typeof(Uri), + nullable: true); + + var physicalAddress = runtimeEntityType.AddProperty( + "PhysicalAddress", + typeof(PhysicalAddress), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var physicalAddressArray = runtimeEntityType.AddProperty( + "PhysicalAddressArray", + typeof(PhysicalAddress[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var physicalAddressArrayElementType = physicalAddressArray.SetElementType(typeof(PhysicalAddress)); + + var physicalAddressToBytesConverterProperty = runtimeEntityType.AddProperty( + "PhysicalAddressToBytesConverterProperty", + typeof(PhysicalAddress), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new PhysicalAddressToBytesConverter()); + + var physicalAddressToStringConverterProperty = runtimeEntityType.AddProperty( + "PhysicalAddressToStringConverterProperty", + typeof(PhysicalAddress), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new PhysicalAddressToStringConverter()); + + var @string = runtimeEntityType.AddProperty( + "String", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("String", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var stringArray = runtimeEntityType.AddProperty( + "StringArray", + typeof(string[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var stringArrayElementType = stringArray.SetElementType(typeof(string)); + + var stringReadOnlyCollection = runtimeEntityType.AddProperty( + "StringReadOnlyCollection", + typeof(IReadOnlyCollection), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringReadOnlyCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("_stringReadOnlyCollection", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var stringReadOnlyCollectionElementType = stringReadOnlyCollection.SetElementType(typeof(string)); + + var stringToBoolConverterProperty = runtimeEntityType.AddProperty( + "StringToBoolConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBoolConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToBoolConverter()); + + var stringToBytesConverterProperty = runtimeEntityType.AddProperty( + "StringToBytesConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + stringToBytesConverterProperty.SetValueConverter(new ValueConverter( + byte[] (string v) => Encoding.GetEncoding(12000).GetBytes(v), + string (byte[] v) => Encoding.GetEncoding(12000).GetString(v))); + + var stringToCharConverterProperty = runtimeEntityType.AddProperty( + "StringToCharConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToCharConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToCharConverter()); + + var stringToDateOnlyConverterProperty = runtimeEntityType.AddProperty( + "StringToDateOnlyConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToDateOnlyConverter()); + + var stringToDateTimeConverterProperty = runtimeEntityType.AddProperty( + "StringToDateTimeConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToDateTimeConverter()); + + var stringToDateTimeOffsetConverterProperty = runtimeEntityType.AddProperty( + "StringToDateTimeOffsetConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeOffsetConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToDateTimeOffsetConverter()); + + var stringToDecimalNumberConverterProperty = runtimeEntityType.AddProperty( + "StringToDecimalNumberConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDecimalNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToNumberConverter()); + + var stringToDoubleNumberConverterProperty = runtimeEntityType.AddProperty( + "StringToDoubleNumberConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDoubleNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToNumberConverter()); + + var stringToEnumConverterProperty = runtimeEntityType.AddProperty( + "StringToEnumConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToEnumConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToEnumConverter()); + + var stringToGuidConverterProperty = runtimeEntityType.AddProperty( + "StringToGuidConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToGuidConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var stringToIntNumberConverterProperty = runtimeEntityType.AddProperty( + "StringToIntNumberConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToIntNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToNumberConverter()); + + var stringToTimeOnlyConverterProperty = runtimeEntityType.AddProperty( + "StringToTimeOnlyConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToTimeOnlyConverter()); + + var stringToTimeSpanConverterProperty = runtimeEntityType.AddProperty( + "StringToTimeSpanConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeSpanConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToTimeSpanConverter()); + + var stringToUriConverterProperty = runtimeEntityType.AddProperty( + "StringToUriConverterProperty", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToUriConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new StringToUriConverter()); + + var timeOnly = runtimeEntityType.AddProperty( + "TimeOnly", + typeof(TimeOnly), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new TimeOnly(0, 0, 0)); + + var timeOnlyArray = runtimeEntityType.AddProperty( + "TimeOnlyArray", + typeof(TimeOnly[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var timeOnlyArrayElementType = timeOnlyArray.SetElementType(typeof(TimeOnly)); + + var timeOnlyToStringConverterProperty = runtimeEntityType.AddProperty( + "TimeOnlyToStringConverterProperty", + typeof(TimeOnly), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new TimeOnlyToStringConverter()); + timeOnlyToStringConverterProperty.SetSentinelFromProviderValue("00:00:00"); + + var timeOnlyToTicksConverterProperty = runtimeEntityType.AddProperty( + "TimeOnlyToTicksConverterProperty", + typeof(TimeOnly), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new TimeOnlyToTicksConverter()); + timeOnlyToTicksConverterProperty.SetSentinelFromProviderValue(0L); + + var timeSpan = runtimeEntityType.AddProperty( + "TimeSpan", + typeof(TimeSpan), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new TimeSpan(0, 0, 0, 0, 0)); + + var timeSpanArray = runtimeEntityType.AddProperty( + "TimeSpanArray", + typeof(TimeSpan[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var timeSpanArrayElementType = timeSpanArray.SetElementType(typeof(TimeSpan)); + + var timeSpanToStringConverterProperty = runtimeEntityType.AddProperty( + "TimeSpanToStringConverterProperty", + typeof(TimeSpan), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new TimeSpanToStringConverter()); + timeSpanToStringConverterProperty.SetSentinelFromProviderValue("00:00:00"); + + var timeSpanToTicksConverterProperty = runtimeEntityType.AddProperty( + "TimeSpanToTicksConverterProperty", + typeof(TimeSpan), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new TimeSpanToTicksConverter()); + timeSpanToTicksConverterProperty.SetSentinelFromProviderValue(0L); + + var uInt16 = runtimeEntityType.AddProperty( + "UInt16", + typeof(ushort), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt16.SetSentinelFromProviderValue(0); + + var uInt16Array = runtimeEntityType.AddProperty( + "UInt16Array", + typeof(ushort[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var uInt16ArrayElementType = uInt16Array.SetElementType(typeof(ushort)); + + var uInt32 = runtimeEntityType.AddProperty( + "UInt32", + typeof(uint), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt32.SetSentinelFromProviderValue(0L); + + var uInt32Array = runtimeEntityType.AddProperty( + "UInt32Array", + typeof(uint[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var uInt32ArrayElementType = uInt32Array.SetElementType(typeof(uint)); + + var uInt64 = runtimeEntityType.AddProperty( + "UInt64", + typeof(ulong), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt64.SetSentinelFromProviderValue(0m); + + var uInt64Array = runtimeEntityType.AddProperty( + "UInt64Array", + typeof(ulong[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var uInt64ArrayElementType = uInt64Array.SetElementType(typeof(ulong)); + + var uInt8 = runtimeEntityType.AddProperty( + "UInt8", + typeof(byte), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: (byte)0); + + var uInt8Array = runtimeEntityType.AddProperty( + "UInt8Array", + typeof(byte[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var uInt8ReadOnlyCollection = runtimeEntityType.AddProperty( + "UInt8ReadOnlyCollection", + typeof(IReadOnlyCollection), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8ReadOnlyCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("_uInt8ReadOnlyCollection", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var uInt8ReadOnlyCollectionElementType = uInt8ReadOnlyCollection.SetElementType(typeof(byte)); + + var uri = runtimeEntityType.AddProperty( + "Uri", + typeof(Uri), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Uri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var uriArray = runtimeEntityType.AddProperty( + "UriArray", + typeof(Uri[]), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var uriArrayElementType = uriArray.SetElementType(typeof(Uri)); + + var uriToStringConverterProperty = runtimeEntityType.AddProperty( + "UriToStringConverterProperty", + typeof(Uri), + propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new UriToStringConverter()); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ManyTypes"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/OwnedType0EntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/OwnedType0EntityType.cs new file mode 100644 index 00000000..32cbfcb9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/OwnedType0EntityType.cs @@ -0,0 +1,176 @@ +// +using System; +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using EntityFrameworkCore.Jet.Metadata; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class OwnedType0EntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived>.ManyOwned#OwnedType", + typeof(CompiledModelTestBase.OwnedType), + baseEntityType, + sharedClrType: true, + propertyCount: 13, + servicePropertyCount: 1, + foreignKeyCount: 1, + keyCount: 1); + + var principalDerivedId = runtimeEntityType.AddProperty( + "PrincipalDerivedId", + typeof(long), + afterSaveBehavior: PropertySaveBehavior.Throw, + providerPropertyType: typeof(int)); + principalDerivedId.SetSentinelFromProviderValue(0); + + var principalDerivedAlternateId = runtimeEntityType.AddProperty( + "PrincipalDerivedAlternateId", + typeof(Guid), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + + var details = runtimeEntityType.AddProperty( + "Details", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Details", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var number = runtimeEntityType.AddProperty( + "Number", + typeof(int), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Number", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var refTypeArray = runtimeEntityType.AddProperty( + "RefTypeArray", + typeof(IPAddress[]), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var refTypeArrayElementType = refTypeArray.SetElementType(typeof(IPAddress)); + + var refTypeEnumerable = runtimeEntityType.AddProperty( + "RefTypeEnumerable", + typeof(IEnumerable), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var refTypeEnumerableElementType = refTypeEnumerable.SetElementType(typeof(string)); + + var refTypeIList = runtimeEntityType.AddProperty( + "RefTypeIList", + typeof(IList), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var refTypeIListElementType = refTypeIList.SetElementType(typeof(string)); + + var refTypeList = runtimeEntityType.AddProperty( + "RefTypeList", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var refTypeListElementType = refTypeList.SetElementType(typeof(IPAddress)); + + var valueTypeArray = runtimeEntityType.AddProperty( + "ValueTypeArray", + typeof(DateTime[]), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var valueTypeArrayElementType = valueTypeArray.SetElementType(typeof(DateTime)); + + var valueTypeEnumerable = runtimeEntityType.AddProperty( + "ValueTypeEnumerable", + typeof(IEnumerable), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var valueTypeEnumerableElementType = valueTypeEnumerable.SetElementType(typeof(byte)); + + var valueTypeIList = runtimeEntityType.AddProperty( + "ValueTypeIList", + typeof(IList), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var valueTypeIListElementType = valueTypeIList.SetElementType(typeof(byte)); + + var valueTypeList = runtimeEntityType.AddProperty( + "ValueTypeList", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var valueTypeListElementType = valueTypeList.SetElementType(typeof(short)); + + var context = runtimeEntityType.AddServiceProperty( + "Context", + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Context", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + serviceType: typeof(DbContext)); + + var key = runtimeEntityType.AddKey( + new[] { principalDerivedId, principalDerivedAlternateId, id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalDerivedId"), declaringEntityType.FindProperty("PrincipalDerivedAlternateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id"), principalEntityType.FindProperty("AlternateId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true, + ownership: true); + + var manyOwned = principalEntityType.AddNavigation("ManyOwned", + runtimeForeignKey, + onDependent: false, + typeof(IList), + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("ManyOwned", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + eagerLoaded: true); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ManyOwned"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/OwnedTypeEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/OwnedTypeEntityType.cs new file mode 100644 index 00000000..b34444d8 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/OwnedTypeEntityType.cs @@ -0,0 +1,230 @@ +// +using System; +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using EntityFrameworkCore.Jet.Metadata; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class OwnedTypeEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase.Owned#OwnedType", + typeof(CompiledModelTestBase.OwnedType), + baseEntityType, + sharedClrType: true, + changeTrackingStrategy: ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues, + propertyCount: 12, + servicePropertyCount: 1, + foreignKeyCount: 2, + keyCount: 1); + + var principalBaseId = runtimeEntityType.AddProperty( + "PrincipalBaseId", + typeof(long), + propertyAccessMode: PropertyAccessMode.Field, + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + providerPropertyType: typeof(int)); + principalBaseId.SetSentinelFromProviderValue(0); + + var overrides = new StoreObjectDictionary(); + var principalBaseIdPrincipalBase = new RuntimeRelationalPropertyOverrides( + principalBaseId, + StoreObjectIdentifier.Table("PrincipalBase", "mySchema"), + false, + null); + principalBaseIdPrincipalBase.AddAnnotation("Jet:IdentityIncrement", 3); + principalBaseIdPrincipalBase.AddAnnotation("Jet:IdentitySeed", 2); + principalBaseIdPrincipalBase.AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + overrides.Add(StoreObjectIdentifier.Table("PrincipalBase", "mySchema"), principalBaseIdPrincipalBase); + principalBaseId.AddAnnotation("Relational:RelationalOverrides", overrides); + + principalBaseId.AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + + var principalBaseAlternateId = runtimeEntityType.AddProperty( + "PrincipalBaseAlternateId", + typeof(Guid), + propertyAccessMode: PropertyAccessMode.Field, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var details = runtimeEntityType.AddProperty( + "Details", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Details", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + + var overrides0 = new StoreObjectDictionary(); + var detailsDetails = new RuntimeRelationalPropertyOverrides( + details, + StoreObjectIdentifier.Table("Details", null), + false, + null); + overrides0.Add(StoreObjectIdentifier.Table("Details", null), detailsDetails); + details.AddAnnotation("Relational:RelationalOverrides", overrides0); + + + var number = runtimeEntityType.AddProperty( + "Number", + typeof(int), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Number", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + sentinel: 0); + + var refTypeArray = runtimeEntityType.AddProperty( + "RefTypeArray", + typeof(IPAddress[]), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + var refTypeArrayElementType = refTypeArray.SetElementType(typeof(IPAddress)); + + var refTypeEnumerable = runtimeEntityType.AddProperty( + "RefTypeEnumerable", + typeof(IEnumerable), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + var refTypeEnumerableElementType = refTypeEnumerable.SetElementType(typeof(string)); + + var refTypeIList = runtimeEntityType.AddProperty( + "RefTypeIList", + typeof(IList), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + var refTypeIListElementType = refTypeIList.SetElementType(typeof(string)); + + var refTypeList = runtimeEntityType.AddProperty( + "RefTypeList", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + var refTypeListElementType = refTypeList.SetElementType(typeof(IPAddress)); + + var valueTypeArray = runtimeEntityType.AddProperty( + "ValueTypeArray", + typeof(DateTime[]), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + var valueTypeArrayElementType = valueTypeArray.SetElementType(typeof(DateTime)); + + var valueTypeEnumerable = runtimeEntityType.AddProperty( + "ValueTypeEnumerable", + typeof(IEnumerable), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + var valueTypeEnumerableElementType = valueTypeEnumerable.SetElementType(typeof(byte)); + + var valueTypeIList = runtimeEntityType.AddProperty( + "ValueTypeIList", + typeof(IList), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + var valueTypeIListElementType = valueTypeIList.SetElementType(typeof(byte)); + + var valueTypeList = runtimeEntityType.AddProperty( + "ValueTypeList", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + nullable: true); + var valueTypeListElementType = valueTypeList.SetElementType(typeof(short)); + + var context = runtimeEntityType.AddServiceProperty( + "Context", + propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Context", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + serviceType: typeof(DbContext)); + + var key = runtimeEntityType.AddKey( + new[] { principalBaseId, principalBaseAlternateId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalBaseId"), declaringEntityType.FindProperty("PrincipalBaseAlternateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id"), principalEntityType.FindProperty("AlternateId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true, + requiredDependent: true, + ownership: true); + + var owned = principalEntityType.AddNavigation("Owned", + runtimeForeignKey, + onDependent: false, + typeof(CompiledModelTestBase.OwnedType), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Owned", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("_ownedField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Field, + eagerLoaded: true); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalBaseId"), declaringEntityType.FindProperty("PrincipalBaseAlternateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("PrincipalBaseId"), principalEntityType.FindProperty("PrincipalBaseAlternateId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true, + requiredDependent: true); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + var fragments = new StoreObjectDictionary(); + var detailsFragment = new RuntimeEntityTypeMappingFragment( + runtimeEntityType, + StoreObjectIdentifier.Table("Details", null), + null); + fragments.Add(StoreObjectIdentifier.Table("Details", null), detailsFragment); + runtimeEntityType.AddAnnotation("Relational:MappingFragments", fragments); + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", "mySchema"); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "PrincipalBase"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalBaseEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalBaseEntityType.cs new file mode 100644 index 00000000..1c28cafd --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalBaseEntityType.cs @@ -0,0 +1,213 @@ +// +using System; +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using EntityFrameworkCore.Jet.Metadata; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage.Json; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class PrincipalBaseEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", + typeof(CompiledModelTestBase.PrincipalBase), + baseEntityType, + discriminatorValue: "PrincipalBase", + derivedTypesCount: 1, + propertyCount: 14, + navigationCount: 1, + skipNavigationCount: 1, + unnamedIndexCount: 1, + keyCount: 2); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(long?), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + providerPropertyType: typeof(int)); + + var overrides = new StoreObjectDictionary(); + var idPrincipalDerived = new RuntimeRelationalPropertyOverrides( + id, + StoreObjectIdentifier.Table("PrincipalDerived", null), + true, + "DerivedId"); + overrides.Add(StoreObjectIdentifier.Table("PrincipalDerived", null), idPrincipalDerived); + id.AddAnnotation("Relational:RelationalOverrides", overrides); + + id.AddAnnotation("Jet:IdentityIncrement", 3); + id.AddAnnotation("Jet:IdentitySeed", 2); + id.AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + + var alternateId = runtimeEntityType.AddProperty( + "AlternateId", + typeof(Guid), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("AlternateId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.FieldDuringConstruction, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000"), + jsonValueReaderWriter: JsonGuidReaderWriter.Instance); + + var enum1 = runtimeEntityType.AddProperty( + "Enum1", + typeof(CompiledModelTestBase.AnEnum), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum1.SetSentinelFromProviderValue(0); + + var enum2 = runtimeEntityType.AddProperty( + "Enum2", + typeof(CompiledModelTestBase.AnEnum?), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var flagsEnum1 = runtimeEntityType.AddProperty( + "FlagsEnum1", + typeof(CompiledModelTestBase.AFlagsEnum), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetSentinelFromProviderValue(0); + + var flagsEnum2 = runtimeEntityType.AddProperty( + "FlagsEnum2", + typeof(CompiledModelTestBase.AFlagsEnum), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + propertyAccessMode: PropertyAccessMode.Property); + flagsEnum2.SetSentinelFromProviderValue(6); + + var refTypeArray = runtimeEntityType.AddProperty( + "RefTypeArray", + typeof(IPAddress[]), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var refTypeArrayElementType = refTypeArray.SetElementType(typeof(IPAddress)); + + var refTypeEnumerable = runtimeEntityType.AddProperty( + "RefTypeEnumerable", + typeof(IEnumerable), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var refTypeEnumerableElementType = refTypeEnumerable.SetElementType(typeof(string)); + + var refTypeIList = runtimeEntityType.AddProperty( + "RefTypeIList", + typeof(IList), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var refTypeIListElementType = refTypeIList.SetElementType(typeof(string)); + + var refTypeList = runtimeEntityType.AddProperty( + "RefTypeList", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var refTypeListElementType = refTypeList.SetElementType(typeof(IPAddress)); + + var valueTypeArray = runtimeEntityType.AddProperty( + "ValueTypeArray", + typeof(DateTime[]), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var valueTypeArrayElementType = valueTypeArray.SetElementType(typeof(DateTime)); + + var valueTypeEnumerable = runtimeEntityType.AddProperty( + "ValueTypeEnumerable", + typeof(IEnumerable), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var valueTypeEnumerableElementType = valueTypeEnumerable.SetElementType(typeof(byte)); + + var valueTypeIList = runtimeEntityType.AddProperty( + "ValueTypeIList", + typeof(IList), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var valueTypeIListElementType = valueTypeIList.SetElementType(typeof(byte)); + + var valueTypeList = runtimeEntityType.AddProperty( + "ValueTypeList", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var valueTypeListElementType = valueTypeList.SetElementType(typeof(short)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + + var key0 = runtimeEntityType.AddKey( + new[] { id, alternateId }); + runtimeEntityType.SetPrimaryKey(key0); + key0.AddAnnotation("Relational:Name", "PK"); + + var index = runtimeEntityType.AddIndex( + new[] { alternateId, id }); + + return runtimeEntityType; + } + + public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType declaringEntityType, RuntimeEntityType targetEntityType, RuntimeEntityType joinEntityType) + { + var skipNavigation = declaringEntityType.AddSkipNavigation( + "Deriveds", + targetEntityType, + joinEntityType.FindForeignKey( + new[] { joinEntityType.FindProperty("PrincipalsId"), joinEntityType.FindProperty("PrincipalsAlternateId") }, + declaringEntityType.FindKey(new[] { declaringEntityType.FindProperty("Id"), declaringEntityType.FindProperty("AlternateId") }), + declaringEntityType), + true, + false, + typeof(ICollection), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Deriveds", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var inverse = targetEntityType.FindSkipNavigation("Principals"); + if (inverse != null) + { + skipNavigation.Inverse = inverse; + inverse.Inverse = skipNavigation; + } + + return skipNavigation; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPT"); + runtimeEntityType.AddAnnotation("Relational:Schema", "mySchema"); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "PrincipalBase"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs new file mode 100644 index 00000000..011b8800 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs @@ -0,0 +1,114 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class PrincipalBasePrincipalDerivedDependentBasebyteEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "PrincipalBasePrincipalDerived>", + typeof(Dictionary), + baseEntityType, + sharedClrType: true, + indexerPropertyInfo: RuntimeEntityType.FindIndexerProperty(typeof(Dictionary)), + propertyBag: true, + propertyCount: 5, + foreignKeyCount: 2, + unnamedIndexCount: 1, + keyCount: 1); + + var derivedsId = runtimeEntityType.AddProperty( + "DerivedsId", + typeof(long), + propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), + afterSaveBehavior: PropertySaveBehavior.Throw, + providerPropertyType: typeof(int)); + + var derivedsAlternateId = runtimeEntityType.AddProperty( + "DerivedsAlternateId", + typeof(Guid), + propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), + afterSaveBehavior: PropertySaveBehavior.Throw); + + var principalsId = runtimeEntityType.AddProperty( + "PrincipalsId", + typeof(long), + propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), + afterSaveBehavior: PropertySaveBehavior.Throw, + providerPropertyType: typeof(int)); + + var principalsAlternateId = runtimeEntityType.AddProperty( + "PrincipalsAlternateId", + typeof(Guid), + propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), + afterSaveBehavior: PropertySaveBehavior.Throw); + + var rowid = runtimeEntityType.AddProperty( + "rowid", + typeof(byte[]), + propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), + nullable: true, + concurrencyToken: true, + valueGenerated: ValueGenerated.OnAddOrUpdate, + beforeSaveBehavior: PropertySaveBehavior.Ignore, + afterSaveBehavior: PropertySaveBehavior.Ignore); + + var key = runtimeEntityType.AddKey( + new[] { derivedsId, derivedsAlternateId, principalsId, principalsAlternateId }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { principalsId, principalsAlternateId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DerivedsId"), declaringEntityType.FindProperty("DerivedsAlternateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id"), principalEntityType.FindProperty("AlternateId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalsId"), declaringEntityType.FindProperty("PrincipalsAlternateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id"), principalEntityType.FindProperty("AlternateId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.ClientCascade, + required: true); + + runtimeForeignKey.AddAnnotation("Relational:Name", "FK_PrincipalBasePrincipalDerived>_Princip~1"); + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "PrincipalBasePrincipalDerived>"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalDerivedEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalDerivedEntityType.cs new file mode 100644 index 00000000..757c5ab1 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/No_NativeAOT/PrincipalDerivedEntityType.cs @@ -0,0 +1,84 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class PrincipalDerivedEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived>", + typeof(CompiledModelTestBase.PrincipalDerived>), + baseEntityType, + discriminatorValue: "PrincipalDerived>", + propertyCount: 0, + navigationCount: 2, + skipNavigationCount: 1, + foreignKeyCount: 1); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("Id"), declaringEntityType.FindProperty("AlternateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id"), principalEntityType.FindProperty("AlternateId") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true); + + return runtimeForeignKey; + } + + public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType declaringEntityType, RuntimeEntityType targetEntityType, RuntimeEntityType joinEntityType) + { + var skipNavigation = declaringEntityType.AddSkipNavigation( + "Principals", + targetEntityType, + joinEntityType.FindForeignKey( + new[] { joinEntityType.FindProperty("DerivedsId"), joinEntityType.FindProperty("DerivedsAlternateId") }, + declaringEntityType.FindKey(new[] { declaringEntityType.FindProperty("Id"), declaringEntityType.FindProperty("AlternateId") }), + declaringEntityType), + true, + false, + typeof(ICollection), + propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Principals", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var inverse = targetEntityType.FindSkipNavigation("Deriveds"); + if (inverse != null) + { + skipNavigation.Inverse = inverse; + inverse.Inverse = skipNavigation; + } + + return skipNavigation; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "PrincipalDerived"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextAssemblyAttributes.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextAssemblyAttributes.cs new file mode 100644 index 00000000..c224873f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using TestNamespace; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(DbContext), typeof(DbContextModel))] diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextModel.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextModel.cs new file mode 100644 index 00000000..583ee4d9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextModel.cs @@ -0,0 +1,48 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [DbContext(typeof(DbContext))] + public partial class DbContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static DbContextModel() + { + var model = new DbContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (DbContextModel)model.FinalizeModel(); + } + + private static DbContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextModelBuilder.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextModelBuilder.cs new file mode 100644 index 00000000..a0e11d88 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Sequences/DbContextModelBuilder.cs @@ -0,0 +1,49 @@ +// +using System; +using System.Collections.Generic; +using EntityFrameworkCore.Jet.Metadata; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public partial class DbContextModel + { + private DbContextModel() + : base(skipDetectChanges: true, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 0) + { + } + + partial void Initialize() + { + var sequences = new Dictionary<(string, string), ISequence>(); + var @long = new RuntimeSequence( + "Long", + this, + typeof(long), + startValue: -4L, + incrementBy: 2, + cyclic: true, + minValue: -2L, + maxValue: 2L); + + sequences[("Long", null)] = @long; + + AddAnnotation("Relational:Sequences", sequences); + AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + AddAnnotation("Relational:MaxIdentifierLength", 64); + AddRuntimeAnnotation("Relational:RelationalModelFactory", () => CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextAssemblyAttributes.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextAssemblyAttributes.cs new file mode 100644 index 00000000..c224873f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using TestNamespace; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(DbContext), typeof(DbContextModel))] diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextModel.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextModel.cs new file mode 100644 index 00000000..583ee4d9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextModel.cs @@ -0,0 +1,48 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [DbContext(typeof(DbContext))] + public partial class DbContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static DbContextModel() + { + var model = new DbContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (DbContextModel)model.FinalizeModel(); + } + + private static DbContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextModelBuilder.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextModelBuilder.cs new file mode 100644 index 00000000..c00ccf15 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DbContextModelBuilder.cs @@ -0,0 +1,87 @@ +// +using System; +using System.Collections.Generic; +using EntityFrameworkCore.Jet.Metadata; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Update.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public partial class DbContextModel + { + private DbContextModel() + : base(skipDetectChanges: false, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 1) + { + } + + partial void Initialize() + { + var dependentDerived = DependentDerivedEntityType.Create(this); + + DependentDerivedEntityType.CreateAnnotations(dependentDerived); + + AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + AddAnnotation("Relational:MaxIdentifierLength", 64); + AddRuntimeAnnotation("Relational:RelationalModelFactory", () => CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var dependentDerived = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentDerived")!; + + var defaultTableMappings = new List>(); + dependentDerived.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentDerived", null, relationalModel); + var dataColumnBase = new ColumnBase("Data", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintTableBase.Columns.Add("Data", dataColumnBase); + var idColumnBase = new ColumnBase("Id", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintTableBase.Columns.Add("Id", idColumnBase); + relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentDerived", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintTableBase); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintMappingBase = new TableMappingBase(dependentDerived, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintTableBase, null); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintMappingBase, false); + defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, dependentDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)dataColumnBase, dependentDerived.FindProperty("Data")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentDerivedintMappingBase); + + var tableMappings = new List(); + dependentDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var dependentDerivedintTable = new Table("DependentDerived", null, relationalModel); + var idColumn = new Column("Id", "integer", dependentDerivedintTable); + dependentDerivedintTable.Columns.Add("Id", idColumn); + idColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(idColumn); + var dataColumn = new Column("Data", "varchar(255)", dependentDerivedintTable) + { + IsNullable = true + }; + dependentDerivedintTable.Columns.Add("Data", dataColumn); + dataColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(dataColumn); + relationalModel.Tables.Add(("DependentDerived", null), dependentDerivedintTable); + var dependentDerivedintTableMapping = new TableMapping(dependentDerived, dependentDerivedintTable, null); + dependentDerivedintTable.AddTypeMapping(dependentDerivedintTableMapping, false); + tableMappings.Add(dependentDerivedintTableMapping); + RelationalModel.CreateColumnMapping(idColumn, dependentDerived.FindProperty("Id")!, dependentDerivedintTableMapping); + RelationalModel.CreateColumnMapping(dataColumn, dependentDerived.FindProperty("Data")!, dependentDerivedintTableMapping); + var pK_DependentDerivedint = new UniqueConstraint("PK_DependentDerived", dependentDerivedintTable, new[] { idColumn }); + dependentDerivedintTable.PrimaryKey = pK_DependentDerivedint; + pK_DependentDerivedint.SetRowKeyValueFactory(new SimpleRowKeyValueFactory(pK_DependentDerivedint)); + var pK_DependentDerivedintKey = RelationalModel.GetKey(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentDerived", + new[] { "Id" }); + pK_DependentDerivedint.MappedKeys.Add(pK_DependentDerivedintKey); + RelationalModel.GetOrCreateUniqueConstraints(pK_DependentDerivedintKey).Add(pK_DependentDerivedint); + dependentDerivedintTable.UniqueConstraints.Add("PK_DependentDerived", pK_DependentDerivedint); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentBaseUnsafeAccessors.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentBaseUnsafeAccessors.cs new file mode 100644 index 00000000..ae6e1779 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentBaseUnsafeAccessors.cs @@ -0,0 +1,15 @@ +// +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public static class DependentBaseUnsafeAccessors + { + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref TKey Id(CompiledModelTestBase.DependentBase @this); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentDerivedEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentDerivedEntityType.cs new file mode 100644 index 00000000..b743cb00 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentDerivedEntityType.cs @@ -0,0 +1,183 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class DependentDerivedEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentDerived", + typeof(CompiledModelTestBase.DependentDerived), + baseEntityType, + propertyCount: 2, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(CompiledModelTestBase.AbstractBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + id.SetGetter( + int (CompiledModelTestBase.DependentDerived instance) => DependentBaseUnsafeAccessors.Id(instance), + bool (CompiledModelTestBase.DependentDerived instance) => DependentBaseUnsafeAccessors.Id(instance) == 0); + id.SetSetter( + CompiledModelTestBase.DependentDerived (CompiledModelTestBase.DependentDerived instance, int value) => + { + DependentBaseUnsafeAccessors.Id(instance) = value; + return instance; + }); + id.SetMaterializationSetter( + CompiledModelTestBase.DependentDerived (CompiledModelTestBase.DependentDerived instance, int value) => + { + DependentBaseUnsafeAccessors.Id(instance) = value; + return instance; + }); + id.SetAccessors( + int (IInternalEntry entry) => DependentBaseUnsafeAccessors.Id(((CompiledModelTestBase.DependentDerived)(entry.Entity))), + int (IInternalEntry entry) => DependentBaseUnsafeAccessors.Id(((CompiledModelTestBase.DependentDerived)(entry.Entity))), + int (IInternalEntry entry) => entry.ReadOriginalValue(id, 0), + int (IInternalEntry entry) => ((InternalEntityEntry)entry).ReadRelationshipSnapshotValue(id, 0)); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: -1); + id.TypeMapping = JetIntTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + keyComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + providerValueComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); + + var data = runtimeEntityType.AddProperty( + "Data", + typeof(string), + propertyInfo: typeof(CompiledModelTestBase.DependentDerived).GetProperty("Data", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.DependentDerived).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + data.SetGetter( + string (CompiledModelTestBase.DependentDerived instance) => DependentDerivedUnsafeAccessors.Data(instance), + bool (CompiledModelTestBase.DependentDerived instance) => DependentDerivedUnsafeAccessors.Data(instance) == null); + data.SetSetter( + CompiledModelTestBase.DependentDerived (CompiledModelTestBase.DependentDerived instance, string value) => + { + DependentDerivedUnsafeAccessors.Data(instance) = value; + return instance; + }); + data.SetMaterializationSetter( + CompiledModelTestBase.DependentDerived (CompiledModelTestBase.DependentDerived instance, string value) => + { + DependentDerivedUnsafeAccessors.Data(instance) = value; + return instance; + }); + data.SetAccessors( + string (IInternalEntry entry) => DependentDerivedUnsafeAccessors.Data(((CompiledModelTestBase.DependentDerived)(entry.Entity))), + string (IInternalEntry entry) => DependentDerivedUnsafeAccessors.Data(((CompiledModelTestBase.DependentDerived)(entry.Entity))), + string (IInternalEntry entry) => entry.ReadOriginalValue(data, 1), + string (IInternalEntry entry) => entry.GetCurrentValue(data)); + data.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + data.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + var id = runtimeEntityType.FindProperty("Id"); + var data = runtimeEntityType.FindProperty("Data"); + var key = runtimeEntityType.FindKey(new[] { id }); + key.SetPrincipalKeyValueFactory(KeyValueFactoryFactory.CreateSimpleNonNullableFactory(key)); + key.SetIdentityMapFactory(IdentityMapFactoryFactory.CreateFactory(key)); + runtimeEntityType.SetOriginalValuesFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.DependentDerived)(source.Entity)); + return ((ISnapshot)(new Snapshot(((ValueComparer)(((IProperty)id).GetValueComparer())).Snapshot(source.GetCurrentValue(id)), (source.GetCurrentValue(data) == null ? null : ((ValueComparer)(((IProperty)data).GetValueComparer())).Snapshot(source.GetCurrentValue(data)))))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + ISnapshot () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + ISnapshot (IInternalEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + ISnapshot (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + ISnapshot () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.DependentDerived)(source.Entity)); + return ((ISnapshot)(new Snapshot(((ValueComparer)(((IProperty)id).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(id))))); + }); + runtimeEntityType.SetCounts(new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + complexCollectionCount: 0, + originalValueCount: 2, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 0)); + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "DependentDerived"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentDerivedUnsafeAccessors.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentDerivedUnsafeAccessors.cs new file mode 100644 index 00000000..8847446b --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/SimpleModel/DependentDerivedUnsafeAccessors.cs @@ -0,0 +1,16 @@ +// +using System; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public static class DependentDerivedUnsafeAccessors + { + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref string Data(CompiledModelTestBase.DependentDerived @this); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextAssemblyAttributes.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextAssemblyAttributes.cs new file mode 100644 index 00000000..c224873f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using TestNamespace; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(DbContext), typeof(DbContextModel))] diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextModel.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextModel.cs new file mode 100644 index 00000000..583ee4d9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextModel.cs @@ -0,0 +1,48 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [DbContext(typeof(DbContext))] + public partial class DbContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static DbContextModel() + { + var model = new DbContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (DbContextModel)model.FinalizeModel(); + } + + private static DbContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextModelBuilder.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextModelBuilder.cs new file mode 100644 index 00000000..26e83a66 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DbContextModelBuilder.cs @@ -0,0 +1,1124 @@ +// +using System; +using System.Collections.Generic; +using EntityFrameworkCore.Jet.Metadata; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Update.Internal; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public partial class DbContextModel + { + private DbContextModel() + : base(skipDetectChanges: false, modelId: new Guid("00000000-0000-0000-0000-000000000000"), entityTypeCount: 3) + { + } + + partial void Initialize() + { + var dependentBase = DependentBaseEntityType.Create(this); + var principalBase = PrincipalBaseEntityType.Create(this); + var principalDerived = PrincipalDerivedEntityType.Create(this, principalBase); + + DependentBaseEntityType.CreateForeignKey1(dependentBase, principalDerived); + PrincipalBaseEntityType.CreateForeignKey1(principalBase, principalBase); + PrincipalBaseEntityType.CreateForeignKey2(principalBase, principalDerived); + + DependentBaseEntityType.CreateAnnotations(dependentBase); + PrincipalBaseEntityType.CreateAnnotations(principalBase); + PrincipalDerivedEntityType.CreateAnnotations(principalDerived); + + AddAnnotation("Jet:ValueGenerationStrategy", JetValueGenerationStrategy.IdentityColumn); + AddAnnotation("Relational:DefaultSchema", "TPC"); + AddAnnotation("Relational:MaxIdentifierLength", 64); + AddRuntimeAnnotation("Relational:RelationalModelFactory", () => CreateRelationalModel()); + } + + private IRelationalModel CreateRelationalModel() + { + var relationalModel = new RelationalModel(this); + + var dependentBase = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase")!; + + var defaultTableMappings = new List>(); + dependentBase.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase", null, relationalModel); + var idColumnBase = new ColumnBase("Id", "byte", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("Id", idColumnBase); + var principalIdColumnBase = new ColumnBase("PrincipalId", "decimal(20,0)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("PrincipalId", principalIdColumnBase); + relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase = new TableMappingBase(dependentBase, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase, null); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase, false); + defaultTableMappings.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase, dependentBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalIdColumnBase, dependentBase.FindProperty("PrincipalId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + + var tableMappings = new List(); + dependentBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings); + var dependentBasebyteTable = new Table("DependentBase", "TPC", relationalModel); + var idColumn = new Column("Id", "byte", dependentBasebyteTable); + dependentBasebyteTable.Columns.Add("Id", idColumn); + idColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(idColumn); + var principalIdColumn = new Column("PrincipalId", "decimal(20,0)", dependentBasebyteTable) + { + IsNullable = true + }; + dependentBasebyteTable.Columns.Add("PrincipalId", principalIdColumn); + principalIdColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(principalIdColumn); + relationalModel.Tables.Add(("DependentBase", "TPC"), dependentBasebyteTable); + var dependentBasebyteTableMapping = new TableMapping(dependentBase, dependentBasebyteTable, null); + dependentBasebyteTable.AddTypeMapping(dependentBasebyteTableMapping, false); + tableMappings.Add(dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(idColumn, dependentBase.FindProperty("Id")!, dependentBasebyteTableMapping); + RelationalModel.CreateColumnMapping(principalIdColumn, dependentBase.FindProperty("PrincipalId")!, dependentBasebyteTableMapping); + var pK_DependentBasebyte = new UniqueConstraint("PK_DependentBase", dependentBasebyteTable, new[] { idColumn }); + dependentBasebyteTable.PrimaryKey = pK_DependentBasebyte; + pK_DependentBasebyte.SetRowKeyValueFactory(new SimpleRowKeyValueFactory(pK_DependentBasebyte)); + var pK_DependentBasebyteKey = RelationalModel.GetKey(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase", + new[] { "Id" }); + pK_DependentBasebyte.MappedKeys.Add(pK_DependentBasebyteKey); + RelationalModel.GetOrCreateUniqueConstraints(pK_DependentBasebyteKey).Add(pK_DependentBasebyte); + dependentBasebyteTable.UniqueConstraints.Add("PK_DependentBase", pK_DependentBasebyte); + var iX_DependentBasebyte_PrincipalId = new TableIndex( + "IX_DependentBase_PrincipalId", dependentBasebyteTable, new[] { principalIdColumn }, true); + iX_DependentBasebyte_PrincipalId.SetRowIndexValueFactory(new SimpleRowIndexValueFactory(iX_DependentBasebyte_PrincipalId)); + var iX_DependentBasebyte_PrincipalIdIx = RelationalModel.GetIndex(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase", + new[] { "PrincipalId" }); + iX_DependentBasebyte_PrincipalId.MappedIndexes.Add(iX_DependentBasebyte_PrincipalIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_DependentBasebyte_PrincipalIdIx).Add(iX_DependentBasebyte_PrincipalId); + dependentBasebyteTable.Indexes.Add("IX_DependentBase_PrincipalId", iX_DependentBasebyte_PrincipalId); + + var principalBase = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase")!; + + var defaultTableMappings0 = new List>(); + principalBase.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings0); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", null, relationalModel); + var enum1ColumnBase = new ColumnBase("Enum1", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("Enum1", enum1ColumnBase); + var enum2ColumnBase = new ColumnBase("Enum2", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("Enum2", enum2ColumnBase); + var flagsEnum1ColumnBase = new ColumnBase("FlagsEnum1", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("FlagsEnum1", flagsEnum1ColumnBase); + var flagsEnum2ColumnBase = new ColumnBase("FlagsEnum2", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("FlagsEnum2", flagsEnum2ColumnBase); + var idColumnBase0 = new ColumnBase("Id", "decimal(20,0)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("Id", idColumnBase0); + var principalBaseIdColumnBase = new ColumnBase("PrincipalBaseId", "decimal(20,0)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("PrincipalBaseId", principalBaseIdColumnBase); + var principalDerivedDependentBasebyteIdColumnBase = new ColumnBase("PrincipalDerived>Id", "decimal(20,0)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("PrincipalDerived>Id", principalDerivedDependentBasebyteIdColumnBase); + var refTypeArrayColumnBase = new ColumnBase("RefTypeArray", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("RefTypeArray", refTypeArrayColumnBase); + var refTypeEnumerableColumnBase = new ColumnBase("RefTypeEnumerable", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("RefTypeEnumerable", refTypeEnumerableColumnBase); + var refTypeIListColumnBase = new ColumnBase("RefTypeIList", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("RefTypeIList", refTypeIListColumnBase); + var refTypeListColumnBase = new ColumnBase("RefTypeList", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("RefTypeList", refTypeListColumnBase); + var valueTypeArrayColumnBase = new ColumnBase("ValueTypeArray", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("ValueTypeArray", valueTypeArrayColumnBase); + var valueTypeEnumerableColumnBase = new ColumnBase("ValueTypeEnumerable", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableColumnBase); + var valueTypeIListColumnBase = new ColumnBase("ValueTypeIList", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("ValueTypeIList", valueTypeIListColumnBase); + var valueTypeListColumnBase = new ColumnBase("ValueTypeList", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.Columns.Add("ValueTypeList", valueTypeListColumnBase); + relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase = new TableMappingBase(principalBase, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase, false); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase, false); + defaultTableMappings0.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase0, principalBase.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase, principalBase.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase, principalBase.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase, principalBase.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase, principalBase.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalBaseIdColumnBase, principalBase.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalDerivedDependentBasebyteIdColumnBase, principalBase.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)refTypeArrayColumnBase, principalBase.FindProperty("RefTypeArray")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)refTypeEnumerableColumnBase, principalBase.FindProperty("RefTypeEnumerable")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)refTypeIListColumnBase, principalBase.FindProperty("RefTypeIList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)refTypeListColumnBase, principalBase.FindProperty("RefTypeList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueTypeArrayColumnBase, principalBase.FindProperty("ValueTypeArray")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueTypeEnumerableColumnBase, principalBase.FindProperty("ValueTypeEnumerable")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueTypeIListColumnBase, principalBase.FindProperty("ValueTypeIList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueTypeListColumnBase, principalBase.FindProperty("ValueTypeList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalBaseMappingBase); + + var tableMappings0 = new List(); + principalBase.SetRuntimeAnnotation("Relational:TableMappings", tableMappings0); + var principalBaseTable = new Table("PrincipalBase", "TPC", relationalModel); + var idColumn0 = new Column("Id", "decimal(20,0)", principalBaseTable); + principalBaseTable.Columns.Add("Id", idColumn0); + idColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(idColumn0); + var enum1Column = new Column("Enum1", "integer", principalBaseTable); + principalBaseTable.Columns.Add("Enum1", enum1Column); + enum1Column.Accessors = ColumnAccessorsFactory.CreateGeneric(enum1Column); + var enum2Column = new Column("Enum2", "integer", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("Enum2", enum2Column); + enum2Column.Accessors = ColumnAccessorsFactory.CreateGeneric(enum2Column); + var flagsEnum1Column = new Column("FlagsEnum1", "integer", principalBaseTable); + principalBaseTable.Columns.Add("FlagsEnum1", flagsEnum1Column); + flagsEnum1Column.Accessors = ColumnAccessorsFactory.CreateGeneric(flagsEnum1Column); + var flagsEnum2Column = new Column("FlagsEnum2", "integer", principalBaseTable); + principalBaseTable.Columns.Add("FlagsEnum2", flagsEnum2Column); + flagsEnum2Column.Accessors = ColumnAccessorsFactory.CreateGeneric(flagsEnum2Column); + var principalBaseIdColumn = new Column("PrincipalBaseId", "decimal(20,0)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("PrincipalBaseId", principalBaseIdColumn); + principalBaseIdColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(principalBaseIdColumn); + var principalDerivedDependentBasebyteIdColumn = new Column("PrincipalDerived>Id", "decimal(20,0)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("PrincipalDerived>Id", principalDerivedDependentBasebyteIdColumn); + principalDerivedDependentBasebyteIdColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(principalDerivedDependentBasebyteIdColumn); + var refTypeArrayColumn = new Column("RefTypeArray", "varchar(255)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("RefTypeArray", refTypeArrayColumn); + refTypeArrayColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(refTypeArrayColumn); + var refTypeEnumerableColumn = new Column("RefTypeEnumerable", "varchar(255)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("RefTypeEnumerable", refTypeEnumerableColumn); + refTypeEnumerableColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(refTypeEnumerableColumn); + var refTypeIListColumn = new Column("RefTypeIList", "varchar(255)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("RefTypeIList", refTypeIListColumn); + refTypeIListColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(refTypeIListColumn); + var refTypeListColumn = new Column("RefTypeList", "varchar(255)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("RefTypeList", refTypeListColumn); + refTypeListColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(refTypeListColumn); + var valueTypeArrayColumn = new Column("ValueTypeArray", "varchar(255)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("ValueTypeArray", valueTypeArrayColumn); + valueTypeArrayColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(valueTypeArrayColumn); + var valueTypeEnumerableColumn = new Column("ValueTypeEnumerable", "varchar(255)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableColumn); + valueTypeEnumerableColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(valueTypeEnumerableColumn); + var valueTypeIListColumn = new Column("ValueTypeIList", "varchar(255)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("ValueTypeIList", valueTypeIListColumn); + valueTypeIListColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(valueTypeIListColumn); + var valueTypeListColumn = new Column("ValueTypeList", "varchar(255)", principalBaseTable) + { + IsNullable = true + }; + principalBaseTable.Columns.Add("ValueTypeList", valueTypeListColumn); + valueTypeListColumn.Accessors = ColumnAccessorsFactory.CreateGeneric(valueTypeListColumn); + relationalModel.Tables.Add(("PrincipalBase", "TPC"), principalBaseTable); + var principalBaseTableMapping = new TableMapping(principalBase, principalBaseTable, false); + principalBaseTable.AddTypeMapping(principalBaseTableMapping, false); + tableMappings0.Add(principalBaseTableMapping); + RelationalModel.CreateColumnMapping(idColumn0, principalBase.FindProperty("Id")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(enum1Column, principalBase.FindProperty("Enum1")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(enum2Column, principalBase.FindProperty("Enum2")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(flagsEnum1Column, principalBase.FindProperty("FlagsEnum1")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(flagsEnum2Column, principalBase.FindProperty("FlagsEnum2")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(principalBaseIdColumn, principalBase.FindProperty("PrincipalBaseId")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(principalDerivedDependentBasebyteIdColumn, principalBase.FindProperty("PrincipalDerivedId")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(refTypeArrayColumn, principalBase.FindProperty("RefTypeArray")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(refTypeEnumerableColumn, principalBase.FindProperty("RefTypeEnumerable")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(refTypeIListColumn, principalBase.FindProperty("RefTypeIList")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(refTypeListColumn, principalBase.FindProperty("RefTypeList")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(valueTypeArrayColumn, principalBase.FindProperty("ValueTypeArray")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(valueTypeEnumerableColumn, principalBase.FindProperty("ValueTypeEnumerable")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(valueTypeIListColumn, principalBase.FindProperty("ValueTypeIList")!, principalBaseTableMapping); + RelationalModel.CreateColumnMapping(valueTypeListColumn, principalBase.FindProperty("ValueTypeList")!, principalBaseTableMapping); + var pK_PrincipalBase = new UniqueConstraint("PK_PrincipalBase", principalBaseTable, new[] { idColumn0 }); + principalBaseTable.PrimaryKey = pK_PrincipalBase; + pK_PrincipalBase.SetRowKeyValueFactory(new SimpleRowKeyValueFactory(pK_PrincipalBase)); + var pK_PrincipalBaseKey = RelationalModel.GetKey(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", + new[] { "Id" }); + pK_PrincipalBase.MappedKeys.Add(pK_PrincipalBaseKey); + RelationalModel.GetOrCreateUniqueConstraints(pK_PrincipalBaseKey).Add(pK_PrincipalBase); + principalBaseTable.UniqueConstraints.Add("PK_PrincipalBase", pK_PrincipalBase); + var iX_PrincipalBase_PrincipalDerivedDependentBasebyteId = new TableIndex( + "IX_PrincipalBase_PrincipalDerived>Id", principalBaseTable, new[] { principalDerivedDependentBasebyteIdColumn }, false); + iX_PrincipalBase_PrincipalDerivedDependentBasebyteId.SetRowIndexValueFactory(new SimpleRowIndexValueFactory(iX_PrincipalBase_PrincipalDerivedDependentBasebyteId)); + var iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx = RelationalModel.GetIndex(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", + new[] { "PrincipalDerivedId" }); + iX_PrincipalBase_PrincipalDerivedDependentBasebyteId.MappedIndexes.Add(iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx).Add(iX_PrincipalBase_PrincipalDerivedDependentBasebyteId); + principalBaseTable.Indexes.Add("IX_PrincipalBase_PrincipalDerived>Id", iX_PrincipalBase_PrincipalDerivedDependentBasebyteId); + var pIX = new TableIndex( + "PIX", principalBaseTable, new[] { principalBaseIdColumn }, true); + pIX.SetRowIndexValueFactory(new SimpleRowIndexValueFactory(pIX)); + var pIXIx = RelationalModel.GetIndex(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", + "PrincipalIndex"); + pIX.MappedIndexes.Add(pIXIx); + RelationalModel.GetOrCreateTableIndexes(pIXIx).Add(pIX); + principalBaseTable.Indexes.Add("PIX", pIX); + + var viewMappings = new List(); + principalBase.SetRuntimeAnnotation("Relational:ViewMappings", viewMappings); + var principalBaseViewView = new View("PrincipalBaseView", "TPC", relationalModel); + var enum1ViewColumn = new ViewColumn("Enum1", "integer", principalBaseViewView); + principalBaseViewView.Columns.Add("Enum1", enum1ViewColumn); + var enum2ViewColumn = new ViewColumn("Enum2", "integer", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("Enum2", enum2ViewColumn); + var flagsEnum1ViewColumn = new ViewColumn("FlagsEnum1", "integer", principalBaseViewView); + principalBaseViewView.Columns.Add("FlagsEnum1", flagsEnum1ViewColumn); + var flagsEnum2ViewColumn = new ViewColumn("FlagsEnum2", "integer", principalBaseViewView); + principalBaseViewView.Columns.Add("FlagsEnum2", flagsEnum2ViewColumn); + var idViewColumn = new ViewColumn("Id", "decimal(20,0)", principalBaseViewView); + principalBaseViewView.Columns.Add("Id", idViewColumn); + var principalBaseIdViewColumn = new ViewColumn("PrincipalBaseId", "decimal(20,0)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("PrincipalBaseId", principalBaseIdViewColumn); + var principalDerivedIdViewColumn = new ViewColumn("PrincipalDerivedId", "decimal(20,0)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("PrincipalDerivedId", principalDerivedIdViewColumn); + var refTypeArrayViewColumn = new ViewColumn("RefTypeArray", "varchar(255)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("RefTypeArray", refTypeArrayViewColumn); + var refTypeEnumerableViewColumn = new ViewColumn("RefTypeEnumerable", "varchar(255)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("RefTypeEnumerable", refTypeEnumerableViewColumn); + var refTypeIListViewColumn = new ViewColumn("RefTypeIList", "varchar(255)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("RefTypeIList", refTypeIListViewColumn); + var refTypeListViewColumn = new ViewColumn("RefTypeList", "varchar(255)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("RefTypeList", refTypeListViewColumn); + var valueTypeArrayViewColumn = new ViewColumn("ValueTypeArray", "varchar(255)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("ValueTypeArray", valueTypeArrayViewColumn); + var valueTypeEnumerableViewColumn = new ViewColumn("ValueTypeEnumerable", "varchar(255)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableViewColumn); + var valueTypeIListViewColumn = new ViewColumn("ValueTypeIList", "varchar(255)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("ValueTypeIList", valueTypeIListViewColumn); + var valueTypeListViewColumn = new ViewColumn("ValueTypeList", "varchar(255)", principalBaseViewView) + { + IsNullable = true + }; + principalBaseViewView.Columns.Add("ValueTypeList", valueTypeListViewColumn); + relationalModel.Views.Add(("PrincipalBaseView", "TPC"), principalBaseViewView); + var principalBaseViewViewMapping = new ViewMapping(principalBase, principalBaseViewView, false); + principalBaseViewView.AddTypeMapping(principalBaseViewViewMapping, false); + viewMappings.Add(principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(idViewColumn, principalBase.FindProperty("Id")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(enum1ViewColumn, principalBase.FindProperty("Enum1")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(enum2ViewColumn, principalBase.FindProperty("Enum2")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(flagsEnum1ViewColumn, principalBase.FindProperty("FlagsEnum1")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(flagsEnum2ViewColumn, principalBase.FindProperty("FlagsEnum2")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(principalBaseIdViewColumn, principalBase.FindProperty("PrincipalBaseId")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(principalDerivedIdViewColumn, principalBase.FindProperty("PrincipalDerivedId")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(refTypeArrayViewColumn, principalBase.FindProperty("RefTypeArray")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(refTypeEnumerableViewColumn, principalBase.FindProperty("RefTypeEnumerable")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(refTypeIListViewColumn, principalBase.FindProperty("RefTypeIList")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(refTypeListViewColumn, principalBase.FindProperty("RefTypeList")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(valueTypeArrayViewColumn, principalBase.FindProperty("ValueTypeArray")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(valueTypeEnumerableViewColumn, principalBase.FindProperty("ValueTypeEnumerable")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(valueTypeIListViewColumn, principalBase.FindProperty("ValueTypeIList")!, principalBaseViewViewMapping); + RelationalModel.CreateViewColumnMapping(valueTypeListViewColumn, principalBase.FindProperty("ValueTypeList")!, principalBaseViewViewMapping); + + var deleteSprocMappings = new List(); + principalBase.SetRuntimeAnnotation("Relational:DeleteStoredProcedureMappings", deleteSprocMappings); + var principalBase_DeleteStoreSproc = new StoreStoredProcedure("PrincipalBase_Delete", "TPC", relationalModel); + var id_OriginalParameter = new StoreStoredProcedureParameter("Id_Original", "decimal(20,0)", 0, principalBase_DeleteStoreSproc, System.Data.ParameterDirection.Input); + principalBase_DeleteStoreSproc.AddParameter(id_OriginalParameter); + var rowsAffectedParameter = new StoreStoredProcedureParameter("RowsAffected", "integer", 1, principalBase_DeleteStoreSproc, System.Data.ParameterDirection.Output); + principalBase_DeleteStoreSproc.AddParameter(rowsAffectedParameter); + principalBase_DeleteStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalBase.GetDeleteStoredProcedure()!); + relationalModel.StoredProcedures.Add(("PrincipalBase_Delete", "TPC"), principalBase_DeleteStoreSproc); + var principalBase_DeleteDSproc = (IRuntimeStoredProcedure)principalBase.GetDeleteStoredProcedure()!; + var principalBase_DeleteSprocMapping = new StoredProcedureMapping(principalBase, principalBase_DeleteStoreSproc, principalBase_DeleteDSproc, principalBaseTableMapping, false); + principalBase_DeleteStoreSproc.AddTypeMapping(principalBase_DeleteSprocMapping, false); + deleteSprocMappings.Add(principalBase_DeleteSprocMapping); + principalBaseTableMapping.DeleteStoredProcedureMapping = principalBase_DeleteSprocMapping; + RelationalModel.CreateStoredProcedureParameterMapping(id_OriginalParameter, principalBase_DeleteDSproc.FindParameter("Id_Original")!, principalBase.FindProperty("Id")!, principalBase_DeleteSprocMapping); + + var insertSprocMappings = new List(); + principalBase.SetRuntimeAnnotation("Relational:InsertStoredProcedureMappings", insertSprocMappings); + var principalBase_InsertStoreSproc = new StoreStoredProcedure("PrincipalBase_Insert", "TPC", relationalModel); + var idParameter = new StoreStoredProcedureParameter("Id", "decimal(20,0)", 0, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input); + principalBase_InsertStoreSproc.AddParameter(idParameter); + var principalBaseIdParameter = new StoreStoredProcedureParameter("PrincipalBaseId", "decimal(20,0)", 1, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(principalBaseIdParameter); + var principalDerivedIdParameter = new StoreStoredProcedureParameter("PrincipalDerivedId", "decimal(20,0)", 2, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(principalDerivedIdParameter); + var enum2Parameter = new StoreStoredProcedureParameter("Enum2", "integer", 3, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(enum2Parameter); + var flagsEnum1Parameter = new StoreStoredProcedureParameter("FlagsEnum1", "integer", 4, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input); + principalBase_InsertStoreSproc.AddParameter(flagsEnum1Parameter); + var flagsEnum2Parameter = new StoreStoredProcedureParameter("FlagsEnum2", "integer", 5, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input); + principalBase_InsertStoreSproc.AddParameter(flagsEnum2Parameter); + var valueTypeListParameter = new StoreStoredProcedureParameter("ValueTypeList", "varchar(255)", 6, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(valueTypeListParameter); + var valueTypeIListParameter = new StoreStoredProcedureParameter("ValueTypeIList", "varchar(255)", 7, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(valueTypeIListParameter); + var valueTypeArrayParameter = new StoreStoredProcedureParameter("ValueTypeArray", "varchar(255)", 8, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(valueTypeArrayParameter); + var valueTypeEnumerableParameter = new StoreStoredProcedureParameter("ValueTypeEnumerable", "varchar(255)", 9, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(valueTypeEnumerableParameter); + var refTypeListParameter = new StoreStoredProcedureParameter("RefTypeList", "varchar(255)", 10, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(refTypeListParameter); + var refTypeIListParameter = new StoreStoredProcedureParameter("RefTypeIList", "varchar(255)", 11, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(refTypeIListParameter); + var refTypeArrayParameter = new StoreStoredProcedureParameter("RefTypeArray", "varchar(255)", 12, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(refTypeArrayParameter); + var refTypeEnumerableParameter = new StoreStoredProcedureParameter("RefTypeEnumerable", "varchar(255)", 13, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_InsertStoreSproc.AddParameter(refTypeEnumerableParameter); + var baseEnumParameter = new StoreStoredProcedureParameter("BaseEnum", "integer", 14, principalBase_InsertStoreSproc, System.Data.ParameterDirection.Output); + principalBase_InsertStoreSproc.AddParameter(baseEnumParameter); + principalBase_InsertStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalBase.GetInsertStoredProcedure()!); + relationalModel.StoredProcedures.Add(("PrincipalBase_Insert", "TPC"), principalBase_InsertStoreSproc); + var principalBase_InsertISproc = (IRuntimeStoredProcedure)principalBase.GetInsertStoredProcedure()!; + var principalBase_InsertSprocMapping = new StoredProcedureMapping(principalBase, principalBase_InsertStoreSproc, principalBase_InsertISproc, principalBaseTableMapping, false); + principalBase_InsertStoreSproc.AddTypeMapping(principalBase_InsertSprocMapping, false); + insertSprocMappings.Add(principalBase_InsertSprocMapping); + principalBaseTableMapping.InsertStoredProcedureMapping = principalBase_InsertSprocMapping; + RelationalModel.CreateStoredProcedureParameterMapping(idParameter, principalBase_InsertISproc.FindParameter("Id")!, principalBase.FindProperty("Id")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(baseEnumParameter, principalBase_InsertISproc.FindParameter("BaseEnum")!, principalBase.FindProperty("Enum1")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(enum2Parameter, principalBase_InsertISproc.FindParameter("Enum2")!, principalBase.FindProperty("Enum2")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum1Parameter, principalBase_InsertISproc.FindParameter("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum2Parameter, principalBase_InsertISproc.FindParameter("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(principalBaseIdParameter, principalBase_InsertISproc.FindParameter("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(principalDerivedIdParameter, principalBase_InsertISproc.FindParameter("PrincipalDerivedId")!, principalBase.FindProperty("PrincipalDerivedId")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeArrayParameter, principalBase_InsertISproc.FindParameter("RefTypeArray")!, principalBase.FindProperty("RefTypeArray")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeEnumerableParameter, principalBase_InsertISproc.FindParameter("RefTypeEnumerable")!, principalBase.FindProperty("RefTypeEnumerable")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeIListParameter, principalBase_InsertISproc.FindParameter("RefTypeIList")!, principalBase.FindProperty("RefTypeIList")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeListParameter, principalBase_InsertISproc.FindParameter("RefTypeList")!, principalBase.FindProperty("RefTypeList")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeArrayParameter, principalBase_InsertISproc.FindParameter("ValueTypeArray")!, principalBase.FindProperty("ValueTypeArray")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeEnumerableParameter, principalBase_InsertISproc.FindParameter("ValueTypeEnumerable")!, principalBase.FindProperty("ValueTypeEnumerable")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeIListParameter, principalBase_InsertISproc.FindParameter("ValueTypeIList")!, principalBase.FindProperty("ValueTypeIList")!, principalBase_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeListParameter, principalBase_InsertISproc.FindParameter("ValueTypeList")!, principalBase.FindProperty("ValueTypeList")!, principalBase_InsertSprocMapping); + + var updateSprocMappings = new List(); + principalBase.SetRuntimeAnnotation("Relational:UpdateStoredProcedureMappings", updateSprocMappings); + var principalBase_UpdateStoreSproc = new StoreStoredProcedure("PrincipalBase_Update", "TPC", relationalModel); + var principalBaseIdParameter0 = new StoreStoredProcedureParameter("PrincipalBaseId", "decimal(20,0)", 0, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(principalBaseIdParameter0); + var principalDerivedIdParameter0 = new StoreStoredProcedureParameter("PrincipalDerivedId", "decimal(20,0)", 1, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(principalDerivedIdParameter0); + var enum1Parameter = new StoreStoredProcedureParameter("Enum1", "integer", 2, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input); + principalBase_UpdateStoreSproc.AddParameter(enum1Parameter); + var enum2Parameter0 = new StoreStoredProcedureParameter("Enum2", "integer", 3, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(enum2Parameter0); + var flagsEnum1Parameter0 = new StoreStoredProcedureParameter("FlagsEnum1", "integer", 4, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input); + principalBase_UpdateStoreSproc.AddParameter(flagsEnum1Parameter0); + var flagsEnum2Parameter0 = new StoreStoredProcedureParameter("FlagsEnum2", "integer", 5, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input); + principalBase_UpdateStoreSproc.AddParameter(flagsEnum2Parameter0); + var valueTypeListParameter0 = new StoreStoredProcedureParameter("ValueTypeList", "varchar(255)", 6, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(valueTypeListParameter0); + var valueTypeIListParameter0 = new StoreStoredProcedureParameter("ValueTypeIList", "varchar(255)", 7, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(valueTypeIListParameter0); + var valueTypeArrayParameter0 = new StoreStoredProcedureParameter("ValueTypeArray", "varchar(255)", 8, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(valueTypeArrayParameter0); + var valueTypeEnumerableParameter0 = new StoreStoredProcedureParameter("ValueTypeEnumerable", "varchar(255)", 9, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(valueTypeEnumerableParameter0); + var refTypeListParameter0 = new StoreStoredProcedureParameter("RefTypeList", "varchar(255)", 10, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(refTypeListParameter0); + var refTypeIListParameter0 = new StoreStoredProcedureParameter("RefTypeIList", "varchar(255)", 11, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(refTypeIListParameter0); + var refTypeArrayParameter0 = new StoreStoredProcedureParameter("RefTypeArray", "varchar(255)", 12, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(refTypeArrayParameter0); + var refTypeEnumerableParameter0 = new StoreStoredProcedureParameter("RefTypeEnumerable", "varchar(255)", 13, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + principalBase_UpdateStoreSproc.AddParameter(refTypeEnumerableParameter0); + var id_OriginalParameter0 = new StoreStoredProcedureParameter("Id_Original", "decimal(20,0)", 14, principalBase_UpdateStoreSproc, System.Data.ParameterDirection.Input); + principalBase_UpdateStoreSproc.AddParameter(id_OriginalParameter0); + principalBase_UpdateStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalBase.GetUpdateStoredProcedure()!); + relationalModel.StoredProcedures.Add(("PrincipalBase_Update", "TPC"), principalBase_UpdateStoreSproc); + var principalBase_UpdateUSproc = (IRuntimeStoredProcedure)principalBase.GetUpdateStoredProcedure()!; + var principalBase_UpdateSprocMapping = new StoredProcedureMapping(principalBase, principalBase_UpdateStoreSproc, principalBase_UpdateUSproc, principalBaseTableMapping, false); + principalBase_UpdateStoreSproc.AddTypeMapping(principalBase_UpdateSprocMapping, false); + updateSprocMappings.Add(principalBase_UpdateSprocMapping); + principalBaseTableMapping.UpdateStoredProcedureMapping = principalBase_UpdateSprocMapping; + RelationalModel.CreateStoredProcedureParameterMapping(id_OriginalParameter0, principalBase_UpdateUSproc.FindParameter("Id_Original")!, principalBase.FindProperty("Id")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(enum1Parameter, principalBase_UpdateUSproc.FindParameter("Enum1")!, principalBase.FindProperty("Enum1")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(enum2Parameter0, principalBase_UpdateUSproc.FindParameter("Enum2")!, principalBase.FindProperty("Enum2")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum1Parameter0, principalBase_UpdateUSproc.FindParameter("FlagsEnum1")!, principalBase.FindProperty("FlagsEnum1")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum2Parameter0, principalBase_UpdateUSproc.FindParameter("FlagsEnum2")!, principalBase.FindProperty("FlagsEnum2")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(principalBaseIdParameter0, principalBase_UpdateUSproc.FindParameter("PrincipalBaseId")!, principalBase.FindProperty("PrincipalBaseId")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(principalDerivedIdParameter0, principalBase_UpdateUSproc.FindParameter("PrincipalDerivedId")!, principalBase.FindProperty("PrincipalDerivedId")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeArrayParameter0, principalBase_UpdateUSproc.FindParameter("RefTypeArray")!, principalBase.FindProperty("RefTypeArray")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeEnumerableParameter0, principalBase_UpdateUSproc.FindParameter("RefTypeEnumerable")!, principalBase.FindProperty("RefTypeEnumerable")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeIListParameter0, principalBase_UpdateUSproc.FindParameter("RefTypeIList")!, principalBase.FindProperty("RefTypeIList")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeListParameter0, principalBase_UpdateUSproc.FindParameter("RefTypeList")!, principalBase.FindProperty("RefTypeList")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeArrayParameter0, principalBase_UpdateUSproc.FindParameter("ValueTypeArray")!, principalBase.FindProperty("ValueTypeArray")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeEnumerableParameter0, principalBase_UpdateUSproc.FindParameter("ValueTypeEnumerable")!, principalBase.FindProperty("ValueTypeEnumerable")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeIListParameter0, principalBase_UpdateUSproc.FindParameter("ValueTypeIList")!, principalBase.FindProperty("ValueTypeIList")!, principalBase_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeListParameter0, principalBase_UpdateUSproc.FindParameter("ValueTypeList")!, principalBase.FindProperty("ValueTypeList")!, principalBase_UpdateSprocMapping); + + var principalDerived = FindEntityType("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived>")!; + + var defaultTableMappings1 = new List>(); + principalDerived.SetRuntimeAnnotation("Relational:DefaultMappings", defaultTableMappings1); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase = new TableBase("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived>", null, relationalModel); + var enum1ColumnBase0 = new ColumnBase("Enum1", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("Enum1", enum1ColumnBase0); + var enum2ColumnBase0 = new ColumnBase("Enum2", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("Enum2", enum2ColumnBase0); + var flagsEnum1ColumnBase0 = new ColumnBase("FlagsEnum1", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("FlagsEnum1", flagsEnum1ColumnBase0); + var flagsEnum2ColumnBase0 = new ColumnBase("FlagsEnum2", "integer", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("FlagsEnum2", flagsEnum2ColumnBase0); + var idColumnBase1 = new ColumnBase("Id", "decimal(20,0)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("Id", idColumnBase1); + var principalBaseIdColumnBase0 = new ColumnBase("PrincipalBaseId", "decimal(20,0)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("PrincipalBaseId", principalBaseIdColumnBase0); + var principalDerivedDependentBasebyteIdColumnBase0 = new ColumnBase("PrincipalDerived>Id", "decimal(20,0)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("PrincipalDerived>Id", principalDerivedDependentBasebyteIdColumnBase0); + var refTypeArrayColumnBase0 = new ColumnBase("RefTypeArray", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("RefTypeArray", refTypeArrayColumnBase0); + var refTypeEnumerableColumnBase0 = new ColumnBase("RefTypeEnumerable", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("RefTypeEnumerable", refTypeEnumerableColumnBase0); + var refTypeIListColumnBase0 = new ColumnBase("RefTypeIList", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("RefTypeIList", refTypeIListColumnBase0); + var refTypeListColumnBase0 = new ColumnBase("RefTypeList", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("RefTypeList", refTypeListColumnBase0); + var valueTypeArrayColumnBase0 = new ColumnBase("ValueTypeArray", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("ValueTypeArray", valueTypeArrayColumnBase0); + var valueTypeEnumerableColumnBase0 = new ColumnBase("ValueTypeEnumerable", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableColumnBase0); + var valueTypeIListColumnBase0 = new ColumnBase("ValueTypeIList", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("ValueTypeIList", valueTypeIListColumnBase0); + var valueTypeListColumnBase0 = new ColumnBase("ValueTypeList", "varchar(255)", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase) + { + IsNullable = true + }; + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.Columns.Add("ValueTypeList", valueTypeListColumnBase0); + relationalModel.DefaultTables.Add("Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived>", microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase); + var microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase = new TableMappingBase(principalDerived, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase, null); + microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteTableBase.AddTypeMapping(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase, false); + defaultTableMappings1.Add(microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)idColumnBase1, principalDerived.FindProperty("Id")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum1ColumnBase0, principalDerived.FindProperty("Enum1")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)enum2ColumnBase0, principalDerived.FindProperty("Enum2")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum1ColumnBase0, principalDerived.FindProperty("FlagsEnum1")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)flagsEnum2ColumnBase0, principalDerived.FindProperty("FlagsEnum2")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalBaseIdColumnBase0, principalDerived.FindProperty("PrincipalBaseId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)principalDerivedDependentBasebyteIdColumnBase0, principalDerived.FindProperty("PrincipalDerivedId")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)refTypeArrayColumnBase0, principalDerived.FindProperty("RefTypeArray")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)refTypeEnumerableColumnBase0, principalDerived.FindProperty("RefTypeEnumerable")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)refTypeIListColumnBase0, principalDerived.FindProperty("RefTypeIList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)refTypeListColumnBase0, principalDerived.FindProperty("RefTypeList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueTypeArrayColumnBase0, principalDerived.FindProperty("ValueTypeArray")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueTypeEnumerableColumnBase0, principalDerived.FindProperty("ValueTypeEnumerable")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueTypeIListColumnBase0, principalDerived.FindProperty("ValueTypeIList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + RelationalModel.CreateColumnMapping((ColumnBase)valueTypeListColumnBase0, principalDerived.FindProperty("ValueTypeList")!, microsoftEntityFrameworkCoreScaffoldingCompiledModelTestBasePrincipalDerivedMicrosoftEntityFrameworkCoreScaffoldingCompiledModelTestBaseDependentBasebyteMappingBase); + + var tableMappings1 = new List(); + principalDerived.SetRuntimeAnnotation("Relational:TableMappings", tableMappings1); + var principalDerivedTable = new Table("PrincipalDerived", "TPC", relationalModel); + var idColumn1 = new Column("Id", "decimal(20,0)", principalDerivedTable); + principalDerivedTable.Columns.Add("Id", idColumn1); + idColumn1.Accessors = ColumnAccessorsFactory.CreateGeneric(idColumn1); + var enum1Column0 = new Column("Enum1", "integer", principalDerivedTable); + principalDerivedTable.Columns.Add("Enum1", enum1Column0); + enum1Column0.Accessors = ColumnAccessorsFactory.CreateGeneric(enum1Column0); + var enum2Column0 = new Column("Enum2", "integer", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("Enum2", enum2Column0); + enum2Column0.Accessors = ColumnAccessorsFactory.CreateGeneric(enum2Column0); + var flagsEnum1Column0 = new Column("FlagsEnum1", "integer", principalDerivedTable); + principalDerivedTable.Columns.Add("FlagsEnum1", flagsEnum1Column0); + flagsEnum1Column0.Accessors = ColumnAccessorsFactory.CreateGeneric(flagsEnum1Column0); + var flagsEnum2Column0 = new Column("FlagsEnum2", "integer", principalDerivedTable); + principalDerivedTable.Columns.Add("FlagsEnum2", flagsEnum2Column0); + flagsEnum2Column0.Accessors = ColumnAccessorsFactory.CreateGeneric(flagsEnum2Column0); + var principalBaseIdColumn0 = new Column("PrincipalBaseId", "decimal(20,0)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("PrincipalBaseId", principalBaseIdColumn0); + principalBaseIdColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(principalBaseIdColumn0); + var principalDerivedDependentBasebyteIdColumn0 = new Column("PrincipalDerived>Id", "decimal(20,0)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("PrincipalDerived>Id", principalDerivedDependentBasebyteIdColumn0); + principalDerivedDependentBasebyteIdColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(principalDerivedDependentBasebyteIdColumn0); + var refTypeArrayColumn0 = new Column("RefTypeArray", "varchar(255)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("RefTypeArray", refTypeArrayColumn0); + refTypeArrayColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(refTypeArrayColumn0); + var refTypeEnumerableColumn0 = new Column("RefTypeEnumerable", "varchar(255)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("RefTypeEnumerable", refTypeEnumerableColumn0); + refTypeEnumerableColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(refTypeEnumerableColumn0); + var refTypeIListColumn0 = new Column("RefTypeIList", "varchar(255)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("RefTypeIList", refTypeIListColumn0); + refTypeIListColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(refTypeIListColumn0); + var refTypeListColumn0 = new Column("RefTypeList", "varchar(255)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("RefTypeList", refTypeListColumn0); + refTypeListColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(refTypeListColumn0); + var valueTypeArrayColumn0 = new Column("ValueTypeArray", "varchar(255)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("ValueTypeArray", valueTypeArrayColumn0); + valueTypeArrayColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(valueTypeArrayColumn0); + var valueTypeEnumerableColumn0 = new Column("ValueTypeEnumerable", "varchar(255)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableColumn0); + valueTypeEnumerableColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(valueTypeEnumerableColumn0); + var valueTypeIListColumn0 = new Column("ValueTypeIList", "varchar(255)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("ValueTypeIList", valueTypeIListColumn0); + valueTypeIListColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(valueTypeIListColumn0); + var valueTypeListColumn0 = new Column("ValueTypeList", "varchar(255)", principalDerivedTable) + { + IsNullable = true + }; + principalDerivedTable.Columns.Add("ValueTypeList", valueTypeListColumn0); + valueTypeListColumn0.Accessors = ColumnAccessorsFactory.CreateGeneric(valueTypeListColumn0); + relationalModel.Tables.Add(("PrincipalDerived", "TPC"), principalDerivedTable); + var principalDerivedTableMapping = new TableMapping(principalDerived, principalDerivedTable, null); + principalDerivedTable.AddTypeMapping(principalDerivedTableMapping, false); + tableMappings1.Add(principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(idColumn1, principalDerived.FindProperty("Id")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(enum1Column0, principalDerived.FindProperty("Enum1")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(enum2Column0, principalDerived.FindProperty("Enum2")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(flagsEnum1Column0, principalDerived.FindProperty("FlagsEnum1")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(flagsEnum2Column0, principalDerived.FindProperty("FlagsEnum2")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(principalBaseIdColumn0, principalDerived.FindProperty("PrincipalBaseId")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(principalDerivedDependentBasebyteIdColumn0, principalDerived.FindProperty("PrincipalDerivedId")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(refTypeArrayColumn0, principalDerived.FindProperty("RefTypeArray")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(refTypeEnumerableColumn0, principalDerived.FindProperty("RefTypeEnumerable")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(refTypeIListColumn0, principalDerived.FindProperty("RefTypeIList")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(refTypeListColumn0, principalDerived.FindProperty("RefTypeList")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(valueTypeArrayColumn0, principalDerived.FindProperty("ValueTypeArray")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(valueTypeEnumerableColumn0, principalDerived.FindProperty("ValueTypeEnumerable")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(valueTypeIListColumn0, principalDerived.FindProperty("ValueTypeIList")!, principalDerivedTableMapping); + RelationalModel.CreateColumnMapping(valueTypeListColumn0, principalDerived.FindProperty("ValueTypeList")!, principalDerivedTableMapping); + var pK_PrincipalDerived = new UniqueConstraint("PK_PrincipalDerived", principalDerivedTable, new[] { idColumn1 }); + principalDerivedTable.PrimaryKey = pK_PrincipalDerived; + pK_PrincipalDerived.SetRowKeyValueFactory(new SimpleRowKeyValueFactory(pK_PrincipalDerived)); + pK_PrincipalDerived.MappedKeys.Add(pK_PrincipalBaseKey); + RelationalModel.GetOrCreateUniqueConstraints(pK_PrincipalBaseKey).Add(pK_PrincipalDerived); + principalDerivedTable.UniqueConstraints.Add("PK_PrincipalDerived", pK_PrincipalDerived); + var iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId = new TableIndex( + "IX_PrincipalDerived_PrincipalDerived>Id", principalDerivedTable, new[] { principalDerivedDependentBasebyteIdColumn0 }, false); + iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId.SetRowIndexValueFactory(new SimpleRowIndexValueFactory(iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId)); + iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId.MappedIndexes.Add(iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx); + RelationalModel.GetOrCreateTableIndexes(iX_PrincipalBase_PrincipalDerivedDependentBasebyteIdIx).Add(iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId); + principalDerivedTable.Indexes.Add("IX_PrincipalDerived_PrincipalDerived>Id", iX_PrincipalDerived_PrincipalDerivedDependentBasebyteId); + var pIX0 = new TableIndex( + "PIX", principalDerivedTable, new[] { principalBaseIdColumn0 }, true); + pIX0.SetRowIndexValueFactory(new SimpleRowIndexValueFactory(pIX0)); + pIX0.MappedIndexes.Add(pIXIx); + RelationalModel.GetOrCreateTableIndexes(pIXIx).Add(pIX0); + principalDerivedTable.Indexes.Add("PIX", pIX0); + + var viewMappings0 = new List(); + principalDerived.SetRuntimeAnnotation("Relational:ViewMappings", viewMappings0); + var principalDerivedViewView = new View("PrincipalDerivedView", "TPC", relationalModel); + var enum1ViewColumn0 = new ViewColumn("Enum1", "integer", principalDerivedViewView); + principalDerivedViewView.Columns.Add("Enum1", enum1ViewColumn0); + var enum2ViewColumn0 = new ViewColumn("Enum2", "integer", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("Enum2", enum2ViewColumn0); + var flagsEnum1ViewColumn0 = new ViewColumn("FlagsEnum1", "integer", principalDerivedViewView); + principalDerivedViewView.Columns.Add("FlagsEnum1", flagsEnum1ViewColumn0); + var flagsEnum2ViewColumn0 = new ViewColumn("FlagsEnum2", "integer", principalDerivedViewView); + principalDerivedViewView.Columns.Add("FlagsEnum2", flagsEnum2ViewColumn0); + var idViewColumn0 = new ViewColumn("Id", "decimal(20,0)", principalDerivedViewView); + principalDerivedViewView.Columns.Add("Id", idViewColumn0); + var principalBaseIdViewColumn0 = new ViewColumn("PrincipalBaseId", "decimal(20,0)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("PrincipalBaseId", principalBaseIdViewColumn0); + var principalDerivedIdViewColumn0 = new ViewColumn("PrincipalDerivedId", "decimal(20,0)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("PrincipalDerivedId", principalDerivedIdViewColumn0); + var refTypeArrayViewColumn0 = new ViewColumn("RefTypeArray", "varchar(255)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("RefTypeArray", refTypeArrayViewColumn0); + var refTypeEnumerableViewColumn0 = new ViewColumn("RefTypeEnumerable", "varchar(255)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("RefTypeEnumerable", refTypeEnumerableViewColumn0); + var refTypeIListViewColumn0 = new ViewColumn("RefTypeIList", "varchar(255)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("RefTypeIList", refTypeIListViewColumn0); + var refTypeListViewColumn0 = new ViewColumn("RefTypeList", "varchar(255)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("RefTypeList", refTypeListViewColumn0); + var valueTypeArrayViewColumn0 = new ViewColumn("ValueTypeArray", "varchar(255)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("ValueTypeArray", valueTypeArrayViewColumn0); + var valueTypeEnumerableViewColumn0 = new ViewColumn("ValueTypeEnumerable", "varchar(255)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("ValueTypeEnumerable", valueTypeEnumerableViewColumn0); + var valueTypeIListViewColumn0 = new ViewColumn("ValueTypeIList", "varchar(255)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("ValueTypeIList", valueTypeIListViewColumn0); + var valueTypeListViewColumn0 = new ViewColumn("ValueTypeList", "varchar(255)", principalDerivedViewView) + { + IsNullable = true + }; + principalDerivedViewView.Columns.Add("ValueTypeList", valueTypeListViewColumn0); + relationalModel.Views.Add(("PrincipalDerivedView", "TPC"), principalDerivedViewView); + var principalDerivedViewViewMapping = new ViewMapping(principalDerived, principalDerivedViewView, null); + principalDerivedViewView.AddTypeMapping(principalDerivedViewViewMapping, false); + viewMappings0.Add(principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(idViewColumn0, principalDerived.FindProperty("Id")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(enum1ViewColumn0, principalDerived.FindProperty("Enum1")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(enum2ViewColumn0, principalDerived.FindProperty("Enum2")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(flagsEnum1ViewColumn0, principalDerived.FindProperty("FlagsEnum1")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(flagsEnum2ViewColumn0, principalDerived.FindProperty("FlagsEnum2")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(principalBaseIdViewColumn0, principalDerived.FindProperty("PrincipalBaseId")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(principalDerivedIdViewColumn0, principalDerived.FindProperty("PrincipalDerivedId")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(refTypeArrayViewColumn0, principalDerived.FindProperty("RefTypeArray")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(refTypeEnumerableViewColumn0, principalDerived.FindProperty("RefTypeEnumerable")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(refTypeIListViewColumn0, principalDerived.FindProperty("RefTypeIList")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(refTypeListViewColumn0, principalDerived.FindProperty("RefTypeList")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(valueTypeArrayViewColumn0, principalDerived.FindProperty("ValueTypeArray")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(valueTypeEnumerableViewColumn0, principalDerived.FindProperty("ValueTypeEnumerable")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(valueTypeIListViewColumn0, principalDerived.FindProperty("ValueTypeIList")!, principalDerivedViewViewMapping); + RelationalModel.CreateViewColumnMapping(valueTypeListViewColumn0, principalDerived.FindProperty("ValueTypeList")!, principalDerivedViewViewMapping); + + var deleteSprocMappings0 = new List(); + principalDerived.SetRuntimeAnnotation("Relational:DeleteStoredProcedureMappings", deleteSprocMappings0); + var derived_DeleteStoreSproc = new StoreStoredProcedure("Derived_Delete", "TPC", relationalModel); + var id_OriginalParameter1 = new StoreStoredProcedureParameter("Id_Original", "decimal(20,0)", 0, derived_DeleteStoreSproc, System.Data.ParameterDirection.Input); + derived_DeleteStoreSproc.AddParameter(id_OriginalParameter1); + derived_DeleteStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalDerived.GetDeleteStoredProcedure()!); + relationalModel.StoredProcedures.Add(("Derived_Delete", "TPC"), derived_DeleteStoreSproc); + var derived_DeleteDSproc = (IRuntimeStoredProcedure)principalDerived.GetDeleteStoredProcedure()!; + var derived_DeleteSprocMapping = new StoredProcedureMapping(principalDerived, derived_DeleteStoreSproc, derived_DeleteDSproc, principalDerivedTableMapping, null); + derived_DeleteStoreSproc.AddTypeMapping(derived_DeleteSprocMapping, false); + deleteSprocMappings0.Add(derived_DeleteSprocMapping); + principalDerivedTableMapping.DeleteStoredProcedureMapping = derived_DeleteSprocMapping; + RelationalModel.CreateStoredProcedureParameterMapping(id_OriginalParameter1, derived_DeleteDSproc.FindParameter("Id_Original")!, principalDerived.FindProperty("Id")!, derived_DeleteSprocMapping); + + var insertSprocMappings0 = new List(); + principalDerived.SetRuntimeAnnotation("Relational:InsertStoredProcedureMappings", insertSprocMappings0); + var derived_InsertStoreSproc = new StoreStoredProcedure("Derived_Insert", "TPC", relationalModel); + var idParameter0 = new StoreStoredProcedureParameter("Id", "decimal(20,0)", 0, derived_InsertStoreSproc, System.Data.ParameterDirection.Input); + derived_InsertStoreSproc.AddParameter(idParameter0); + var principalBaseIdParameter1 = new StoreStoredProcedureParameter("PrincipalBaseId", "decimal(20,0)", 1, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(principalBaseIdParameter1); + var principalDerivedIdParameter1 = new StoreStoredProcedureParameter("PrincipalDerivedId", "decimal(20,0)", 2, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(principalDerivedIdParameter1); + var enum2Parameter1 = new StoreStoredProcedureParameter("Enum2", "integer", 3, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(enum2Parameter1); + var flagsEnum1Parameter1 = new StoreStoredProcedureParameter("FlagsEnum1", "integer", 4, derived_InsertStoreSproc, System.Data.ParameterDirection.Input); + derived_InsertStoreSproc.AddParameter(flagsEnum1Parameter1); + var flagsEnum2Parameter1 = new StoreStoredProcedureParameter("FlagsEnum2", "integer", 5, derived_InsertStoreSproc, System.Data.ParameterDirection.Input); + derived_InsertStoreSproc.AddParameter(flagsEnum2Parameter1); + var valueTypeListParameter1 = new StoreStoredProcedureParameter("ValueTypeList", "varchar(255)", 6, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(valueTypeListParameter1); + var valueTypeIListParameter1 = new StoreStoredProcedureParameter("ValueTypeIList", "varchar(255)", 7, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(valueTypeIListParameter1); + var valueTypeArrayParameter1 = new StoreStoredProcedureParameter("ValueTypeArray", "varchar(255)", 8, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(valueTypeArrayParameter1); + var valueTypeEnumerableParameter1 = new StoreStoredProcedureParameter("ValueTypeEnumerable", "varchar(255)", 9, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(valueTypeEnumerableParameter1); + var refTypeListParameter1 = new StoreStoredProcedureParameter("RefTypeList", "varchar(255)", 10, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(refTypeListParameter1); + var refTypeIListParameter1 = new StoreStoredProcedureParameter("RefTypeIList", "varchar(255)", 11, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(refTypeIListParameter1); + var refTypeArrayParameter1 = new StoreStoredProcedureParameter("RefTypeArray", "varchar(255)", 12, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(refTypeArrayParameter1); + var refTypeEnumerableParameter1 = new StoreStoredProcedureParameter("RefTypeEnumerable", "varchar(255)", 13, derived_InsertStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_InsertStoreSproc.AddParameter(refTypeEnumerableParameter1); + var derivedEnumFunctionColumn = new StoreStoredProcedureResultColumn("DerivedEnum", "integer", 0, derived_InsertStoreSproc); + derived_InsertStoreSproc.AddResultColumn(derivedEnumFunctionColumn); + derived_InsertStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalDerived.GetInsertStoredProcedure()!); + relationalModel.StoredProcedures.Add(("Derived_Insert", "TPC"), derived_InsertStoreSproc); + var derived_InsertISproc = (IRuntimeStoredProcedure)principalDerived.GetInsertStoredProcedure()!; + var derived_InsertSprocMapping = new StoredProcedureMapping(principalDerived, derived_InsertStoreSproc, derived_InsertISproc, principalDerivedTableMapping, null); + derived_InsertStoreSproc.AddTypeMapping(derived_InsertSprocMapping, false); + insertSprocMappings0.Add(derived_InsertSprocMapping); + principalDerivedTableMapping.InsertStoredProcedureMapping = derived_InsertSprocMapping; + RelationalModel.CreateStoredProcedureParameterMapping(idParameter0, derived_InsertISproc.FindParameter("Id")!, principalDerived.FindProperty("Id")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(enum2Parameter1, derived_InsertISproc.FindParameter("Enum2")!, principalDerived.FindProperty("Enum2")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum1Parameter1, derived_InsertISproc.FindParameter("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum2Parameter1, derived_InsertISproc.FindParameter("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(principalBaseIdParameter1, derived_InsertISproc.FindParameter("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(principalDerivedIdParameter1, derived_InsertISproc.FindParameter("PrincipalDerivedId")!, principalDerived.FindProperty("PrincipalDerivedId")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeArrayParameter1, derived_InsertISproc.FindParameter("RefTypeArray")!, principalDerived.FindProperty("RefTypeArray")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeEnumerableParameter1, derived_InsertISproc.FindParameter("RefTypeEnumerable")!, principalDerived.FindProperty("RefTypeEnumerable")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeIListParameter1, derived_InsertISproc.FindParameter("RefTypeIList")!, principalDerived.FindProperty("RefTypeIList")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeListParameter1, derived_InsertISproc.FindParameter("RefTypeList")!, principalDerived.FindProperty("RefTypeList")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeArrayParameter1, derived_InsertISproc.FindParameter("ValueTypeArray")!, principalDerived.FindProperty("ValueTypeArray")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeEnumerableParameter1, derived_InsertISproc.FindParameter("ValueTypeEnumerable")!, principalDerived.FindProperty("ValueTypeEnumerable")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeIListParameter1, derived_InsertISproc.FindParameter("ValueTypeIList")!, principalDerived.FindProperty("ValueTypeIList")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeListParameter1, derived_InsertISproc.FindParameter("ValueTypeList")!, principalDerived.FindProperty("ValueTypeList")!, derived_InsertSprocMapping); + RelationalModel.CreateStoredProcedureResultColumnMapping(derivedEnumFunctionColumn, derived_InsertISproc.FindResultColumn("DerivedEnum")!, principalDerived.FindProperty("Enum1")!, derived_InsertSprocMapping); + + var updateSprocMappings0 = new List(); + principalDerived.SetRuntimeAnnotation("Relational:UpdateStoredProcedureMappings", updateSprocMappings0); + var derived_UpdateStoreSproc = new StoreStoredProcedure("Derived_Update", "Derived", relationalModel); + var principalBaseIdParameter2 = new StoreStoredProcedureParameter("PrincipalBaseId", "decimal(20,0)", 0, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(principalBaseIdParameter2); + var principalDerivedIdParameter2 = new StoreStoredProcedureParameter("PrincipalDerivedId", "decimal(20,0)", 1, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(principalDerivedIdParameter2); + var enum1Parameter0 = new StoreStoredProcedureParameter("Enum1", "integer", 2, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input); + derived_UpdateStoreSproc.AddParameter(enum1Parameter0); + var enum2Parameter2 = new StoreStoredProcedureParameter("Enum2", "integer", 3, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(enum2Parameter2); + var flagsEnum1Parameter2 = new StoreStoredProcedureParameter("FlagsEnum1", "integer", 4, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input); + derived_UpdateStoreSproc.AddParameter(flagsEnum1Parameter2); + var flagsEnum2Parameter2 = new StoreStoredProcedureParameter("FlagsEnum2", "integer", 5, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input); + derived_UpdateStoreSproc.AddParameter(flagsEnum2Parameter2); + var valueTypeListParameter2 = new StoreStoredProcedureParameter("ValueTypeList", "varchar(255)", 6, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(valueTypeListParameter2); + var valueTypeIListParameter2 = new StoreStoredProcedureParameter("ValueTypeIList", "varchar(255)", 7, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(valueTypeIListParameter2); + var valueTypeArrayParameter2 = new StoreStoredProcedureParameter("ValueTypeArray", "varchar(255)", 8, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(valueTypeArrayParameter2); + var valueTypeEnumerableParameter2 = new StoreStoredProcedureParameter("ValueTypeEnumerable", "varchar(255)", 9, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(valueTypeEnumerableParameter2); + var refTypeListParameter2 = new StoreStoredProcedureParameter("RefTypeList", "varchar(255)", 10, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(refTypeListParameter2); + var refTypeIListParameter2 = new StoreStoredProcedureParameter("RefTypeIList", "varchar(255)", 11, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(refTypeIListParameter2); + var refTypeArrayParameter2 = new StoreStoredProcedureParameter("RefTypeArray", "varchar(255)", 12, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(refTypeArrayParameter2); + var refTypeEnumerableParameter2 = new StoreStoredProcedureParameter("RefTypeEnumerable", "varchar(255)", 13, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input) + { + IsNullable = true + }; + derived_UpdateStoreSproc.AddParameter(refTypeEnumerableParameter2); + var id_OriginalParameter2 = new StoreStoredProcedureParameter("Id_Original", "decimal(20,0)", 14, derived_UpdateStoreSproc, System.Data.ParameterDirection.Input); + derived_UpdateStoreSproc.AddParameter(id_OriginalParameter2); + derived_UpdateStoreSproc.AddStoredProcedure((IRuntimeStoredProcedure)principalDerived.GetUpdateStoredProcedure()!); + relationalModel.StoredProcedures.Add(("Derived_Update", "Derived"), derived_UpdateStoreSproc); + var derived_UpdateUSproc = (IRuntimeStoredProcedure)principalDerived.GetUpdateStoredProcedure()!; + var derived_UpdateSprocMapping = new StoredProcedureMapping(principalDerived, derived_UpdateStoreSproc, derived_UpdateUSproc, principalDerivedTableMapping, null); + derived_UpdateStoreSproc.AddTypeMapping(derived_UpdateSprocMapping, false); + updateSprocMappings0.Add(derived_UpdateSprocMapping); + principalDerivedTableMapping.UpdateStoredProcedureMapping = derived_UpdateSprocMapping; + RelationalModel.CreateStoredProcedureParameterMapping(id_OriginalParameter2, derived_UpdateUSproc.FindParameter("Id_Original")!, principalDerived.FindProperty("Id")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(enum1Parameter0, derived_UpdateUSproc.FindParameter("Enum1")!, principalDerived.FindProperty("Enum1")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(enum2Parameter2, derived_UpdateUSproc.FindParameter("Enum2")!, principalDerived.FindProperty("Enum2")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum1Parameter2, derived_UpdateUSproc.FindParameter("FlagsEnum1")!, principalDerived.FindProperty("FlagsEnum1")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(flagsEnum2Parameter2, derived_UpdateUSproc.FindParameter("FlagsEnum2")!, principalDerived.FindProperty("FlagsEnum2")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(principalBaseIdParameter2, derived_UpdateUSproc.FindParameter("PrincipalBaseId")!, principalDerived.FindProperty("PrincipalBaseId")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(principalDerivedIdParameter2, derived_UpdateUSproc.FindParameter("PrincipalDerivedId")!, principalDerived.FindProperty("PrincipalDerivedId")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeArrayParameter2, derived_UpdateUSproc.FindParameter("RefTypeArray")!, principalDerived.FindProperty("RefTypeArray")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeEnumerableParameter2, derived_UpdateUSproc.FindParameter("RefTypeEnumerable")!, principalDerived.FindProperty("RefTypeEnumerable")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeIListParameter2, derived_UpdateUSproc.FindParameter("RefTypeIList")!, principalDerived.FindProperty("RefTypeIList")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(refTypeListParameter2, derived_UpdateUSproc.FindParameter("RefTypeList")!, principalDerived.FindProperty("RefTypeList")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeArrayParameter2, derived_UpdateUSproc.FindParameter("ValueTypeArray")!, principalDerived.FindProperty("ValueTypeArray")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeEnumerableParameter2, derived_UpdateUSproc.FindParameter("ValueTypeEnumerable")!, principalDerived.FindProperty("ValueTypeEnumerable")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeIListParameter2, derived_UpdateUSproc.FindParameter("ValueTypeIList")!, principalDerived.FindProperty("ValueTypeIList")!, derived_UpdateSprocMapping); + RelationalModel.CreateStoredProcedureParameterMapping(valueTypeListParameter2, derived_UpdateUSproc.FindParameter("ValueTypeList")!, principalDerived.FindProperty("ValueTypeList")!, derived_UpdateSprocMapping); + var fK_DependentBasebyte_PrincipalDerived_PrincipalId = new ForeignKeyConstraint( + "FK_DependentBase_PrincipalDerived_PrincipalId", dependentBasebyteTable, principalDerivedTable, + new[] { principalIdColumn }, + principalDerivedTable.FindUniqueConstraint("PK_PrincipalDerived")!, ReferentialAction.NoAction); + fK_DependentBasebyte_PrincipalDerived_PrincipalId.SetRowForeignKeyValueFactory(RowForeignKeyValueFactoryFactory.CreateSimpleNonNullableFactory(fK_DependentBasebyte_PrincipalDerived_PrincipalId)); + var fK_DependentBasebyte_PrincipalDerived_PrincipalIdFk = RelationalModel.GetForeignKey(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase", + new[] { "PrincipalId" }, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived>", + new[] { "Id" }); + fK_DependentBasebyte_PrincipalDerived_PrincipalId.MappedForeignKeys.Add(fK_DependentBasebyte_PrincipalDerived_PrincipalIdFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_DependentBasebyte_PrincipalDerived_PrincipalIdFk).Add(fK_DependentBasebyte_PrincipalDerived_PrincipalId); + dependentBasebyteTable.ForeignKeyConstraints.Add(fK_DependentBasebyte_PrincipalDerived_PrincipalId); + principalDerivedTable.ReferencingForeignKeyConstraints.Add(fK_DependentBasebyte_PrincipalDerived_PrincipalId); + var fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBas = new ForeignKeyConstraint( + "FK_PrincipalBase_PrincipalDerived_PrincipalDerived(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBas)); + var fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasFk = RelationalModel.GetForeignKey(this, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", + new[] { "PrincipalDerivedId" }, + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived>", + new[] { "Id" }); + fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBas.MappedForeignKeys.Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasFk).Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBas); + principalBaseTable.ForeignKeyConstraints.Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBas); + principalDerivedTable.ReferencingForeignKeyConstraints.Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBas); + var fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependent = new ForeignKeyConstraint( + "FK_PrincipalDerived_PrincipalDerived_PrincipalDerived(fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependent)); + fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependent.MappedForeignKeys.Add(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasFk); + RelationalModel.GetOrCreateForeignKeyConstraints(fK_PrincipalBase_PrincipalDerived_PrincipalDerivedDependentBasFk).Add(fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependent); + principalDerivedTable.ForeignKeyConstraints.Add(fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependent); + principalDerivedTable.ReferencingForeignKeyConstraints.Add(fK_PrincipalDerived_PrincipalDerived_PrincipalDerivedDependent); + return relationalModel.MakeReadOnly(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DependentBaseEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DependentBaseEntityType.cs new file mode 100644 index 00000000..9035b568 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DependentBaseEntityType.cs @@ -0,0 +1,254 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class DependentBaseEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+DependentBase", + typeof(CompiledModelTestBase.DependentBase), + baseEntityType, + propertyCount: 2, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 1, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(byte?), + propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Id", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + byte? (CompiledModelTestBase.DependentBase instance) => DependentBaseUnsafeAccessors.Id(instance), + bool (CompiledModelTestBase.DependentBase instance) => !(DependentBaseUnsafeAccessors.Id(instance).HasValue)); + id.SetSetter( + CompiledModelTestBase.DependentBase (CompiledModelTestBase.DependentBase instance, byte? value) => + { + DependentBaseUnsafeAccessors.Id(instance) = value; + return instance; + }); + id.SetMaterializationSetter( + CompiledModelTestBase.DependentBase (CompiledModelTestBase.DependentBase instance, byte? value) => + { + DependentBaseUnsafeAccessors.Id(instance) = value; + return instance; + }); + id.SetAccessors( + byte? (IInternalEntry entry) => DependentBaseUnsafeAccessors.Id(((CompiledModelTestBase.DependentBase)(entry.Entity))), + byte? (IInternalEntry entry) => DependentBaseUnsafeAccessors.Id(((CompiledModelTestBase.DependentBase)(entry.Entity))), + byte? (IInternalEntry entry) => entry.ReadOriginalValue(id, 0), + byte? (IInternalEntry entry) => ((InternalEntityEntry)entry).ReadRelationshipSnapshotValue(id, 0)); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: -1); + id.TypeMapping = JetByteTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v), + keyComparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v), + providerValueComparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); + id.SetComparer(new NullableValueComparer(id.TypeMapping.Comparer)); + id.SetKeyComparer(new NullableValueComparer(id.TypeMapping.KeyComparer)); + + var principalId = runtimeEntityType.AddProperty( + "PrincipalId", + typeof(long?), + nullable: true); + principalId.SetAccessors( + long? (IInternalEntry entry) => (entry.FlaggedAsStoreGenerated(1) ? entry.ReadStoreGeneratedValue(0) : (entry.FlaggedAsTemporary(1) && !(entry.ReadShadowValue(0).HasValue) ? entry.ReadTemporaryValue(0) : entry.ReadShadowValue(0))), + long? (IInternalEntry entry) => entry.ReadShadowValue(0), + long? (IInternalEntry entry) => entry.ReadOriginalValue(principalId, 1), + long? (IInternalEntry entry) => ((InternalEntityEntry)entry).ReadRelationshipSnapshotValue(principalId, 1)); + principalId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 0, + relationshipIndex: 1, + storeGenerationIndex: 0); + principalId.TypeMapping = JetLongTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v), + keyComparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v), + providerValueComparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v)); + principalId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalId)); + principalId.SetComparer(new NullableValueComparer(principalId.TypeMapping.Comparer)); + principalId.SetKeyComparer(new NullableValueComparer(principalId.TypeMapping.KeyComparer)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { principalId }, + unique: true); + index.AddAnnotation("Relational:Filter", "IGNORE NULL"); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.ClientCascade, + unique: true, + requiredDependent: true); + + var principal = declaringEntityType.AddNavigation("Principal", + runtimeForeignKey, + onDependent: true, + typeof(CompiledModelTestBase.PrincipalDerived>), + propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Principal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + principal.SetGetter( + CompiledModelTestBase.PrincipalDerived> (CompiledModelTestBase.DependentBase instance) => DependentBaseUnsafeAccessors.Principal(instance), + bool (CompiledModelTestBase.DependentBase instance) => DependentBaseUnsafeAccessors.Principal(instance) == null); + principal.SetSetter( + CompiledModelTestBase.DependentBase (CompiledModelTestBase.DependentBase instance, CompiledModelTestBase.PrincipalDerived> value) => + { + DependentBaseUnsafeAccessors.Principal(instance) = value; + return instance; + }); + principal.SetMaterializationSetter( + CompiledModelTestBase.DependentBase (CompiledModelTestBase.DependentBase instance, CompiledModelTestBase.PrincipalDerived> value) => + { + DependentBaseUnsafeAccessors.Principal(instance) = value; + return instance; + }); + principal.SetAccessors( + CompiledModelTestBase.PrincipalDerived> (IInternalEntry entry) => DependentBaseUnsafeAccessors.Principal(((CompiledModelTestBase.DependentBase)(entry.Entity))), + CompiledModelTestBase.PrincipalDerived> (IInternalEntry entry) => DependentBaseUnsafeAccessors.Principal(((CompiledModelTestBase.DependentBase)(entry.Entity))), + null, + CompiledModelTestBase.PrincipalDerived> (IInternalEntry entry) => entry.GetCurrentValue>>(principal)); + principal.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); + var dependent = principalEntityType.AddNavigation("Dependent", + runtimeForeignKey, + onDependent: false, + typeof(CompiledModelTestBase.DependentBase), + propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Dependent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + dependent.SetGetter( + CompiledModelTestBase.DependentBase (CompiledModelTestBase.PrincipalDerived> instance) => PrincipalDerivedUnsafeAccessors>.Dependent(instance), + bool (CompiledModelTestBase.PrincipalDerived> instance) => PrincipalDerivedUnsafeAccessors>.Dependent(instance) == null); + dependent.SetSetter( + CompiledModelTestBase.PrincipalDerived> (CompiledModelTestBase.PrincipalDerived> instance, CompiledModelTestBase.DependentBase value) => + { + PrincipalDerivedUnsafeAccessors>.Dependent(instance) = value; + return instance; + }); + dependent.SetMaterializationSetter( + CompiledModelTestBase.PrincipalDerived> (CompiledModelTestBase.PrincipalDerived> instance, CompiledModelTestBase.DependentBase value) => + { + PrincipalDerivedUnsafeAccessors>.Dependent(instance) = value; + return instance; + }); + dependent.SetAccessors( + CompiledModelTestBase.DependentBase (IInternalEntry entry) => PrincipalDerivedUnsafeAccessors>.Dependent(((CompiledModelTestBase.PrincipalDerived>)(entry.Entity))), + CompiledModelTestBase.DependentBase (IInternalEntry entry) => PrincipalDerivedUnsafeAccessors>.Dependent(((CompiledModelTestBase.PrincipalDerived>)(entry.Entity))), + null, + CompiledModelTestBase.DependentBase (IInternalEntry entry) => entry.GetCurrentValue>(dependent)); + dependent.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 4, + storeGenerationIndex: -1); + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + var id = runtimeEntityType.FindProperty("Id"); + var principalId = runtimeEntityType.FindProperty("PrincipalId"); + var key = runtimeEntityType.FindKey(new[] { id }); + key.SetPrincipalKeyValueFactory(KeyValueFactoryFactory.CreateSimpleNullableFactory(key)); + key.SetIdentityMapFactory(IdentityMapFactoryFactory.CreateFactory(key)); + var principal = runtimeEntityType.FindNavigation("Principal"); + runtimeEntityType.SetOriginalValuesFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.DependentBase)(source.Entity)); + return ((ISnapshot)(new Snapshot((source.GetCurrentValue(id) == null ? null : ((ValueComparer)(((IProperty)id).GetValueComparer())).Snapshot(source.GetCurrentValue(id))), (source.GetCurrentValue(principalId) == null ? null : ((ValueComparer)(((IProperty)principalId).GetValueComparer())).Snapshot(source.GetCurrentValue(principalId)))))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + ISnapshot () => ((ISnapshot)(new Snapshot((default(long? ) == null ? null : ((ValueComparer)(((IProperty)principalId).GetValueComparer())).Snapshot(default(long? ))))))); + runtimeEntityType.SetTemporaryValuesFactory( + ISnapshot (IInternalEntry source) => ((ISnapshot)(new Snapshot(default(long? ))))); + runtimeEntityType.SetShadowValuesFactory( + ISnapshot (IDictionary source) => ((ISnapshot)(new Snapshot((source.ContainsKey("PrincipalId") ? ((long? )(source["PrincipalId"])) : null))))); + runtimeEntityType.SetEmptyShadowValuesFactory( + ISnapshot () => ((ISnapshot)(new Snapshot(default(long? ))))); + runtimeEntityType.SetRelationshipSnapshotFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.DependentBase)(source.Entity)); + return ((ISnapshot)(new Snapshot((source.GetCurrentValue(id) == null ? null : ((ValueComparer)(((IProperty)id).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(id))), (source.GetCurrentValue(principalId) == null ? null : ((ValueComparer)(((IProperty)principalId).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(principalId))), source.GetCurrentValue>>(principal)))); + }); + runtimeEntityType.SetCounts(new PropertyCounts( + propertyCount: 2, + navigationCount: 1, + complexPropertyCount: 0, + complexCollectionCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 3, + storeGeneratedCount: 1)); + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", "TPC"); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "DependentBase"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DependentBaseUnsafeAccessors.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DependentBaseUnsafeAccessors.cs new file mode 100644 index 00000000..d7a27e94 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/DependentBaseUnsafeAccessors.cs @@ -0,0 +1,18 @@ +// +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public static class DependentBaseUnsafeAccessors + { + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref TKey Id(CompiledModelTestBase.DependentBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref CompiledModelTestBase.PrincipalDerived> Principal(CompiledModelTestBase.DependentBase @this); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalBaseEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalBaseEntityType.cs new file mode 100644 index 00000000..2e2ddc68 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalBaseEntityType.cs @@ -0,0 +1,1249 @@ +// +using System; +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.EntityFrameworkCore.Storage.Json; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class PrincipalBaseEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalBase", + typeof(CompiledModelTestBase.PrincipalBase), + baseEntityType, + discriminatorValue: "PrincipalBase", + derivedTypesCount: 1, + propertyCount: 15, + navigationCount: 1, + foreignKeyCount: 2, + unnamedIndexCount: 1, + namedIndexCount: 1, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(long?), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + long? (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.Id(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => !(PrincipalBaseUnsafeAccessors.Id(instance).HasValue)); + id.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, long? value) => + { + PrincipalBaseUnsafeAccessors.Id(instance) = value; + return instance; + }); + id.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, long? value) => + { + PrincipalBaseUnsafeAccessors.Id(instance) = value; + return instance; + }); + id.SetAccessors( + long? (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.Id(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + long? (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.Id(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + long? (IInternalEntry entry) => entry.ReadOriginalValue(id, 0), + long? (IInternalEntry entry) => ((InternalEntityEntry)entry).ReadRelationshipSnapshotValue(id, 0)); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: -1); + id.TypeMapping = JetLongTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v), + keyComparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v), + providerValueComparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); + id.SetComparer(new NullableValueComparer(id.TypeMapping.Comparer)); + id.SetKeyComparer(new NullableValueComparer(id.TypeMapping.KeyComparer)); + + var overrides = new StoreObjectDictionary(); + var idPrincipalBaseView = new RuntimeRelationalPropertyOverrides( + id, + StoreObjectIdentifier.View("PrincipalBaseView", "TPC"), + false, + null); + idPrincipalBaseView.AddAnnotation("foo", "bar2"); + overrides.Add(StoreObjectIdentifier.View("PrincipalBaseView", "TPC"), idPrincipalBaseView); + id.AddAnnotation("Relational:RelationalOverrides", overrides); + + + var enum1 = runtimeEntityType.AddProperty( + "Enum1", + typeof(CompiledModelTestBase.AnEnum), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd); + enum1.SetGetter( + CompiledModelTestBase.AnEnum (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.Enum1(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => object.Equals(((object)(PrincipalBaseUnsafeAccessors.Enum1(instance))), ((object)(CompiledModelTestBase.AnEnum.A)))); + enum1.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, CompiledModelTestBase.AnEnum value) => + { + PrincipalBaseUnsafeAccessors.Enum1(instance) = value; + return instance; + }); + enum1.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, CompiledModelTestBase.AnEnum value) => + { + PrincipalBaseUnsafeAccessors.Enum1(instance) = value; + return instance; + }); + enum1.SetAccessors( + CompiledModelTestBase.AnEnum (IInternalEntry entry) => (entry.FlaggedAsStoreGenerated(1) ? entry.ReadStoreGeneratedValue(0) : (entry.FlaggedAsTemporary(1) && object.Equals(((object)(PrincipalBaseUnsafeAccessors.Enum1(((CompiledModelTestBase.PrincipalBase)(entry.Entity))))), ((object)(CompiledModelTestBase.AnEnum.A))) ? entry.ReadTemporaryValue(0) : PrincipalBaseUnsafeAccessors.Enum1(((CompiledModelTestBase.PrincipalBase)(entry.Entity))))), + CompiledModelTestBase.AnEnum (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.Enum1(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + CompiledModelTestBase.AnEnum (IInternalEntry entry) => entry.ReadOriginalValue(enum1, 1), + CompiledModelTestBase.AnEnum (IInternalEntry entry) => entry.GetCurrentValue(enum1)); + enum1.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: 0); + enum1.TypeMapping = JetIntTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals(((object)v1), ((object)v2)), + int (CompiledModelTestBase.AnEnum v) => ((object)v).GetHashCode(), + CompiledModelTestBase.AnEnum (CompiledModelTestBase.AnEnum v) => v), + keyComparer: new ValueComparer( + bool (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals(((object)v1), ((object)v2)), + int (CompiledModelTestBase.AnEnum v) => ((object)v).GetHashCode(), + CompiledModelTestBase.AnEnum (CompiledModelTestBase.AnEnum v) => v), + providerValueComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + converter: new ValueConverter( + int (CompiledModelTestBase.AnEnum value) => ((int)value), + CompiledModelTestBase.AnEnum (int value) => ((CompiledModelTestBase.AnEnum)value)), + jsonValueReaderWriter: new JsonConvertedValueReaderWriter( + JsonInt32ReaderWriter.Instance, + new ValueConverter( + int (CompiledModelTestBase.AnEnum value) => ((int)value), + CompiledModelTestBase.AnEnum (int value) => ((CompiledModelTestBase.AnEnum)value)))); + enum1.SetSentinelFromProviderValue(1); + + var overrides0 = new StoreObjectDictionary(); + var enum1Derived_Insert = new RuntimeRelationalPropertyOverrides( + enum1, + StoreObjectIdentifier.InsertStoredProcedure("Derived_Insert", "TPC"), + true, + "DerivedEnum"); + overrides0.Add(StoreObjectIdentifier.InsertStoredProcedure("Derived_Insert", "TPC"), enum1Derived_Insert); + enum1.AddAnnotation("Relational:RelationalOverrides", overrides0); + + enum1.AddAnnotation("Relational:DefaultValue", CompiledModelTestBase.AnEnum.A); + + var enum2 = runtimeEntityType.AddProperty( + "Enum2", + typeof(CompiledModelTestBase.AnEnum?), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + enum2.SetGetter( + CompiledModelTestBase.AnEnum? (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.Enum2(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => !(PrincipalBaseUnsafeAccessors.Enum2(instance).HasValue)); + enum2.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, CompiledModelTestBase.AnEnum? value) => + { + PrincipalBaseUnsafeAccessors.Enum2(instance) = (value == null ? value : ((CompiledModelTestBase.AnEnum? )(((CompiledModelTestBase.AnEnum)value)))); + return instance; + }); + enum2.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, CompiledModelTestBase.AnEnum? value) => + { + PrincipalBaseUnsafeAccessors.Enum2(instance) = (value == null ? value : ((CompiledModelTestBase.AnEnum? )(((CompiledModelTestBase.AnEnum)value)))); + return instance; + }); + enum2.SetAccessors( + CompiledModelTestBase.AnEnum? (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.Enum2(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + CompiledModelTestBase.AnEnum? (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.Enum2(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + CompiledModelTestBase.AnEnum? (IInternalEntry entry) => entry.ReadOriginalValue(enum2, 2), + CompiledModelTestBase.AnEnum? (IInternalEntry entry) => entry.GetCurrentValue(enum2)); + enum2.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + enum2.TypeMapping = JetIntTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals(((object)v1), ((object)v2)), + int (CompiledModelTestBase.AnEnum v) => ((object)v).GetHashCode(), + CompiledModelTestBase.AnEnum (CompiledModelTestBase.AnEnum v) => v), + keyComparer: new ValueComparer( + bool (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals(((object)v1), ((object)v2)), + int (CompiledModelTestBase.AnEnum v) => ((object)v).GetHashCode(), + CompiledModelTestBase.AnEnum (CompiledModelTestBase.AnEnum v) => v), + providerValueComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + converter: new ValueConverter( + int (CompiledModelTestBase.AnEnum value) => ((int)value), + CompiledModelTestBase.AnEnum (int value) => ((CompiledModelTestBase.AnEnum)value)), + jsonValueReaderWriter: new JsonConvertedValueReaderWriter( + JsonInt32ReaderWriter.Instance, + new ValueConverter( + int (CompiledModelTestBase.AnEnum value) => ((int)value), + CompiledModelTestBase.AnEnum (int value) => ((CompiledModelTestBase.AnEnum)value)))); + enum2.SetComparer(new NullableValueComparer(enum2.TypeMapping.Comparer)); + enum2.SetKeyComparer(new NullableValueComparer(enum2.TypeMapping.KeyComparer)); + + var flagsEnum1 = runtimeEntityType.AddProperty( + "FlagsEnum1", + typeof(CompiledModelTestBase.AFlagsEnum), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetGetter( + CompiledModelTestBase.AFlagsEnum (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.FlagsEnum1(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => object.Equals(((object)(PrincipalBaseUnsafeAccessors.FlagsEnum1(instance))), ((object)((CompiledModelTestBase.AFlagsEnum)0L)))); + flagsEnum1.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, CompiledModelTestBase.AFlagsEnum value) => + { + PrincipalBaseUnsafeAccessors.FlagsEnum1(instance) = value; + return instance; + }); + flagsEnum1.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, CompiledModelTestBase.AFlagsEnum value) => + { + PrincipalBaseUnsafeAccessors.FlagsEnum1(instance) = value; + return instance; + }); + flagsEnum1.SetAccessors( + CompiledModelTestBase.AFlagsEnum (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.FlagsEnum1(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + CompiledModelTestBase.AFlagsEnum (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.FlagsEnum1(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + CompiledModelTestBase.AFlagsEnum (IInternalEntry entry) => entry.ReadOriginalValue(flagsEnum1, 3), + CompiledModelTestBase.AFlagsEnum (IInternalEntry entry) => entry.GetCurrentValue(flagsEnum1)); + flagsEnum1.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + flagsEnum1.TypeMapping = JetIntTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals(((object)v1), ((object)v2)), + int (CompiledModelTestBase.AFlagsEnum v) => ((object)v).GetHashCode(), + CompiledModelTestBase.AFlagsEnum (CompiledModelTestBase.AFlagsEnum v) => v), + keyComparer: new ValueComparer( + bool (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals(((object)v1), ((object)v2)), + int (CompiledModelTestBase.AFlagsEnum v) => ((object)v).GetHashCode(), + CompiledModelTestBase.AFlagsEnum (CompiledModelTestBase.AFlagsEnum v) => v), + providerValueComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + converter: new ValueConverter( + int (CompiledModelTestBase.AFlagsEnum value) => ((int)value), + CompiledModelTestBase.AFlagsEnum (int value) => ((CompiledModelTestBase.AFlagsEnum)value)), + jsonValueReaderWriter: new JsonConvertedValueReaderWriter( + JsonInt32ReaderWriter.Instance, + new ValueConverter( + int (CompiledModelTestBase.AFlagsEnum value) => ((int)value), + CompiledModelTestBase.AFlagsEnum (int value) => ((CompiledModelTestBase.AFlagsEnum)value)))); + flagsEnum1.SetSentinelFromProviderValue(0); + + var flagsEnum2 = runtimeEntityType.AddProperty( + "FlagsEnum2", + typeof(CompiledModelTestBase.AFlagsEnum), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum2.SetGetter( + CompiledModelTestBase.AFlagsEnum (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.FlagsEnum2(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => object.Equals(((object)(PrincipalBaseUnsafeAccessors.FlagsEnum2(instance))), ((object)((CompiledModelTestBase.AFlagsEnum)0L)))); + flagsEnum2.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, CompiledModelTestBase.AFlagsEnum value) => + { + PrincipalBaseUnsafeAccessors.FlagsEnum2(instance) = value; + return instance; + }); + flagsEnum2.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, CompiledModelTestBase.AFlagsEnum value) => + { + PrincipalBaseUnsafeAccessors.FlagsEnum2(instance) = value; + return instance; + }); + flagsEnum2.SetAccessors( + CompiledModelTestBase.AFlagsEnum (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.FlagsEnum2(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + CompiledModelTestBase.AFlagsEnum (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.FlagsEnum2(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + CompiledModelTestBase.AFlagsEnum (IInternalEntry entry) => entry.ReadOriginalValue(flagsEnum2, 4), + CompiledModelTestBase.AFlagsEnum (IInternalEntry entry) => entry.GetCurrentValue(flagsEnum2)); + flagsEnum2.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + flagsEnum2.TypeMapping = JetIntTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals(((object)v1), ((object)v2)), + int (CompiledModelTestBase.AFlagsEnum v) => ((object)v).GetHashCode(), + CompiledModelTestBase.AFlagsEnum (CompiledModelTestBase.AFlagsEnum v) => v), + keyComparer: new ValueComparer( + bool (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals(((object)v1), ((object)v2)), + int (CompiledModelTestBase.AFlagsEnum v) => ((object)v).GetHashCode(), + CompiledModelTestBase.AFlagsEnum (CompiledModelTestBase.AFlagsEnum v) => v), + providerValueComparer: new ValueComparer( + bool (int v1, int v2) => v1 == v2, + int (int v) => v, + int (int v) => v), + converter: new ValueConverter( + int (CompiledModelTestBase.AFlagsEnum value) => ((int)value), + CompiledModelTestBase.AFlagsEnum (int value) => ((CompiledModelTestBase.AFlagsEnum)value)), + jsonValueReaderWriter: new JsonConvertedValueReaderWriter( + JsonInt32ReaderWriter.Instance, + new ValueConverter( + int (CompiledModelTestBase.AFlagsEnum value) => ((int)value), + CompiledModelTestBase.AFlagsEnum (int value) => ((CompiledModelTestBase.AFlagsEnum)value)))); + flagsEnum2.SetSentinelFromProviderValue(0); + + var principalBaseId = runtimeEntityType.AddProperty( + "PrincipalBaseId", + typeof(long?), + nullable: true); + principalBaseId.SetAccessors( + long? (IInternalEntry entry) => (entry.FlaggedAsStoreGenerated(5) ? entry.ReadStoreGeneratedValue(1) : (entry.FlaggedAsTemporary(5) && !(entry.ReadShadowValue(0).HasValue) ? entry.ReadTemporaryValue(1) : entry.ReadShadowValue(0))), + long? (IInternalEntry entry) => entry.ReadShadowValue(0), + long? (IInternalEntry entry) => entry.ReadOriginalValue(principalBaseId, 5), + long? (IInternalEntry entry) => ((InternalEntityEntry)entry).ReadRelationshipSnapshotValue(principalBaseId, 1)); + principalBaseId.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: 0, + relationshipIndex: 1, + storeGenerationIndex: 1); + principalBaseId.TypeMapping = JetLongTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v), + keyComparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v), + providerValueComparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v)); + principalBaseId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseId)); + principalBaseId.SetComparer(new NullableValueComparer(principalBaseId.TypeMapping.Comparer)); + principalBaseId.SetKeyComparer(new NullableValueComparer(principalBaseId.TypeMapping.KeyComparer)); + + var principalDerivedId = runtimeEntityType.AddProperty( + "PrincipalDerivedId", + typeof(long?), + nullable: true); + principalDerivedId.SetAccessors( + long? (IInternalEntry entry) => (entry.FlaggedAsStoreGenerated(6) ? entry.ReadStoreGeneratedValue(2) : (entry.FlaggedAsTemporary(6) && !(entry.ReadShadowValue(1).HasValue) ? entry.ReadTemporaryValue(2) : entry.ReadShadowValue(1))), + long? (IInternalEntry entry) => entry.ReadShadowValue(1), + long? (IInternalEntry entry) => entry.ReadOriginalValue(principalDerivedId, 6), + long? (IInternalEntry entry) => ((InternalEntityEntry)entry).ReadRelationshipSnapshotValue(principalDerivedId, 2)); + principalDerivedId.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: 1, + relationshipIndex: 2, + storeGenerationIndex: 2); + principalDerivedId.TypeMapping = JetLongTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v), + keyComparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v), + providerValueComparer: new ValueComparer( + bool (long v1, long v2) => v1 == v2, + int (long v) => ((object)v).GetHashCode(), + long (long v) => v)); + principalDerivedId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedId)); + principalDerivedId.SetComparer(new NullableValueComparer(principalDerivedId.TypeMapping.Comparer)); + principalDerivedId.SetKeyComparer(new NullableValueComparer(principalDerivedId.TypeMapping.KeyComparer)); + + var refTypeArray = runtimeEntityType.AddProperty( + "RefTypeArray", + typeof(IPAddress[]), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + refTypeArray.SetGetter( + IPAddress[] (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.RefTypeArray(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.RefTypeArray(instance) == null); + refTypeArray.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IPAddress[] value) => + { + PrincipalBaseUnsafeAccessors.RefTypeArray(instance) = value; + return instance; + }); + refTypeArray.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IPAddress[] value) => + { + PrincipalBaseUnsafeAccessors.RefTypeArray(instance) = value; + return instance; + }); + refTypeArray.SetAccessors( + IPAddress[] (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.RefTypeArray(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IPAddress[] (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.RefTypeArray(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IPAddress[] (IInternalEntry entry) => entry.ReadOriginalValue(refTypeArray, 7), + IPAddress[] (IInternalEntry entry) => entry.GetCurrentValue(refTypeArray)); + refTypeArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + refTypeArray.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ListOfReferenceTypesComparer(new ValueComparer( + bool (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), + int (IPAddress v) => ((object)v).GetHashCode(), + IPAddress (IPAddress v) => v)), + keyComparer: new ListOfReferenceTypesComparer(new ValueComparer( + bool (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), + int (IPAddress v) => ((object)v).GetHashCode(), + IPAddress (IPAddress v) => v)), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255), + converter: new CollectionToJsonStringConverter(new JsonCollectionOfReferencesReaderWriter( + new JsonConvertedValueReaderWriter( + JsonStringReaderWriter.Instance, + new ValueConverter( + string (IPAddress v) => ((object)v).ToString(), + IPAddress (string v) => IPAddress.Parse(v))))), + jsonValueReaderWriter: new JsonCollectionOfReferencesReaderWriter( + new JsonConvertedValueReaderWriter( + JsonStringReaderWriter.Instance, + new ValueConverter( + string (IPAddress v) => ((object)v).ToString(), + IPAddress (string v) => IPAddress.Parse(v)))), + elementMapping: JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), + int (IPAddress v) => ((object)v).GetHashCode(), + IPAddress (IPAddress v) => v), + keyComparer: new ValueComparer( + bool (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), + int (IPAddress v) => ((object)v).GetHashCode(), + IPAddress (IPAddress v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(45)", + size: 45), + converter: new ValueConverter( + string (IPAddress v) => ((object)v).ToString(), + IPAddress (string v) => IPAddress.Parse(v)), + jsonValueReaderWriter: new JsonConvertedValueReaderWriter( + JsonStringReaderWriter.Instance, + new ValueConverter( + string (IPAddress v) => ((object)v).ToString(), + IPAddress (string v) => IPAddress.Parse(v))))); + var refTypeArrayElementType = refTypeArray.SetElementType(typeof(IPAddress)); + refTypeArrayElementType.TypeMapping = refTypeArray.TypeMapping.ElementTypeMapping; + + var refTypeEnumerable = runtimeEntityType.AddProperty( + "RefTypeEnumerable", + typeof(IEnumerable), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + refTypeEnumerable.SetGetter( + IEnumerable (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.RefTypeEnumerable(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.RefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IEnumerable value) => + { + PrincipalBaseUnsafeAccessors.RefTypeEnumerable(instance) = value; + return instance; + }); + refTypeEnumerable.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IEnumerable value) => + { + PrincipalBaseUnsafeAccessors.RefTypeEnumerable(instance) = value; + return instance; + }); + refTypeEnumerable.SetAccessors( + IEnumerable (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.RefTypeEnumerable(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IEnumerable (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.RefTypeEnumerable(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IEnumerable (IInternalEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 8), + IEnumerable (IInternalEntry entry) => entry.GetCurrentValue>(refTypeEnumerable)); + refTypeEnumerable.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + refTypeEnumerable.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ListOfReferenceTypesComparer, string>(new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v)), + keyComparer: new ListOfReferenceTypesComparer, string>(new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v)), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255), + converter: new CollectionToJsonStringConverter(new JsonCollectionOfReferencesReaderWriter, string>( + JsonStringReaderWriter.Instance)), + jsonValueReaderWriter: new JsonCollectionOfReferencesReaderWriter, string>( + JsonStringReaderWriter.Instance), + elementMapping: JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255))); + var refTypeEnumerableElementType = refTypeEnumerable.SetElementType(typeof(string)); + refTypeEnumerableElementType.TypeMapping = refTypeEnumerable.TypeMapping.ElementTypeMapping; + + var refTypeIList = runtimeEntityType.AddProperty( + "RefTypeIList", + typeof(IList), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + refTypeIList.SetGetter( + IList (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.RefTypeIList(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.RefTypeIList(instance) == null); + refTypeIList.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IList value) => + { + PrincipalBaseUnsafeAccessors.RefTypeIList(instance) = value; + return instance; + }); + refTypeIList.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IList value) => + { + PrincipalBaseUnsafeAccessors.RefTypeIList(instance) = value; + return instance; + }); + refTypeIList.SetAccessors( + IList (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.RefTypeIList(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IList (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.RefTypeIList(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IList (IInternalEntry entry) => entry.ReadOriginalValue>(refTypeIList, 9), + IList (IInternalEntry entry) => entry.GetCurrentValue>(refTypeIList)); + refTypeIList.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + refTypeIList.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ListOfReferenceTypesComparer, string>(new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v)), + keyComparer: new ListOfReferenceTypesComparer, string>(new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v)), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255), + converter: new CollectionToJsonStringConverter(new JsonCollectionOfReferencesReaderWriter, string>( + JsonStringReaderWriter.Instance)), + jsonValueReaderWriter: new JsonCollectionOfReferencesReaderWriter, string>( + JsonStringReaderWriter.Instance), + elementMapping: JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + keyComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255))); + var refTypeIListElementType = refTypeIList.SetElementType(typeof(string)); + refTypeIListElementType.TypeMapping = refTypeIList.TypeMapping.ElementTypeMapping; + + var refTypeList = runtimeEntityType.AddProperty( + "RefTypeList", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + refTypeList.SetGetter( + List (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.RefTypeList(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.RefTypeList(instance) == null); + refTypeList.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, List value) => + { + PrincipalBaseUnsafeAccessors.RefTypeList(instance) = value; + return instance; + }); + refTypeList.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, List value) => + { + PrincipalBaseUnsafeAccessors.RefTypeList(instance) = value; + return instance; + }); + refTypeList.SetAccessors( + List (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.RefTypeList(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + List (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.RefTypeList(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + List (IInternalEntry entry) => entry.ReadOriginalValue>(refTypeList, 10), + List (IInternalEntry entry) => entry.GetCurrentValue>(refTypeList)); + refTypeList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + refTypeList.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ListOfReferenceTypesComparer, IPAddress>(new ValueComparer( + bool (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), + int (IPAddress v) => ((object)v).GetHashCode(), + IPAddress (IPAddress v) => v)), + keyComparer: new ListOfReferenceTypesComparer, IPAddress>(new ValueComparer( + bool (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), + int (IPAddress v) => ((object)v).GetHashCode(), + IPAddress (IPAddress v) => v)), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255), + converter: new CollectionToJsonStringConverter(new JsonCollectionOfReferencesReaderWriter, IPAddress>( + new JsonConvertedValueReaderWriter( + JsonStringReaderWriter.Instance, + new ValueConverter( + string (IPAddress v) => ((object)v).ToString(), + IPAddress (string v) => IPAddress.Parse(v))))), + jsonValueReaderWriter: new JsonCollectionOfReferencesReaderWriter, IPAddress>( + new JsonConvertedValueReaderWriter( + JsonStringReaderWriter.Instance, + new ValueConverter( + string (IPAddress v) => ((object)v).ToString(), + IPAddress (string v) => IPAddress.Parse(v)))), + elementMapping: JetStringTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), + int (IPAddress v) => ((object)v).GetHashCode(), + IPAddress (IPAddress v) => v), + keyComparer: new ValueComparer( + bool (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), + int (IPAddress v) => ((object)v).GetHashCode(), + IPAddress (IPAddress v) => v), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(45)", + size: 45), + converter: new ValueConverter( + string (IPAddress v) => ((object)v).ToString(), + IPAddress (string v) => IPAddress.Parse(v)), + jsonValueReaderWriter: new JsonConvertedValueReaderWriter( + JsonStringReaderWriter.Instance, + new ValueConverter( + string (IPAddress v) => ((object)v).ToString(), + IPAddress (string v) => IPAddress.Parse(v))))); + var refTypeListElementType = refTypeList.SetElementType(typeof(IPAddress)); + refTypeListElementType.TypeMapping = refTypeList.TypeMapping.ElementTypeMapping; + + var valueTypeArray = runtimeEntityType.AddProperty( + "ValueTypeArray", + typeof(DateTime[]), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + valueTypeArray.SetGetter( + DateTime[] (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.ValueTypeArray(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.ValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, DateTime[] value) => + { + PrincipalBaseUnsafeAccessors.ValueTypeArray(instance) = value; + return instance; + }); + valueTypeArray.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, DateTime[] value) => + { + PrincipalBaseUnsafeAccessors.ValueTypeArray(instance) = value; + return instance; + }); + valueTypeArray.SetAccessors( + DateTime[] (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.ValueTypeArray(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + DateTime[] (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.ValueTypeArray(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + DateTime[] (IInternalEntry entry) => entry.ReadOriginalValue(valueTypeArray, 11), + DateTime[] (IInternalEntry entry) => entry.GetCurrentValue(valueTypeArray)); + valueTypeArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + valueTypeArray.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ListOfValueTypesComparer(new ValueComparer( + bool (DateTime v1, DateTime v2) => v1.Equals(v2), + int (DateTime v) => ((object)v).GetHashCode(), + DateTime (DateTime v) => v)), + keyComparer: new ListOfValueTypesComparer(new ValueComparer( + bool (DateTime v1, DateTime v2) => v1.Equals(v2), + int (DateTime v) => ((object)v).GetHashCode(), + DateTime (DateTime v) => v)), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255), + converter: new CollectionToJsonStringConverter(new JsonCollectionOfStructsReaderWriter( + JsonDateTimeReaderWriter.Instance)), + jsonValueReaderWriter: new JsonCollectionOfStructsReaderWriter( + JsonDateTimeReaderWriter.Instance), + elementMapping: JetDateTimeTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (DateTime v1, DateTime v2) => v1.Equals(v2), + int (DateTime v) => ((object)v).GetHashCode(), + DateTime (DateTime v) => v), + keyComparer: new ValueComparer( + bool (DateTime v1, DateTime v2) => v1.Equals(v2), + int (DateTime v) => ((object)v).GetHashCode(), + DateTime (DateTime v) => v), + providerValueComparer: new ValueComparer( + bool (DateTime v1, DateTime v2) => v1.Equals(v2), + int (DateTime v) => ((object)v).GetHashCode(), + DateTime (DateTime v) => v))); + var valueTypeArrayElementType = valueTypeArray.SetElementType(typeof(DateTime)); + valueTypeArrayElementType.TypeMapping = valueTypeArray.TypeMapping.ElementTypeMapping; + + var valueTypeEnumerable = runtimeEntityType.AddProperty( + "ValueTypeEnumerable", + typeof(IEnumerable), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + valueTypeEnumerable.SetGetter( + IEnumerable (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.ValueTypeEnumerable(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.ValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IEnumerable value) => + { + PrincipalBaseUnsafeAccessors.ValueTypeEnumerable(instance) = value; + return instance; + }); + valueTypeEnumerable.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IEnumerable value) => + { + PrincipalBaseUnsafeAccessors.ValueTypeEnumerable(instance) = value; + return instance; + }); + valueTypeEnumerable.SetAccessors( + IEnumerable (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.ValueTypeEnumerable(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IEnumerable (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.ValueTypeEnumerable(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IEnumerable (IInternalEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 12), + IEnumerable (IInternalEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable)); + valueTypeEnumerable.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + valueTypeEnumerable.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ListOfValueTypesComparer, byte>(new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v)), + keyComparer: new ListOfValueTypesComparer, byte>(new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v)), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255), + converter: new CollectionToJsonStringConverter(new JsonCollectionOfStructsReaderWriter, byte>( + JsonByteReaderWriter.Instance)), + jsonValueReaderWriter: new JsonCollectionOfStructsReaderWriter, byte>( + JsonByteReaderWriter.Instance), + elementMapping: JetByteTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v), + keyComparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v), + providerValueComparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v))); + var valueTypeEnumerableElementType = valueTypeEnumerable.SetElementType(typeof(byte)); + valueTypeEnumerableElementType.TypeMapping = valueTypeEnumerable.TypeMapping.ElementTypeMapping; + + var valueTypeIList = runtimeEntityType.AddProperty( + "ValueTypeIList", + typeof(IList), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + valueTypeIList.SetGetter( + IList (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.ValueTypeIList(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.ValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IList value) => + { + PrincipalBaseUnsafeAccessors.ValueTypeIList(instance) = value; + return instance; + }); + valueTypeIList.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, IList value) => + { + PrincipalBaseUnsafeAccessors.ValueTypeIList(instance) = value; + return instance; + }); + valueTypeIList.SetAccessors( + IList (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.ValueTypeIList(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IList (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.ValueTypeIList(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + IList (IInternalEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 13), + IList (IInternalEntry entry) => entry.GetCurrentValue>(valueTypeIList)); + valueTypeIList.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + valueTypeIList.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ListOfValueTypesComparer, byte>(new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v)), + keyComparer: new ListOfValueTypesComparer, byte>(new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v)), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255), + converter: new CollectionToJsonStringConverter(new JsonCollectionOfStructsReaderWriter, byte>( + JsonByteReaderWriter.Instance)), + jsonValueReaderWriter: new JsonCollectionOfStructsReaderWriter, byte>( + JsonByteReaderWriter.Instance), + elementMapping: JetByteTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v), + keyComparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v), + providerValueComparer: new ValueComparer( + bool (byte v1, byte v2) => v1 == v2, + int (byte v) => ((int)v), + byte (byte v) => v))); + var valueTypeIListElementType = valueTypeIList.SetElementType(typeof(byte)); + valueTypeIListElementType.TypeMapping = valueTypeIList.TypeMapping.ElementTypeMapping; + + var valueTypeList = runtimeEntityType.AddProperty( + "ValueTypeList", + typeof(List), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + valueTypeList.SetGetter( + List (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.ValueTypeList(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.ValueTypeList(instance) == null); + valueTypeList.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, List value) => + { + PrincipalBaseUnsafeAccessors.ValueTypeList(instance) = value; + return instance; + }); + valueTypeList.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, List value) => + { + PrincipalBaseUnsafeAccessors.ValueTypeList(instance) = value; + return instance; + }); + valueTypeList.SetAccessors( + List (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.ValueTypeList(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + List (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.ValueTypeList(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + List (IInternalEntry entry) => entry.ReadOriginalValue>(valueTypeList, 14), + List (IInternalEntry entry) => entry.GetCurrentValue>(valueTypeList)); + valueTypeList.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); + valueTypeList.TypeMapping = JetStringTypeMapping.Default.Clone( + comparer: new ListOfValueTypesComparer, short>(new ValueComparer( + bool (short v1, short v2) => v1 == v2, + int (short v) => ((int)v), + short (short v) => v)), + keyComparer: new ListOfValueTypesComparer, short>(new ValueComparer( + bool (short v1, short v2) => v1 == v2, + int (short v) => ((int)v), + short (short v) => v)), + providerValueComparer: new ValueComparer( + bool (string v1, string v2) => v1 == v2, + int (string v) => ((object)v).GetHashCode(), + string (string v) => v), + mappingInfo: new RelationalTypeMappingInfo( + storeTypeName: "varchar(255)", + size: 255), + converter: new CollectionToJsonStringConverter(new JsonCollectionOfStructsReaderWriter, short>( + JsonInt16ReaderWriter.Instance)), + jsonValueReaderWriter: new JsonCollectionOfStructsReaderWriter, short>( + JsonInt16ReaderWriter.Instance), + elementMapping: ShortTypeMapping.Default.Clone( + comparer: new ValueComparer( + bool (short v1, short v2) => v1 == v2, + int (short v) => ((int)v), + short (short v) => v), + keyComparer: new ValueComparer( + bool (short v1, short v2) => v1 == v2, + int (short v) => ((int)v), + short (short v) => v), + providerValueComparer: new ValueComparer( + bool (short v1, short v2) => v1 == v2, + int (short v) => ((int)v), + short (short v) => v))); + var valueTypeListElementType = valueTypeList.SetElementType(typeof(short)); + valueTypeListElementType.TypeMapping = valueTypeList.TypeMapping.ElementTypeMapping; + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { principalDerivedId }); + + var principalIndex = runtimeEntityType.AddIndex( + new[] { principalBaseId }, + name: "PrincipalIndex", + unique: true); + principalIndex.AddAnnotation("Relational:Filter", "AlternateId <> NULL"); + principalIndex.AddAnnotation("Relational:Name", "PIX"); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalBaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType); + + var deriveds = principalEntityType.AddNavigation("Deriveds", + runtimeForeignKey, + onDependent: false, + typeof(ICollection), + propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Deriveds", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + deriveds.SetGetter( + ICollection (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.Deriveds(instance), + bool (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseUnsafeAccessors.Deriveds(instance) == null); + deriveds.SetSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, ICollection value) => + { + PrincipalBaseUnsafeAccessors.Deriveds(instance) = value; + return instance; + }); + deriveds.SetMaterializationSetter( + CompiledModelTestBase.PrincipalBase (CompiledModelTestBase.PrincipalBase instance, ICollection value) => + { + PrincipalBaseUnsafeAccessors.Deriveds(instance) = value; + return instance; + }); + deriveds.SetAccessors( + ICollection (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.Deriveds(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + ICollection (IInternalEntry entry) => PrincipalBaseUnsafeAccessors.Deriveds(((CompiledModelTestBase.PrincipalBase)(entry.Entity))), + null, + ICollection (IInternalEntry entry) => entry.GetCurrentValue>(deriveds)); + deriveds.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: -1); + deriveds.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + ICollection (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseUnsafeAccessors.Deriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseUnsafeAccessors.Deriveds(entity) = ((ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseUnsafeAccessors.Deriveds(entity) = ((ICollection)collection), + ICollection (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + ICollection () => ((ICollection)(((ICollection)(new HashSet(ReferenceEqualityComparer.Instance)))))); + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PrincipalDerivedId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType); + + var principals = principalEntityType.AddNavigation("Principals", + runtimeForeignKey, + onDependent: false, + typeof(ICollection), + propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Principals", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + principals.SetGetter( + ICollection (CompiledModelTestBase.PrincipalDerived> instance) => PrincipalDerivedUnsafeAccessors>.Principals(instance), + bool (CompiledModelTestBase.PrincipalDerived> instance) => PrincipalDerivedUnsafeAccessors>.Principals(instance) == null); + principals.SetSetter( + CompiledModelTestBase.PrincipalDerived> (CompiledModelTestBase.PrincipalDerived> instance, ICollection value) => + { + PrincipalDerivedUnsafeAccessors>.Principals(instance) = value; + return instance; + }); + principals.SetMaterializationSetter( + CompiledModelTestBase.PrincipalDerived> (CompiledModelTestBase.PrincipalDerived> instance, ICollection value) => + { + PrincipalDerivedUnsafeAccessors>.Principals(instance) = value; + return instance; + }); + principals.SetAccessors( + ICollection (IInternalEntry entry) => PrincipalDerivedUnsafeAccessors>.Principals(((CompiledModelTestBase.PrincipalDerived>)(entry.Entity))), + ICollection (IInternalEntry entry) => PrincipalDerivedUnsafeAccessors>.Principals(((CompiledModelTestBase.PrincipalDerived>)(entry.Entity))), + null, + ICollection (IInternalEntry entry) => entry.GetCurrentValue>(principals)); + principals.SetPropertyIndexes( + index: 2, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 5, + storeGenerationIndex: -1); + principals.SetCollectionAccessor>, ICollection, CompiledModelTestBase.PrincipalBase>( + ICollection (CompiledModelTestBase.PrincipalDerived> entity) => PrincipalDerivedUnsafeAccessors>.Principals(entity), + (CompiledModelTestBase.PrincipalDerived> entity, ICollection collection) => PrincipalDerivedUnsafeAccessors>.Principals(entity) = ((ICollection)collection), + (CompiledModelTestBase.PrincipalDerived> entity, ICollection collection) => PrincipalDerivedUnsafeAccessors>.Principals(entity) = ((ICollection)collection), + ICollection (CompiledModelTestBase.PrincipalDerived> entity, Action>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>, ICollection, CompiledModelTestBase.PrincipalBase>(entity, setter), + ICollection () => ((ICollection)(((ICollection)(new HashSet(ReferenceEqualityComparer.Instance)))))); + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + var id = runtimeEntityType.FindProperty("Id"); + var enum1 = runtimeEntityType.FindProperty("Enum1"); + var enum2 = runtimeEntityType.FindProperty("Enum2"); + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1"); + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2"); + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId"); + var principalDerivedId = runtimeEntityType.FindProperty("PrincipalDerivedId"); + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray"); + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable"); + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList"); + var refTypeList = runtimeEntityType.FindProperty("RefTypeList"); + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray"); + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable"); + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList"); + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList"); + var key = runtimeEntityType.FindKey(new[] { id }); + key.SetPrincipalKeyValueFactory(KeyValueFactoryFactory.CreateSimpleNullableFactory(key)); + key.SetIdentityMapFactory(IdentityMapFactoryFactory.CreateFactory(key)); + var deriveds = runtimeEntityType.FindNavigation("Deriveds"); + runtimeEntityType.SetOriginalValuesFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.PrincipalBase)(source.Entity)); + return ((ISnapshot)(new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>((source.GetCurrentValue(id) == null ? null : ((ValueComparer)(((IProperty)id).GetValueComparer())).Snapshot(source.GetCurrentValue(id))), ((ValueComparer)(((IProperty)enum1).GetValueComparer())).Snapshot(source.GetCurrentValue(enum1)), (source.GetCurrentValue(enum2) == null ? null : ((ValueComparer)(((IProperty)enum2).GetValueComparer())).Snapshot(source.GetCurrentValue(enum2))), ((ValueComparer)(((IProperty)flagsEnum1).GetValueComparer())).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)(((IProperty)flagsEnum2).GetValueComparer())).Snapshot(source.GetCurrentValue(flagsEnum2)), (source.GetCurrentValue(principalBaseId) == null ? null : ((ValueComparer)(((IProperty)principalBaseId).GetValueComparer())).Snapshot(source.GetCurrentValue(principalBaseId))), (source.GetCurrentValue(principalDerivedId) == null ? null : ((ValueComparer)(((IProperty)principalDerivedId).GetValueComparer())).Snapshot(source.GetCurrentValue(principalDerivedId))), (((object)(source.GetCurrentValue(refTypeArray))) == null ? null : ((IPAddress[])(((ValueComparer)(((IProperty)refTypeArray).GetValueComparer())).Snapshot(((object)(source.GetCurrentValue(refTypeArray))))))), (((object)(source.GetCurrentValue>(refTypeEnumerable))) == null ? null : ((IEnumerable)(((ValueComparer)(((IProperty)refTypeEnumerable).GetValueComparer())).Snapshot(((object)(source.GetCurrentValue>(refTypeEnumerable))))))), (((object)(source.GetCurrentValue>(refTypeIList))) == null ? null : ((IList)(((ValueComparer)(((IProperty)refTypeIList).GetValueComparer())).Snapshot(((object)(source.GetCurrentValue>(refTypeIList))))))), (((object)(source.GetCurrentValue>(refTypeList))) == null ? null : ((List)(((ValueComparer)(((IProperty)refTypeList).GetValueComparer())).Snapshot(((object)(source.GetCurrentValue>(refTypeList))))))), (((IEnumerable)(source.GetCurrentValue(valueTypeArray))) == null ? null : ((DateTime[])(((ValueComparer>)(((IProperty)valueTypeArray).GetValueComparer())).Snapshot(((IEnumerable)(source.GetCurrentValue(valueTypeArray))))))), (source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)(((IProperty)valueTypeEnumerable).GetValueComparer())).Snapshot(source.GetCurrentValue>(valueTypeEnumerable))), (((IEnumerable)(source.GetCurrentValue>(valueTypeIList))) == null ? null : ((IList)(((ValueComparer>)(((IProperty)valueTypeIList).GetValueComparer())).Snapshot(((IEnumerable)(source.GetCurrentValue>(valueTypeIList))))))), (((IEnumerable)(source.GetCurrentValue>(valueTypeList))) == null ? null : ((List)(((ValueComparer>)(((IProperty)valueTypeList).GetValueComparer())).Snapshot(((IEnumerable)(source.GetCurrentValue>(valueTypeList)))))))))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + ISnapshot () => ((ISnapshot)(new Snapshot(((ValueComparer)(((IProperty)enum1).GetValueComparer())).Snapshot(default(CompiledModelTestBase.AnEnum)), (default(long? ) == null ? null : ((ValueComparer)(((IProperty)principalBaseId).GetValueComparer())).Snapshot(default(long? ))), (default(long? ) == null ? null : ((ValueComparer)(((IProperty)principalDerivedId).GetValueComparer())).Snapshot(default(long? ))))))); + runtimeEntityType.SetTemporaryValuesFactory( + ISnapshot (IInternalEntry source) => ((ISnapshot)(new Snapshot(default(CompiledModelTestBase.AnEnum), default(long? ), default(long? ))))); + runtimeEntityType.SetShadowValuesFactory( + ISnapshot (IDictionary source) => ((ISnapshot)(new Snapshot((source.ContainsKey("PrincipalBaseId") ? ((long? )(source["PrincipalBaseId"])) : null), (source.ContainsKey("PrincipalDerivedId") ? ((long? )(source["PrincipalDerivedId"])) : null))))); + runtimeEntityType.SetEmptyShadowValuesFactory( + ISnapshot () => ((ISnapshot)(new Snapshot(default(long? ), default(long? ))))); + runtimeEntityType.SetRelationshipSnapshotFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.PrincipalBase)(source.Entity)); + return ((ISnapshot)(new Snapshot((source.GetCurrentValue(id) == null ? null : ((ValueComparer)(((IProperty)id).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(id))), (source.GetCurrentValue(principalBaseId) == null ? null : ((ValueComparer)(((IProperty)principalBaseId).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(principalBaseId))), (source.GetCurrentValue(principalDerivedId) == null ? null : ((ValueComparer)(((IProperty)principalDerivedId).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(principalDerivedId))), SnapshotFactoryFactory.SnapshotCollection(source.GetCurrentValue>(deriveds))))); + }); + runtimeEntityType.SetCounts(new PropertyCounts( + propertyCount: 15, + navigationCount: 1, + complexPropertyCount: 0, + complexCollectionCount: 0, + originalValueCount: 15, + shadowCount: 2, + relationshipCount: 4, + storeGeneratedCount: 3)); + var insertSproc = new RuntimeStoredProcedure( + runtimeEntityType, + "PrincipalBase_Insert", + "TPC", + false); + + var id0 = insertSproc.AddParameter( + "Id", System.Data.ParameterDirection.Input, false, "Id", false); + var principalBaseId0 = insertSproc.AddParameter( + "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); + var principalDerivedId0 = insertSproc.AddParameter( + "PrincipalDerivedId", System.Data.ParameterDirection.Input, false, "PrincipalDerivedId", false); + var enum20 = insertSproc.AddParameter( + "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); + var flagsEnum10 = insertSproc.AddParameter( + "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); + var flagsEnum20 = insertSproc.AddParameter( + "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); + var valueTypeList0 = insertSproc.AddParameter( + "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); + var valueTypeIList0 = insertSproc.AddParameter( + "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); + var valueTypeArray0 = insertSproc.AddParameter( + "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); + var valueTypeEnumerable0 = insertSproc.AddParameter( + "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); + var refTypeList0 = insertSproc.AddParameter( + "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); + var refTypeIList0 = insertSproc.AddParameter( + "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); + var refTypeArray0 = insertSproc.AddParameter( + "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); + var refTypeEnumerable0 = insertSproc.AddParameter( + "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); + var enum10 = insertSproc.AddParameter( + "BaseEnum", System.Data.ParameterDirection.Output, false, "Enum1", false); + enum10.AddAnnotation("foo", "bar"); + insertSproc.AddAnnotation("foo", "bar1"); + runtimeEntityType.AddAnnotation("Relational:InsertStoredProcedure", insertSproc); + + var deleteSproc = new RuntimeStoredProcedure( + runtimeEntityType, + "PrincipalBase_Delete", + "TPC", + false); + + var id1 = deleteSproc.AddParameter( + "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); + var rowsAffected = deleteSproc.AddParameter( + "RowsAffected", System.Data.ParameterDirection.Output, true, null, null); + runtimeEntityType.AddAnnotation("Relational:DeleteStoredProcedure", deleteSproc); + + var updateSproc = new RuntimeStoredProcedure( + runtimeEntityType, + "PrincipalBase_Update", + "TPC", + false); + + var principalBaseId1 = updateSproc.AddParameter( + "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); + var principalDerivedId1 = updateSproc.AddParameter( + "PrincipalDerivedId", System.Data.ParameterDirection.Input, false, "PrincipalDerivedId", false); + var enum11 = updateSproc.AddParameter( + "Enum1", System.Data.ParameterDirection.Input, false, "Enum1", false); + var enum21 = updateSproc.AddParameter( + "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); + var flagsEnum11 = updateSproc.AddParameter( + "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); + var flagsEnum21 = updateSproc.AddParameter( + "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); + var valueTypeList1 = updateSproc.AddParameter( + "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); + var valueTypeIList1 = updateSproc.AddParameter( + "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); + var valueTypeArray1 = updateSproc.AddParameter( + "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); + var valueTypeEnumerable1 = updateSproc.AddParameter( + "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); + var refTypeList1 = updateSproc.AddParameter( + "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); + var refTypeIList1 = updateSproc.AddParameter( + "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); + var refTypeArray1 = updateSproc.AddParameter( + "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); + var refTypeEnumerable1 = updateSproc.AddParameter( + "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); + var id2 = updateSproc.AddParameter( + "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); + runtimeEntityType.AddAnnotation("Relational:UpdateStoredProcedure", updateSproc); + + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPC"); + runtimeEntityType.AddAnnotation("Relational:Schema", "TPC"); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "PrincipalBase"); + runtimeEntityType.AddAnnotation("Relational:ViewDefinitionSql", null); + runtimeEntityType.AddAnnotation("Relational:ViewName", "PrincipalBaseView"); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", "TPC"); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalBaseUnsafeAccessors.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalBaseUnsafeAccessors.cs new file mode 100644 index 00000000..5495088c --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalBaseUnsafeAccessors.cs @@ -0,0 +1,57 @@ +// +using System; +using System.Collections.Generic; +using System.Net; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public static class PrincipalBaseUnsafeAccessors + { + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref long? Id(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref CompiledModelTestBase.AnEnum Enum1(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref CompiledModelTestBase.AnEnum? Enum2(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref CompiledModelTestBase.AFlagsEnum FlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref CompiledModelTestBase.AFlagsEnum FlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref IPAddress[] RefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref IEnumerable RefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref IList RefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref List RefTypeList(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref DateTime[] ValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref IEnumerable ValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref IList ValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref List ValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref ICollection Deriveds(CompiledModelTestBase.PrincipalBase @this); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalDerivedEntityType.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalDerivedEntityType.cs new file mode 100644 index 00000000..260d0089 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalDerivedEntityType.cs @@ -0,0 +1,183 @@ +// +using System; +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + [EntityFrameworkInternal] + public partial class PrincipalDerivedEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelTestBase+PrincipalDerived>", + typeof(CompiledModelTestBase.PrincipalDerived>), + baseEntityType, + discriminatorValue: "PrincipalDerived>", + propertyCount: 0, + navigationCount: 2); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + var id = runtimeEntityType.FindProperty("Id"); + var enum1 = runtimeEntityType.FindProperty("Enum1"); + var enum2 = runtimeEntityType.FindProperty("Enum2"); + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1"); + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2"); + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId"); + var principalDerivedId = runtimeEntityType.FindProperty("PrincipalDerivedId"); + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray"); + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable"); + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList"); + var refTypeList = runtimeEntityType.FindProperty("RefTypeList"); + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray"); + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable"); + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList"); + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList"); + var deriveds = runtimeEntityType.FindNavigation("Deriveds"); + var dependent = runtimeEntityType.FindNavigation("Dependent"); + var principals = runtimeEntityType.FindNavigation("Principals"); + runtimeEntityType.SetOriginalValuesFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.PrincipalDerived>)(source.Entity)); + return ((ISnapshot)(new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>((source.GetCurrentValue(id) == null ? null : ((ValueComparer)(((IProperty)id).GetValueComparer())).Snapshot(source.GetCurrentValue(id))), ((ValueComparer)(((IProperty)enum1).GetValueComparer())).Snapshot(source.GetCurrentValue(enum1)), (source.GetCurrentValue(enum2) == null ? null : ((ValueComparer)(((IProperty)enum2).GetValueComparer())).Snapshot(source.GetCurrentValue(enum2))), ((ValueComparer)(((IProperty)flagsEnum1).GetValueComparer())).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)(((IProperty)flagsEnum2).GetValueComparer())).Snapshot(source.GetCurrentValue(flagsEnum2)), (source.GetCurrentValue(principalBaseId) == null ? null : ((ValueComparer)(((IProperty)principalBaseId).GetValueComparer())).Snapshot(source.GetCurrentValue(principalBaseId))), (source.GetCurrentValue(principalDerivedId) == null ? null : ((ValueComparer)(((IProperty)principalDerivedId).GetValueComparer())).Snapshot(source.GetCurrentValue(principalDerivedId))), (((object)(source.GetCurrentValue(refTypeArray))) == null ? null : ((IPAddress[])(((ValueComparer)(((IProperty)refTypeArray).GetValueComparer())).Snapshot(((object)(source.GetCurrentValue(refTypeArray))))))), (((object)(source.GetCurrentValue>(refTypeEnumerable))) == null ? null : ((IEnumerable)(((ValueComparer)(((IProperty)refTypeEnumerable).GetValueComparer())).Snapshot(((object)(source.GetCurrentValue>(refTypeEnumerable))))))), (((object)(source.GetCurrentValue>(refTypeIList))) == null ? null : ((IList)(((ValueComparer)(((IProperty)refTypeIList).GetValueComparer())).Snapshot(((object)(source.GetCurrentValue>(refTypeIList))))))), (((object)(source.GetCurrentValue>(refTypeList))) == null ? null : ((List)(((ValueComparer)(((IProperty)refTypeList).GetValueComparer())).Snapshot(((object)(source.GetCurrentValue>(refTypeList))))))), (((IEnumerable)(source.GetCurrentValue(valueTypeArray))) == null ? null : ((DateTime[])(((ValueComparer>)(((IProperty)valueTypeArray).GetValueComparer())).Snapshot(((IEnumerable)(source.GetCurrentValue(valueTypeArray))))))), (source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)(((IProperty)valueTypeEnumerable).GetValueComparer())).Snapshot(source.GetCurrentValue>(valueTypeEnumerable))), (((IEnumerable)(source.GetCurrentValue>(valueTypeIList))) == null ? null : ((IList)(((ValueComparer>)(((IProperty)valueTypeIList).GetValueComparer())).Snapshot(((IEnumerable)(source.GetCurrentValue>(valueTypeIList))))))), (((IEnumerable)(source.GetCurrentValue>(valueTypeList))) == null ? null : ((List)(((ValueComparer>)(((IProperty)valueTypeList).GetValueComparer())).Snapshot(((IEnumerable)(source.GetCurrentValue>(valueTypeList)))))))))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + ISnapshot () => ((ISnapshot)(new Snapshot(((ValueComparer)(((IProperty)enum1).GetValueComparer())).Snapshot(default(CompiledModelTestBase.AnEnum)), (default(long? ) == null ? null : ((ValueComparer)(((IProperty)principalBaseId).GetValueComparer())).Snapshot(default(long? ))), (default(long? ) == null ? null : ((ValueComparer)(((IProperty)principalDerivedId).GetValueComparer())).Snapshot(default(long? ))))))); + runtimeEntityType.SetTemporaryValuesFactory( + ISnapshot (IInternalEntry source) => ((ISnapshot)(new Snapshot(default(CompiledModelTestBase.AnEnum), default(long? ), default(long? ))))); + runtimeEntityType.SetShadowValuesFactory( + ISnapshot (IDictionary source) => ((ISnapshot)(new Snapshot((source.ContainsKey("PrincipalBaseId") ? ((long? )(source["PrincipalBaseId"])) : null), (source.ContainsKey("PrincipalDerivedId") ? ((long? )(source["PrincipalDerivedId"])) : null))))); + runtimeEntityType.SetEmptyShadowValuesFactory( + ISnapshot () => ((ISnapshot)(new Snapshot(default(long? ), default(long? ))))); + runtimeEntityType.SetRelationshipSnapshotFactory( + ISnapshot (IInternalEntry source) => + { + var structuralType = ((CompiledModelTestBase.PrincipalDerived>)(source.Entity)); + return ((ISnapshot)(new Snapshot((source.GetCurrentValue(id) == null ? null : ((ValueComparer)(((IProperty)id).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(id))), (source.GetCurrentValue(principalBaseId) == null ? null : ((ValueComparer)(((IProperty)principalBaseId).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(principalBaseId))), (source.GetCurrentValue(principalDerivedId) == null ? null : ((ValueComparer)(((IProperty)principalDerivedId).GetKeyValueComparer())).Snapshot(source.GetCurrentValue(principalDerivedId))), SnapshotFactoryFactory.SnapshotCollection(source.GetCurrentValue>(deriveds)), source.GetCurrentValue>(dependent), SnapshotFactoryFactory.SnapshotCollection(source.GetCurrentValue>(principals))))); + }); + runtimeEntityType.SetCounts(new PropertyCounts( + propertyCount: 15, + navigationCount: 3, + complexPropertyCount: 0, + complexCollectionCount: 0, + originalValueCount: 15, + shadowCount: 2, + relationshipCount: 6, + storeGeneratedCount: 3)); + var insertSproc = new RuntimeStoredProcedure( + runtimeEntityType, + "Derived_Insert", + "TPC", + false); + + var id0 = insertSproc.AddParameter( + "Id", System.Data.ParameterDirection.Input, false, "Id", false); + var principalBaseId0 = insertSproc.AddParameter( + "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); + var principalDerivedId0 = insertSproc.AddParameter( + "PrincipalDerivedId", System.Data.ParameterDirection.Input, false, "PrincipalDerivedId", false); + var enum20 = insertSproc.AddParameter( + "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); + var flagsEnum10 = insertSproc.AddParameter( + "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); + var flagsEnum20 = insertSproc.AddParameter( + "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); + var valueTypeList0 = insertSproc.AddParameter( + "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); + var valueTypeIList0 = insertSproc.AddParameter( + "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); + var valueTypeArray0 = insertSproc.AddParameter( + "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); + var valueTypeEnumerable0 = insertSproc.AddParameter( + "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); + var refTypeList0 = insertSproc.AddParameter( + "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); + var refTypeIList0 = insertSproc.AddParameter( + "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); + var refTypeArray0 = insertSproc.AddParameter( + "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); + var refTypeEnumerable0 = insertSproc.AddParameter( + "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); + var derivedEnum = insertSproc.AddResultColumn( + "DerivedEnum", false, "Enum1"); + derivedEnum.AddAnnotation("foo", "bar3"); + runtimeEntityType.AddAnnotation("Relational:InsertStoredProcedure", insertSproc); + + var deleteSproc = new RuntimeStoredProcedure( + runtimeEntityType, + "Derived_Delete", + "TPC", + false); + + var id1 = deleteSproc.AddParameter( + "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); + runtimeEntityType.AddAnnotation("Relational:DeleteStoredProcedure", deleteSproc); + + var updateSproc = new RuntimeStoredProcedure( + runtimeEntityType, + "Derived_Update", + "Derived", + false); + + var principalBaseId1 = updateSproc.AddParameter( + "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); + var principalDerivedId1 = updateSproc.AddParameter( + "PrincipalDerivedId", System.Data.ParameterDirection.Input, false, "PrincipalDerivedId", false); + var enum10 = updateSproc.AddParameter( + "Enum1", System.Data.ParameterDirection.Input, false, "Enum1", false); + var enum21 = updateSproc.AddParameter( + "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); + var flagsEnum11 = updateSproc.AddParameter( + "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); + var flagsEnum21 = updateSproc.AddParameter( + "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); + var valueTypeList1 = updateSproc.AddParameter( + "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); + var valueTypeIList1 = updateSproc.AddParameter( + "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); + var valueTypeArray1 = updateSproc.AddParameter( + "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); + var valueTypeEnumerable1 = updateSproc.AddParameter( + "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); + var refTypeList1 = updateSproc.AddParameter( + "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); + var refTypeIList1 = updateSproc.AddParameter( + "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); + var refTypeArray1 = updateSproc.AddParameter( + "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); + var refTypeEnumerable1 = updateSproc.AddParameter( + "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); + var id2 = updateSproc.AddParameter( + "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); + runtimeEntityType.AddAnnotation("Relational:UpdateStoredProcedure", updateSproc); + + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", "TPC"); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "PrincipalDerived"); + runtimeEntityType.AddAnnotation("Relational:ViewDefinitionSql", null); + runtimeEntityType.AddAnnotation("Relational:ViewName", "PrincipalDerivedView"); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", "TPC"); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalDerivedUnsafeAccessors.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalDerivedUnsafeAccessors.cs new file mode 100644 index 00000000..33c6bf49 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/Baselines/Tpc_Sprocs/PrincipalDerivedUnsafeAccessors.cs @@ -0,0 +1,20 @@ +// +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.Scaffolding; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace TestNamespace +{ + public static class PrincipalDerivedUnsafeAccessors + where TDependent : class + { + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref TDependent Dependent(CompiledModelTestBase.PrincipalDerived @this); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + public static extern ref ICollection Principals(CompiledModelTestBase.PrincipalDerived @this); + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/CompiledModelJetTest.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/CompiledModelJetTest.cs new file mode 100644 index 00000000..b764ee66 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/CompiledModelJetTest.cs @@ -0,0 +1,263 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// ReSharper disable InconsistentNaming + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using EntityFrameworkCore.Jet.Infrastructure; +using EntityFrameworkCore.Jet.Metadata; +using EntityFrameworkCore.Jet.Metadata.Internal; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.Metadata; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Microsoft.EntityFrameworkCore.TestUtilities; +using Microsoft.Extensions.DependencyInjection; +using NetTopologySuite; +using NetTopologySuite.Geometries; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Xunit; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Scaffolding; + +public class CompiledModelJetTest(NonSharedFixture fixture) : CompiledModelRelationalTestBase(fixture) +{ + protected override void BuildBigModel(ModelBuilder modelBuilder, bool jsonColumns) + { + base.BuildBigModel(modelBuilder, jsonColumns); + + modelBuilder + .UseJetIdentityColumns(3, 2); + + modelBuilder.Entity(eb => + { + if (!jsonColumns) + { + eb.Property(e => e.Id).HasConversion().UseJetIdentityColumn(2, 3).ValueGeneratedOnAdd(); + } + + eb.HasKey(e => new { e.Id, e.AlternateId }); + + eb.OwnsOne( + e => e.Owned, ob => + { + ob.Property(e => e.Details); + + if (!jsonColumns) + { + ob.ToTable( + "PrincipalBase", "mySchema", + t => t.Property("PrincipalBaseId").UseJetIdentityColumn(2, 3)); + } + }); + }); + + modelBuilder.Entity>>(eb => + { + eb.HasMany(e => e.Principals).WithMany(e => (ICollection>>)e.Deriveds) + .UsingEntity(jb => + { + }); + }); + + modelBuilder.Entity(eb => + { + eb.Property(m => m.CharToStringConverterProperty) + .IsFixedLength(); + }); + } + + protected override void AssertBigModel(IModel model, bool jsonColumns) + { + base.AssertBigModel(model, jsonColumns); + /*Assert.Equal( + [RelationalAnnotationNames.MaxIdentifierLength, JetAnnotationNames.ValueGenerationStrategy], + model.GetAnnotations().Select(a => a.Name));*/ + Assert.Equal(JetValueGenerationStrategy.IdentityColumn, model.GetValueGenerationStrategy()); + Assert.Equal( + CoreStrings.RuntimeModelMissingData, + Assert.Throws(() => model.GetPropertyAccessMode()).Message); + Assert.Equal(model[JetAnnotationNames.IdentitySeed], 3); + Assert.Equal(model[JetAnnotationNames.IdentityIncrement], 2); + + var principalBase = model.FindEntityType(typeof(PrincipalBase))!; + var principalId = principalBase.FindProperty(nameof(PrincipalBase.Id))!; + Assert.Equal("integer", principalId.GetColumnType()); + if (jsonColumns) + { + Assert.Equal( + [JetAnnotationNames.ValueGenerationStrategy], + principalId.GetAnnotations().Select(a => a.Name)); + Assert.Equal(JetValueGenerationStrategy.None, principalId.GetValueGenerationStrategy()); + } + else + { + /*Assert.Equal( + [RelationalAnnotationNames.RelationalOverrides, JetAnnotationNames.ValueGenerationStrategy], + principalId.GetAnnotations().Select(a => a.Name));*/ + Assert.Equal(JetValueGenerationStrategy.IdentityColumn, principalId.GetValueGenerationStrategy()); + } + + Assert.Equal(model[JetAnnotationNames.IdentitySeed], 3); + Assert.Equal(model[JetAnnotationNames.IdentityIncrement], 2); + + var principalKey = principalBase.GetKeys().Last(); + + var referenceOwnedNavigation = principalBase.GetNavigations().Single(); + var referenceOwnedType = referenceOwnedNavigation.TargetEntityType; + + var principalTable = StoreObjectIdentifier.Create(referenceOwnedType, StoreObjectType.Table)!.Value; + if (jsonColumns) + { + Assert.Equal( + JetValueGenerationStrategy.None, + principalId.GetValueGenerationStrategy(principalTable)); + } + else + { + Assert.Equal( + JetValueGenerationStrategy.IdentityColumn, + principalId.GetValueGenerationStrategy(principalTable)); + } + + var detailsProperty = referenceOwnedType.FindProperty(nameof(OwnedType.Details))!; + + var principalDerived = model.FindEntityType(typeof(PrincipalDerived>))!; + var ownedCollectionNavigation = principalDerived.GetDeclaredNavigations().Last(); + var collectionOwnedType = ownedCollectionNavigation.TargetEntityType; + + var derivedSkipNavigation = principalDerived.GetDeclaredSkipNavigations().Single(); + var joinType = derivedSkipNavigation.JoinEntityType; + + var rowid = joinType.GetProperties().Single(p => !p.IsForeignKey()); + Assert.Equal("varbinary(8)", rowid.GetColumnType()); + Assert.Equal(JetValueGenerationStrategy.None, rowid.GetValueGenerationStrategy()); + + var manyTypesType = model.FindEntityType(typeof(ManyTypes))!; + var stringProperty = manyTypesType.FindProperty(nameof(ManyTypes.String))!; + Assert.True(stringProperty.FindRelationalTypeMapping()!.IsUnicode); + Assert.False(stringProperty.FindRelationalTypeMapping()!.IsFixedLength); + var charToStringConverterProperty = manyTypesType.FindProperty(nameof(ManyTypes.CharToStringConverterProperty))!; + Assert.True(charToStringConverterProperty.FindRelationalTypeMapping()!.IsUnicode); + Assert.True(charToStringConverterProperty.FindRelationalTypeMapping()!.IsFixedLength); + + var dependentNavigation = principalDerived.GetDeclaredNavigations().First(); + var dependentBase = dependentNavigation.TargetEntityType; + var dependentDerived = dependentBase.GetDerivedTypes().Single(); + + var dependentData = dependentDerived.GetDeclaredProperties().First(); + Assert.Equal("char(20)", dependentData.GetColumnType()); + + var dependentMoney = dependentDerived.GetDeclaredProperties().Last(); + Assert.Equal("decimal(9,3)", dependentMoney.GetColumnType()); + Assert.Equal( + [ + dependentBase, + dependentDerived, + manyTypesType, + principalBase, + referenceOwnedType, + principalDerived, + collectionOwnedType, + joinType + ], + model.GetEntityTypes()); + } + + protected override void BuildComplexTypesModel(ModelBuilder modelBuilder) + { + base.BuildComplexTypesModel(modelBuilder); + + modelBuilder.Entity(eb => + { + eb.ComplexProperty( + e => e.Owned, eb => + { + eb.Ignore(c => c.Context); + + eb.Property(c => c.Details); + }); + }); + } + + protected override void AssertComplexTypes(IModel model) + { + base.AssertComplexTypes(model); + + var principalBase = model.FindEntityType(typeof(PrincipalBase))!; + var complexProperty = principalBase.GetComplexProperties().Single(); + var complexType = complexProperty.ComplexType; + var detailsProperty = complexType.FindProperty(nameof(OwnedType.Details))!; + Assert.Equal( + [ + CoreAnnotationNames.MaxLength, + CoreAnnotationNames.Precision, + RelationalAnnotationNames.ColumnName, + RelationalAnnotationNames.ColumnType, + CoreAnnotationNames.Scale, + JetAnnotationNames.ValueGenerationStrategy, + CoreAnnotationNames.Unicode, + "foo" + ], + detailsProperty.GetAnnotations().Select(a => a.Name)); + + var dbFunction = model.FindDbFunction("PrincipalBaseTvf")!; + Assert.Equal("dbo", dbFunction.Schema); + + Assert.Equal(JetValueGenerationStrategy.None, detailsProperty.GetValueGenerationStrategy()); + Assert.Equal( + CoreStrings.RuntimeModelMissingData, + Assert.Throws(() => detailsProperty.GetJetIdentitySeed()).Message); + Assert.Equal( + CoreStrings.RuntimeModelMissingData, + Assert.Throws(() => detailsProperty.GetJetIdentityIncrement()).Message); + } + + /*public override Task BigModel_with_JSON_columns() + => Task.CompletedTask; + + //Sprocs not supported + public override Task ComplexTypes() + => Task.CompletedTask; + + //Not supported + public override Task Sequences() + => Task.CompletedTask; + + //Sprocs not supported + public override Task Tpc_Sprocs() + => Task.CompletedTask; + + public override Task Triggers() + => Task.CompletedTask; + + public override Task DbFunctions() + => Task.CompletedTask;*/ + + protected override TestHelpers TestHelpers + => JetTestHelpers.Instance; + + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + protected override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + { + builder = base.AddOptions(builder) + .ConfigureWarnings(w => w.Ignore(JetEventId.DecimalTypeDefaultWarning)); + new JetDbContextOptionsBuilder(builder); + return builder; + } + + protected override BuildSource AddReferences(BuildSource build, [CallerFilePath] string filePath = "") + { + base.AddReferences(build); + build.References.Add(BuildReference.ByName("EntityFrameworkCore.Jet")); + return build; + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Scaffolding/JetDatabaseModelFactoryTest.cs b/test/EFCore.Jet.FunctionalTests/Scaffolding/JetDatabaseModelFactoryTest.cs index 7b7e1027..06f1c37f 100644 --- a/test/EFCore.Jet.FunctionalTests/Scaffolding/JetDatabaseModelFactoryTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Scaffolding/JetDatabaseModelFactoryTest.cs @@ -2074,36 +2074,6 @@ CONSTRAINT MYFK FOREIGN KEY (ForeignKeyId) REFERENCES PrincipalTable(Id) ON DELE DROP TABLE PrincipalTable; """); - [ConditionalFact] - public void Skip_reflexive_foreign_key() - => Test( - """ - - CREATE TABLE PrincipalTable ( - Id int PRIMARY KEY, - CONSTRAINT MYFK FOREIGN KEY (Id) REFERENCES PrincipalTable(Id) - ); - """, - [], - [], - dbModel => - { - var level = Fixture.OperationReporter.Messages - .Single( - m => m.Message - == JetResources.LogReflexiveConstraintIgnored(new TestLogger()) - .GenerateMessage("MYFK", "dbo.PrincipalTable")).Level; - - Assert.Equal(LogLevel.Debug, level); - - var table = Assert.Single(dbModel.Tables); - Assert.Empty(table.ForeignKeys); - }, - """ - - DROP TABLE PrincipalTable; - """); - /*[ConditionalFact] public void Skip_duplicate_foreign_key() => Test( diff --git a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs deleted file mode 100644 index 0efd082d..00000000 --- a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs +++ /dev/null @@ -1,715 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using Microsoft.EntityFrameworkCore.TestUtilities; -using Microsoft.EntityFrameworkCore.Update; -using System; -using System.Threading.Tasks; -using Xunit; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Update; - -public class StoredProcedureUpdateJetTest(NonSharedFixture fixture) : StoredProcedureUpdateTestBase(fixture) -{ - public override async Task Insert_with_output_parameter(bool async) - { - await base.Insert_with_output_parameter( - async, -""" -CREATE PROCEDURE Entity_Insert(@Name varchar(max), @Id int OUT) -AS BEGIN - INSERT INTO [Entity] ([Name]) VALUES (@Name); - SET @Id = SCOPE_IDENTITY(); -END -"""); - - AssertSql( -""" -@p0='New' (Size = 4000) -@p1='1' (Direction = Output) - -SET NOCOUNT ON; -EXEC [Entity_Insert] @p0, @p1 OUTPUT; -"""); - } - - public override async Task Insert_twice_with_output_parameter(bool async) - { - await base.Insert_twice_with_output_parameter( - async, -""" -CREATE PROCEDURE Entity_Insert(@Name varchar(max), @Id int OUT) -AS BEGIN - INSERT INTO [Entity] ([Name]) VALUES (@Name); - SET @Id = SCOPE_IDENTITY(); -END -"""); - - AssertSql( -""" -@p0='New1' (Size = 4000) -@p1='1' (Direction = Output) -@p2='New2' (Size = 4000) -@p3='2' (Direction = Output) - -SET NOCOUNT ON; -EXEC [Entity_Insert] @p0, @p1 OUTPUT; -EXEC [Entity_Insert] @p2, @p3 OUTPUT; -"""); - } - - public override async Task Insert_with_result_column(bool async) - { - await base.Insert_with_result_column( - async, -""" -CREATE PROCEDURE Entity_Insert(@Name varchar(max)) -AS INSERT INTO [Entity] ([Name]) OUTPUT [Inserted].[Id] VALUES (@Name) -"""); - - AssertSql( -""" -@p0='Foo' (Size = 4000) - -SET NOCOUNT ON; -EXEC [Entity_Insert] @p0; -"""); - } - - public override async Task Insert_with_two_result_columns(bool async) - { - await base.Insert_with_two_result_columns( - async, -""" -CREATE PROCEDURE EntityWithAdditionalProperty_Insert(@Name varchar(max)) -AS INSERT INTO [EntityWithAdditionalProperty] ([Name]) OUTPUT [Inserted].[AdditionalProperty], [Inserted].[Id] VALUES (@Name) -"""); - - AssertSql( -""" -@p0='Foo' (Size = 4000) - -SET NOCOUNT ON; -EXEC [EntityWithAdditionalProperty_Insert] @p0; -"""); - } - - public override async Task Insert_with_output_parameter_and_result_column(bool async) - { - await base.Insert_with_output_parameter_and_result_column( - async, -""" -CREATE PROCEDURE EntityWithAdditionalProperty_Insert(@Id int OUT, @Name varchar(max)) -AS BEGIN - INSERT INTO [EntityWithAdditionalProperty] ([Name]) VALUES (@Name); - SET @Id = SCOPE_IDENTITY(); - SELECT [AdditionalProperty] FROM [EntityWithAdditionalProperty] WHERE [Id] = @Id -END -"""); - - AssertSql( -""" -@p0=NULL (Nullable = false) (Direction = Output) (DbType = Int32) -@p1='Foo' (Size = 4000) - -SET NOCOUNT ON; -EXEC [EntityWithAdditionalProperty_Insert] @p0 OUTPUT, @p1; -"""); - } - - public override async Task Update(bool async) - { - await base.Update( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @Name varchar(max)) -AS UPDATE [Entity] SET [Name] = @Name WHERE [Id] = @id -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) - -SET NOCOUNT ON; -EXEC [Entity_Update] @p0, @p1; -"""); - } - - public override async Task Update_partial(bool async) - { - await base.Update_partial( - async, -""" -CREATE PROCEDURE EntityWithAdditionalProperty_Update(@Id int, @Name varchar(max), @AdditionalProperty int) -AS UPDATE [EntityWithAdditionalProperty] SET [Name] = @Name, [AdditionalProperty] = @AdditionalProperty WHERE [Id] = @id -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) -@p2='8' - -SET NOCOUNT ON; -EXEC [EntityWithAdditionalProperty_Update] @p0, @p1, @p2; -"""); - } - - public override async Task Update_with_output_parameter_and_rows_affected_result_column(bool async) - { - await base.Update_with_output_parameter_and_rows_affected_result_column( - async, -""" -CREATE PROCEDURE EntityWithAdditionalProperty_Update(@Id int, @Name varchar(max), @AdditionalProperty int OUT) -AS BEGIN - UPDATE [EntityWithAdditionalProperty] SET [Name] = @Name, @AdditionalProperty = [AdditionalProperty] WHERE [Id] = @Id; - SELECT @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) -@p2=NULL (Nullable = false) (Direction = Output) (DbType = Int32) - -SET NOCOUNT ON; -EXEC [EntityWithAdditionalProperty_Update] @p0, @p1, @p2 OUTPUT; -"""); - } - - public override async Task Update_with_output_parameter_and_rows_affected_result_column_concurrency_failure(bool async) - { - await base.Update_with_output_parameter_and_rows_affected_result_column_concurrency_failure( - async, -""" -CREATE PROCEDURE EntityWithAdditionalProperty_Update(@Id int, @Name varchar(max), @AdditionalProperty int OUT) -AS BEGIN - UPDATE [EntityWithAdditionalProperty] SET [Name] = @Name, @AdditionalProperty = [AdditionalProperty] WHERE [Id] = @Id; - SELECT @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) -@p2=NULL (Nullable = false) (Direction = Output) (DbType = Int32) - -SET NOCOUNT ON; -EXEC [EntityWithAdditionalProperty_Update] @p0, @p1, @p2 OUTPUT; -"""); - } - - public override async Task Delete(bool async) - { - await base.Delete( - async, -""" -CREATE PROCEDURE Entity_Delete(@Id int) -AS DELETE FROM [Entity] WHERE [Id] = @Id -"""); - - AssertSql( - """ -@p0='1' - -EXEC `Entity_Delete` p0; -"""); - } - - public override async Task Delete_and_insert(bool async) - { - await base.Delete_and_insert( - async, -""" -CREATE PROCEDURE Entity_Insert(@Name varchar(255), @Id int OUT) -AS BEGIN - INSERT INTO [Entity] ([Name]) VALUES (@Name); - SET @Id = SCOPE_IDENTITY(); -END; - -GO; - -CREATE PROCEDURE Entity_Delete(@Id int) -AS DELETE FROM [Entity] WHERE [Id] = @Id; -"""); - - AssertSql( -""" -@p0='1' -@p1='Entity2' (Size = 4000) -@p2='2' (Direction = Output) - -SET NOCOUNT ON; -EXEC [Entity_Delete] @p0; -EXEC [Entity_Insert] @p1, @p2 OUTPUT; -"""); - } - - public override async Task Rows_affected_parameter(bool async) - { - await base.Rows_affected_parameter( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @Name varchar(max), @RowsAffected int OUT) -AS BEGIN - UPDATE [Entity] SET [Name] = @Name WHERE [Id] = @Id; - SET @RowsAffected = @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) -@p2='1' (Direction = Output) - -SET NOCOUNT ON; -EXEC [Entity_Update] @p0, @p1, @p2 OUTPUT; -"""); - } - - public override async Task Rows_affected_parameter_and_concurrency_failure(bool async) - { - await base.Rows_affected_parameter_and_concurrency_failure( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @Name varchar(max), @RowsAffected int OUT) -AS BEGIN - UPDATE [Entity] SET [Name] = @Name WHERE [Id] = @Id; - SET @RowsAffected = @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) -@p2='0' (Direction = Output) - -SET NOCOUNT ON; -EXEC [Entity_Update] @p0, @p1, @p2 OUTPUT; -"""); - } - - public override async Task Rows_affected_result_column(bool async) - { - await base.Rows_affected_result_column( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @Name varchar(max)) -AS BEGIN - UPDATE [Entity] SET [Name] = @Name WHERE [Id] = @Id; - SELECT @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) - -SET NOCOUNT ON; -EXEC [Entity_Update] @p0, @p1; -"""); - } - - public override async Task Rows_affected_result_column_and_concurrency_failure(bool async) - { - await base.Rows_affected_result_column_and_concurrency_failure( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @Name varchar(max)) -AS BEGIN - UPDATE [Entity] SET [Name] = @Name WHERE [Id] = @Id; - SELECT @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) - -SET NOCOUNT ON; -EXEC [Entity_Update] @p0, @p1; -"""); - } - - public override async Task Rows_affected_return_value(bool async) - { - await base.Rows_affected_return_value( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @Name varchar(max)) -AS BEGIN - UPDATE [Entity] SET [Name] = @Name WHERE [Id] = @Id; - RETURN @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='1' (Direction = Output) -@p1='1' -@p2='Updated' (Size = 4000) - -SET NOCOUNT ON; -EXEC @p0 = [Entity_Update] @p1, @p2; -"""); - } - - public override async Task Rows_affected_return_value_and_concurrency_failure(bool async) - { - await base.Rows_affected_return_value_and_concurrency_failure( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @Name varchar(max)) -AS BEGIN - UPDATE [Entity] SET [Name] = @Name WHERE [Id] = @Id; - RETURN @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='0' (Direction = Output) -@p1='1' -@p2='Updated' (Size = 4000) - -SET NOCOUNT ON; -EXEC @p0 = [Entity_Update] @p1, @p2; -"""); - } - - public override async Task Store_generated_concurrency_token_as_in_out_parameter(bool async) - { - await base.Store_generated_concurrency_token_as_in_out_parameter( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @ConcurrencyToken rowversion OUT, @Name varchar(max), @RowsAffected int OUT) -AS BEGIN - UPDATE [Entity] SET [Name] = @Name WHERE [Id] = @Id AND [ConcurrencyToken] = @ConcurrencyToken; - SET @RowsAffected = @@ROWCOUNT; -END -"""); - - // Can't assert SQL baseline as usual because the concurrency token changes - Assert.Contains("(Size = 8) (Direction = InputOutput)", TestSqlLoggerFactory.Sql); - - Assert.Equal( - """ - @p2='Updated' (Size = 4000) - @p3='0' (Direction = Output) - - SET NOCOUNT ON; - EXEC [Entity_Update] @p0, @p1 OUTPUT, @p2, @p3 OUTPUT; - """, - TestSqlLoggerFactory.Sql[TestSqlLoggerFactory.Sql.IndexOf("@p2", StringComparison.Ordinal)..], - ignoreLineEndingDifferences: true); - } - - public override async Task Store_generated_concurrency_token_as_two_parameters(bool async) - { - await base.Store_generated_concurrency_token_as_two_parameters( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @ConcurrencyTokenIn rowversion, @Name varchar(max), @ConcurrencyTokenOut rowversion OUT, @RowsAffected int OUT) -AS BEGIN - UPDATE [Entity] SET [Name] = @Name, @ConcurrencyTokenOut = [ConcurrencyToken] WHERE [Id] = @Id AND [ConcurrencyToken] = @ConcurrencyTokenIn; - SET @RowsAffected = @@ROWCOUNT; -END -"""); - - // Can't assert SQL baseline as usual because the concurrency token changes - Assert.Equal( - """ - @p2='Updated' (Size = 4000) - @p3=NULL (Size = 8) (Direction = Output) (DbType = Binary) - @p4='0' (Direction = Output) - - SET NOCOUNT ON; - EXEC [Entity_Update] @p0, @p1, @p2, @p3 OUTPUT, @p4 OUTPUT; - """, - TestSqlLoggerFactory.Sql[TestSqlLoggerFactory.Sql.IndexOf("@p2", StringComparison.Ordinal)..], - ignoreLineEndingDifferences: true); - } - - public override async Task User_managed_concurrency_token(bool async) - { - await base.User_managed_concurrency_token( - async, -""" -CREATE PROCEDURE EntityWithAdditionalProperty_Update(@Id int, @ConcurrencyTokenOriginal int, @Name varchar(max), @ConcurrencyTokenCurrent int, @RowsAffected int OUT) -AS BEGIN - UPDATE [EntityWithAdditionalProperty] SET [Name] = @Name, [AdditionalProperty] = @ConcurrencyTokenCurrent WHERE [Id] = @Id AND [AdditionalProperty] = @ConcurrencyTokenOriginal; - SET @RowsAffected = @@ROWCOUNT; -END -"""); - - AssertSql( -""" -@p0='1' -@p1='8' -@p2='Updated' (Size = 4000) -@p3='9' -@p4='0' (Direction = Output) - -SET NOCOUNT ON; -EXEC [EntityWithAdditionalProperty_Update] @p0, @p1, @p2, @p3, @p4 OUTPUT; -"""); - } - - public override async Task Original_and_current_value_on_non_concurrency_token(bool async) - { - await base.Original_and_current_value_on_non_concurrency_token( - async, -""" -CREATE PROCEDURE Entity_Update(@Id int, @NameCurrent varchar(max), @NameOriginal varchar(max)) -AS BEGIN - IF @NameCurrent <> @NameOriginal - BEGIN - UPDATE [Entity] SET [Name] = @NameCurrent WHERE [Id] = @Id; - END -END -"""); - - AssertSql( -""" -@p0='1' -@p1='Updated' (Size = 4000) -@p2='Initial' (Size = 4000) - -SET NOCOUNT ON; -EXEC [Entity_Update] @p0, @p1, @p2; -"""); - } - - public override async Task Input_or_output_parameter_with_input(bool async) - { - await base.Input_or_output_parameter_with_input( - async, -""" -CREATE PROCEDURE Entity_Insert(@Id int OUT, @Name varchar(max) OUT) -AS BEGIN - IF @Name IS NULL - BEGIN - INSERT INTO [Entity] ([Name]) VALUES ('Some default value'); - SET @Name = 'Some default value'; - END - ELSE - BEGIN - INSERT INTO [Entity] ([Name]) VALUES (@Name); - SET @Name = NULL; - END - - SET @Id = SCOPE_IDENTITY(); -END -"""); - - AssertSql( -""" -@p0='1' (Direction = Output) -@p1=NULL (Nullable = false) (Size = 4000) (Direction = InputOutput) - -SET NOCOUNT ON; -EXEC [Entity_Insert] @p0 OUTPUT, @p1 OUTPUT; -"""); - } - - public override async Task Input_or_output_parameter_with_output(bool async) - { - await base.Input_or_output_parameter_with_output( - async, -""" -CREATE PROCEDURE Entity_Insert(@Id int OUT, @Name varchar(max) OUT) -AS BEGIN - IF @Name IS NULL - BEGIN - INSERT INTO [Entity] ([Name]) VALUES ('Some default value'); - SET @Name = 'Some default value'; - END - ELSE - BEGIN - INSERT INTO [Entity] ([Name]) VALUES (@Name); - SET @Name = NULL; - END - - SET @Id = SCOPE_IDENTITY(); -END -"""); - - AssertSql( -""" -@p0='1' (Direction = Output) -@p1='Some default value' (Nullable = false) (Size = 4000) (Direction = InputOutput) - -SET NOCOUNT ON; -EXEC [Entity_Insert] @p0 OUTPUT, @p1 OUTPUT; -"""); - } - - public override async Task Tph(bool async) - { - await base.Tph( - async, -""" -CREATE PROCEDURE Tph_Insert(@Id int OUT, @Discriminator varchar(max), @Name varchar(max), @Child2InputProperty int, @Child2OutputParameterProperty int OUT, @Child1Property int) -AS BEGIN - DECLARE @Table table ([Child2OutputParameterProperty] int); - INSERT INTO [Tph] ([Discriminator], [Name], [Child1Property], [Child2InputProperty]) OUTPUT [Inserted].[Child2OutputParameterProperty] INTO @Table VALUES (@Discriminator, @Name, @Child1Property, @Child2InputProperty); - SET @Id = SCOPE_IDENTITY(); - SELECT @Child2OutputParameterProperty = [Child2OutputParameterProperty] FROM @Table; - SELECT [Child2ResultColumnProperty] FROM [Tph] WHERE [Id] = @Id -END -"""); - - AssertSql( -""" -@p0=NULL (Nullable = false) (Direction = Output) (DbType = Int32) -@p1='Child1' (Nullable = false) (Size = 4000) -@p2='Child' (Size = 4000) -@p3=NULL (DbType = Int32) -@p4=NULL (Direction = Output) (DbType = Int32) -@p5='8' (Nullable = true) - -SET NOCOUNT ON; -EXEC [Tph_Insert] @p0 OUTPUT, @p1, @p2, @p3, @p4 OUTPUT, @p5; -"""); - } - - public override async Task Tpt(bool async) - { - await base.Tpt( - async, -""" -CREATE PROCEDURE Parent_Insert(@Id int OUT, @Name varchar(max)) -AS BEGIN - INSERT INTO [Parent] ([Name]) VALUES (@Name); - SET @Id = SCOPE_IDENTITY(); -END; - -GO - -CREATE PROCEDURE Child1_Insert(@Id int, @Child1Property int) -AS BEGIN - INSERT INTO [Child1] ([Id], [Child1Property]) VALUES (@Id, @Child1Property); - SET @Id = SCOPE_IDENTITY(); -END; -"""); - - AssertSql( -""" -@p0='1' (Direction = Output) -@p1='Child' (Size = 4000) - -SET NOCOUNT ON; -EXEC [Parent_Insert] @p0 OUTPUT, @p1; -""", -// -""" -@p2='1' -@p3='8' - -SET NOCOUNT ON; -EXEC [Child1_Insert] @p2, @p3; -"""); - } - - public override async Task Tpt_mixed_sproc_and_non_sproc(bool async) - { - await base.Tpt_mixed_sproc_and_non_sproc( - async, -""" -CREATE PROCEDURE Parent_Insert(@Id int OUT, @Name varchar(max)) -AS BEGIN - INSERT INTO [Parent] ([Name]) VALUES (@Name); - SET @Id = SCOPE_IDENTITY(); -END -"""); - - AssertSql( -""" -@p0='1' (Direction = Output) -@p1='Child' (Size = 4000) - -SET NOCOUNT ON; -EXEC [Parent_Insert] @p0 OUTPUT, @p1; -""", -// -""" -@p2='1' -@p3='8' - -SET IMPLICIT_TRANSACTIONS OFF; -SET NOCOUNT ON; -INSERT INTO [Child1] ([Id], [Child1Property]) -VALUES (@p2, @p3); -"""); - } - - public override async Task Tpc(bool async) - { - await base.Tpc( - async, -""" -CREATE PROCEDURE Child1_Insert(@Id int OUT, @Name varchar(max), @Child1Property int) -AS BEGIN - DECLARE @Table table ([Id] int); - INSERT INTO [Child1] ([Name], [Child1Property]) OUTPUT [Inserted].[Id] INTO @Table VALUES (@Name, @Child1Property); - SELECT @Id = [Id] FROM @Table; -END -"""); - - AssertSql( -""" -@p0='1' (Direction = Output) -@p1='Child' (Size = 4000) -@p2='8' - -SET NOCOUNT ON; -EXEC [Child1_Insert] @p0 OUTPUT, @p1, @p2; -"""); - } - - public override async Task Non_sproc_followed_by_sproc_commands_in_the_same_batch(bool async) - { - await base.Non_sproc_followed_by_sproc_commands_in_the_same_batch( - async, -""" -CREATE PROCEDURE EntityWithAdditionalProperty_Insert(@Name varchar(max), @Id int OUT, @AdditionalProperty int) -AS BEGIN - INSERT INTO [EntityWithAdditionalProperty] ([Name], [AdditionalProperty]) VALUES (@Name, @AdditionalProperty); - SET @Id = SCOPE_IDENTITY(); -END -"""); - - AssertSql( -""" -@p2='1' -@p0='2' -@p3='1' -@p1='Entity1_Modified' (Size = 4000) -@p4='Entity2' (Size = 4000) -@p5=NULL (Nullable = false) (Direction = Output) (DbType = Int32) -@p6='0' - -SET NOCOUNT ON; -UPDATE [EntityWithAdditionalProperty] SET [AdditionalProperty] = @p0, [Name] = @p1 -OUTPUT 1 -WHERE [Id] = @p2 AND [AdditionalProperty] = @p3; -EXEC [EntityWithAdditionalProperty_Insert] @p4, @p5 OUTPUT, @p6; -"""); - } - - protected override void ConfigureStoreGeneratedConcurrencyToken(EntityTypeBuilder entityTypeBuilder, string propertyName) - => entityTypeBuilder.Property(propertyName).IsRowVersion(); - - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; -} From 6e518c8f6d46b66558204e6a1572cb33e9e60ef7 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 2 Jun 2026 22:34:22 +0800 Subject: [PATCH 08/43] moretest fixes --- .../ComplexTypesTrackingJetTest.cs | 34 +++++ .../ComputedColumnTest.cs | 144 ------------------ .../Update/JetUpdateSqlGeneratorTest.cs | 44 +++--- 3 files changed, 61 insertions(+), 161 deletions(-) delete mode 100644 test/EFCore.Jet.FunctionalTests/ComputedColumnTest.cs diff --git a/test/EFCore.Jet.FunctionalTests/ComplexTypesTrackingJetTest.cs b/test/EFCore.Jet.FunctionalTests/ComplexTypesTrackingJetTest.cs index 04d17417..61645e36 100644 --- a/test/EFCore.Jet.FunctionalTests/ComplexTypesTrackingJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ComplexTypesTrackingJetTest.cs @@ -266,6 +266,16 @@ public override void Can_detect_swapped_complex_objects_in_collections(bool trac { } + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_remove_from_complex_collection_with_nested_complex_collection(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_remove_from_complex_field_collection_with_nested_complex_collection(bool trackFromQuery) + { + } + // Issue #36175: Complex types with notification change tracking are not supported public override void Throws_when_accessing_complex_entries_using_incorrect_cardinality() { @@ -342,6 +352,30 @@ public override void Can_write_original_values_for_properties_of_complex_propert { } + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_save_default_values_in_optional_complex_property_with_multiple_properties(bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_null_complex_property_with_default_values_and_multiple_properties(bool async) + => Task.CompletedTask; + + // Fields can't be proxied + public override Task Can_change_state_from_Deleted_with_complex_field_collection(EntityState newState, bool async) + => Task.CompletedTask; + + // Fields can't be proxied + public override Task Can_change_state_from_Deleted_with_complex_field_record_collection(EntityState newState, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_change_state_from_Deleted_with_complex_collection(EntityState newState, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_change_state_from_Deleted_with_complex_record_collection(EntityState newState, bool async) + => Task.CompletedTask; + public class JetFixture : JetFixtureBase { protected override string StoreName diff --git a/test/EFCore.Jet.FunctionalTests/ComputedColumnTest.cs b/test/EFCore.Jet.FunctionalTests/ComputedColumnTest.cs deleted file mode 100644 index c170642a..00000000 --- a/test/EFCore.Jet.FunctionalTests/ComputedColumnTest.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading.Tasks; -using EntityFrameworkCore.Jet.Data; -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.TestUtilities; -using Microsoft.Extensions.DependencyInjection; -using Xunit; -#nullable disable -namespace EntityFrameworkCore.Jet.FunctionalTests -{ - public class ComputedColumnTest : IAsyncLifetime - { - [ConditionalFact] - public void Can_use_computed_columns() - { - var serviceProvider = new ServiceCollection() - .AddEntityFrameworkJet() - .BuildServiceProvider(validateScopes: true); - - using var context = new Context(serviceProvider, TestStore.Name); - context.Database.EnsureCreatedResiliently(); - - var entity = context.Add( - new Entity - { - P1 = 20, - P2 = 30, - P3 = 80 - }).Entity; - - context.SaveChanges(); - - Assert.Equal(50, entity.P4); - Assert.Equal(100, entity.P5); - } - - [ConditionalFact] - public void Can_use_computed_columns_with_null_values() - { - var serviceProvider = new ServiceCollection() - .AddEntityFrameworkJet() - .BuildServiceProvider(validateScopes: true); - - using var context = new Context(serviceProvider, TestStore.Name); - context.Database.EnsureCreatedResiliently(); - - var entity = context.Add(new Entity { P1 = 20, P2 = 30 }).Entity; - - context.SaveChanges(); - - Assert.Equal(50, entity.P4); - Assert.Null(entity.P5); - } - - private class Context(IServiceProvider serviceProvider, string databaseName) : DbContext - { - public DbSet Entities { get; set; } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - => optionsBuilder - .UseJet(JetTestStore.CreateConnectionString(databaseName), TestEnvironment.DataAccessProviderFactory, b => b.ApplyConfiguration()) - .UseInternalServiceProvider(serviceProvider); - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity() - .Property(e => e.P4) - .HasComputedColumnSql("P1 + P2"); - - modelBuilder.Entity() - .Property(e => e.P5) - .HasComputedColumnSql("P1 + P3"); - } - } - - private class Entity - { - public int Id { get; set; } - public int P1 { get; set; } - public int P2 { get; set; } - public int? P3 { get; set; } - public int P4 { get; set; } - public int? P5 { get; set; } - } - - [Flags] - public enum FlagEnum - { - None = 0x0, - AValue = 0x1, - BValue = 0x2 - } - - public class EnumItem - { - public int EnumItemId { get; set; } - public FlagEnum FlagEnum { get; set; } - public FlagEnum? OptionalFlagEnum { get; set; } - public FlagEnum? CalculatedFlagEnum { get; set; } - } - - private class NullableContext(IServiceProvider serviceProvider, string databaseName) : DbContext - { - public DbSet EnumItems { get; set; } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - => optionsBuilder - .UseJet(JetTestStore.CreateConnectionString(databaseName), TestEnvironment.DataAccessProviderFactory, b => b.ApplyConfiguration()) - .UseInternalServiceProvider(serviceProvider); - - protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity() - .Property(entity => entity.CalculatedFlagEnum) - .HasComputedColumnSql("FlagEnum | OptionalFlagEnum"); - } - - [ConditionalFact] - public void Can_use_computed_columns_with_nullable_enum() - { - var serviceProvider = new ServiceCollection() - .AddEntityFrameworkJet() - .BuildServiceProvider(validateScopes: true); - - using var context = new NullableContext(serviceProvider, TestStore.Name); - context.Database.EnsureCreatedResiliently(); - - var entity = context.EnumItems.Add(new EnumItem { FlagEnum = FlagEnum.AValue, OptionalFlagEnum = FlagEnum.BValue }).Entity; - context.SaveChanges(); - - Assert.Equal(FlagEnum.AValue | FlagEnum.BValue, entity.CalculatedFlagEnum); - } - - protected JetTestStore TestStore { get; private set; } - - public async Task InitializeAsync() - => TestStore = await JetTestStore.CreateInitializedAsync("ComputedColumnTest"); - - public async Task DisposeAsync() - => await TestStore.DisposeAsync(); - } -} diff --git a/test/EFCore.Jet.FunctionalTests/Update/JetUpdateSqlGeneratorTest.cs b/test/EFCore.Jet.FunctionalTests/Update/JetUpdateSqlGeneratorTest.cs index f77d59a3..9be16a13 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/JetUpdateSqlGeneratorTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/JetUpdateSqlGeneratorTest.cs @@ -104,13 +104,17 @@ public void AppendBulkInsertOperation_appends_merge_if_store_generated_columns_e AssertBaseline( """ -MERGE [dbo].[Ducks] USING ( -VALUES (@p0, @p1, @p2, 0), -(@p0, @p1, @p2, 1)) AS i ([Name], [Quacks], [ConcurrencyToken], _Position) ON 1=0 -WHEN NOT MATCHED THEN -INSERT ([Name], [Quacks], [ConcurrencyToken]) -VALUES (i.[Name], i.[Quacks], i.[ConcurrencyToken]) -OUTPUT INSERTED.[Id], INSERTED.[Computed], i._Position; +INSERT INTO `Ducks` (`Name`, `Quacks`, `ConcurrencyToken`) +VALUES (@p0, @p1, @p2); +SELECT `Id`, `Computed` +FROM `Ducks` +WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; + +INSERT INTO `Ducks` (`Name`, `Quacks`, `ConcurrencyToken`) +VALUES (@p0, @p1, @p2); +SELECT `Id`, `Computed` +FROM `Ducks` +WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, stringBuilder.ToString()); Assert.Equal(ResultSetMapping.NotLastInResultSet | ResultSetMapping.IsPositionalResultMappingEnabled, grouping); @@ -147,14 +151,17 @@ public void AppendBulkInsertOperation_appends_insert_if_store_generated_columns_ AssertBaseline( """ -DECLARE @inserted0 TABLE ([Id] int); -INSERT INTO [dbo].[Ducks] ([Id]) -OUTPUT INSERTED.[Id] -INTO @inserted0 -VALUES (DEFAULT), -(DEFAULT); -SELECT [t].[Id], [t].[Computed] FROM [dbo].[Ducks] t -INNER JOIN @inserted0 i ON ([t].[Id] = [i].[Id]); +INSERT INTO `Ducks` +DEFAULT VALUES; +SELECT `Id`, `Computed` +FROM `Ducks` +WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; + +INSERT INTO `Ducks` +DEFAULT VALUES; +SELECT `Id`, `Computed` +FROM `Ducks` +WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, stringBuilder.ToString()); Assert.Equal(ResultSetMapping.NotLastInResultSet, grouping); @@ -248,10 +255,13 @@ protected override string Identity => throw new NotImplementedException(); protected override string OpenDelimiter - => "["; + => "`"; protected override string CloseDelimiter - => "]"; + => "`"; + + protected override string Schema + => null!; private void AssertBaseline(string expected, string actual) => Assert.Equal(expected, actual.TrimEnd(), ignoreLineEndingDifferences: true); From 43f063a903efb49b891cfd3475b68c0cbb8e46e8 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 6 Jun 2026 18:40:58 +0800 Subject: [PATCH 09/43] Add JetCSharpRuntimeAnnotationCodeGenerator and docs Introduce JetCSharpRuntimeAnnotationCodeGenerator for design-time annotation support and register it in JetDesignTimeServices. Remove explicit EF Core package versions from the project file. Comment out default "bigint" mapping to match Jet/ACE support. Add copilot-instructions.md with provider-specific guidelines. --- .github/copilot-instructions.md | 6 + ...JetCSharpRuntimeAnnotationCodeGenerator.cs | 156 ++++++++++++++++++ .../Design/Internal/JetDesignTimeServices.cs | 2 + src/EFCore.Jet/EFCore.Jet.csproj | 4 +- .../Storage/Internal/JetTypeMappingSource.cs | 2 +- 5 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 .github/copilot-instructions.md create mode 100644 src/EFCore.Jet/Design/Internal/JetCSharpRuntimeAnnotationCodeGenerator.cs diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..278e92c2 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,6 @@ +# Copilot Instructions + +## Project Guidelines +- This project (EntityFrameworkCore.Jet) targets the Microsoft Access Jet/ACE database engine, not SQL Server. Generated SQL, type mappings, and literals must be Jet/ACE-compliant (e.g. decimal/currency instead of bigint, #...# date literals, TIMEVALUE()). Note: Access 2016+ (ACE) does have a native BIGINT (Large Number) type, which is a SIGNED 64-bit integer and cannot hold unsigned values like ulong.MaxValue; unsigned ulong/uint should map to decimal(20,0) to avoid overflow. Provider distinctions are OLE DB / ODBC via the ACE/Jet driver rather than SqlClient. Do not assume SQL Server/T-SQL semantics. +- Jet/Access SQL dialect used in this project does not support COALESCE or NZ. When rewriting queries for Jet, prefer using IIF( IS NULL, , ) or 'CASE WHEN IS NULL THEN ELSE END' instead. +- Deferred enhancement for EntityFrameworkCore.Jet: add ACE engine-version detection so that on Access 2016+ the provider can map to native BIGINT (signed long; unsigned ulong/uint still go to decimal(20,0)) and native DATETIME2, while falling back to decimal(20,0)/legacy datetime on older ACE versions. Not a priority right now. \ No newline at end of file diff --git a/src/EFCore.Jet/Design/Internal/JetCSharpRuntimeAnnotationCodeGenerator.cs b/src/EFCore.Jet/Design/Internal/JetCSharpRuntimeAnnotationCodeGenerator.cs new file mode 100644 index 00000000..b8c427d1 --- /dev/null +++ b/src/EFCore.Jet/Design/Internal/JetCSharpRuntimeAnnotationCodeGenerator.cs @@ -0,0 +1,156 @@ +using EntityFrameworkCore.Jet.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Design.Internal; + +namespace EntityFrameworkCore.Jet.Design.Internal; + +/// +/// 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. +/// +#pragma warning disable EF1001 // Internal EF Core API usage. +public class JetCSharpRuntimeAnnotationCodeGenerator : RelationalCSharpRuntimeAnnotationCodeGenerator +{ + /// + /// 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 JetCSharpRuntimeAnnotationCodeGenerator( + CSharpRuntimeAnnotationCodeGeneratorDependencies dependencies, + RelationalCSharpRuntimeAnnotationCodeGeneratorDependencies relationalDependencies) + : base(dependencies, relationalDependencies) + { + } + + /// + public override void Generate(IModel model, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + } + + base.Generate(model, parameters); + } + + /// + public override void Generate(IRelationalModel model, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + } + + base.Generate(model, parameters); + } + + /// + public override void Generate(IProperty property, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + /*if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + + if (!annotations.ContainsKey(JetAnnotationNames.ValueGenerationStrategy)) + { + annotations[JetAnnotationNames.ValueGenerationStrategy] = property.GetValueGenerationStrategy(); + } + }*/ + + base.Generate(property, parameters); + } + + /// + public override void Generate(IColumn column, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + //annotations.Remove(JetAnnotationNames.Identity); + } + + base.Generate(column, parameters); + } + + /// + public override void Generate(IIndex index, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + annotations.Remove(JetAnnotationNames.Include); + } + + base.Generate(index, parameters); + } + + /// + public override void Generate(ITableIndex index, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + annotations.Remove(JetAnnotationNames.Include); + } + + base.Generate(index, parameters); + } + + /// + public override void Generate(IKey key, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + } + + base.Generate(key, parameters); + } + + /// + public override void Generate(IUniqueConstraint uniqueConstraint, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + } + + base.Generate(uniqueConstraint, parameters); + } + + /// + public override void Generate(IEntityType entityType, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + } + + base.Generate(entityType, parameters); + } + + /// + public override void Generate(ITable table, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + } + + base.Generate(table, parameters); + } + + /// + public override void Generate(IRelationalPropertyOverrides overrides, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!parameters.IsRuntime) + { + var annotations = parameters.Annotations; + } + + base.Generate(overrides, parameters); + } +} diff --git a/src/EFCore.Jet/Design/Internal/JetDesignTimeServices.cs b/src/EFCore.Jet/Design/Internal/JetDesignTimeServices.cs index d37e5ba2..b6cc6c3a 100644 --- a/src/EFCore.Jet/Design/Internal/JetDesignTimeServices.cs +++ b/src/EFCore.Jet/Design/Internal/JetDesignTimeServices.cs @@ -1,6 +1,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using EntityFrameworkCore.Jet.Scaffolding.Internal; +using Microsoft.EntityFrameworkCore.Design.Internal; namespace EntityFrameworkCore.Jet.Design.Internal { @@ -24,6 +25,7 @@ public virtual void ConfigureDesignTimeServices(IServiceCollection serviceCollec #pragma warning disable EF1001 // Internal EF Core API usage. new EntityFrameworkRelationalDesignServicesBuilder(serviceCollection) .TryAdd() + .TryAdd() #pragma warning restore EF1001 // Internal EF Core API usage. .TryAdd() .TryAdd() diff --git a/src/EFCore.Jet/EFCore.Jet.csproj b/src/EFCore.Jet/EFCore.Jet.csproj index 50c7a18d..a3714c47 100644 --- a/src/EFCore.Jet/EFCore.Jet.csproj +++ b/src/EFCore.Jet/EFCore.Jet.csproj @@ -16,8 +16,8 @@ - - + + diff --git a/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs b/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs index 7b1d5928..ffcfc1ad 100644 --- a/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs +++ b/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs @@ -129,7 +129,7 @@ public JetTypeMappingSource( {"long", [_bigint] },//is this right {"int", [_integer] }, {"integer4", [_integer] }, - {"bigint", [_bigint] }, + //{"bigint", [_bigint] }, {"single", [_single] }, {"real", [_single] }, From 7d1e1419531f28492bdec641f45b98eaccdb7cff Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 6 Jun 2026 18:44:12 +0800 Subject: [PATCH 10/43] Bump version to 10.0.1 for servicing release Updated Version.props to set VersionPrefix to 10.0.1 and PreReleaseVersionLabel to "servicing", marking the transition from the initial release to a servicing (maintenance/bugfix) release. --- Version.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Version.props b/Version.props index cb7abfa9..cf38442b 100644 --- a/Version.props +++ b/Version.props @@ -15,8 +15,8 @@ Bump-up to the next iteration immediately after a release, so that subsequent daily builds are named correctly. --> - 10.0.0 - rtm + 10.0.1 + servicing 0 - 1 + 0 \ No newline at end of file From cb2fc7ca0b6942a60a3bde75818eefa134fc4383 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 30 Jun 2026 17:44:09 +0800 Subject: [PATCH 38/43] Refactor connection string handling and add validation Refactor JetConnection to use JetConnectionStringBuilder directly for Jet/ACE-specific logic and simplify provider property access. Add ValidateDatabaseFileExtension to restrict deletions to .accdb/.mdb files. Improve identifier escaping to handle backticks. Add test to ensure extra connection string keywords are preserved. Minor formatting fixes. --- src/EFCore.Jet.Data/JetConnection.cs | 13 ++++++----- .../JetStoreDatabaseHandling.cs | 14 +++++++++++- .../Internal/JetSqlGenerationHelper.cs | 6 +++-- .../ConnectionStringTest.cs | 22 ++++++++++++++++++- 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/EFCore.Jet.Data/JetConnection.cs b/src/EFCore.Jet.Data/JetConnection.cs index f590634a..c9a137c2 100644 --- a/src/EFCore.Jet.Data/JetConnection.cs +++ b/src/EFCore.Jet.Data/JetConnection.cs @@ -360,7 +360,7 @@ public override void Open() // It is possible, that a connection string was provided, that left out the actual ACE/Jet provider // information, but is in a distinctive style (ODBC or OLE DB) anyway. // In that case, we need to retrieving the data access provider type's most recent ACE/Jet provider. - var connectionStringBuilder = DataAccessProviderFactory.CreateConnectionStringBuilder(); + var connectionStringBuilder = new JetConnectionStringBuilder(dataAccessProviderType); connectionStringBuilder.ConnectionString = connectionString; if (connectionStringBuilder.Remove("IgnoreMsys")) @@ -369,12 +369,12 @@ public override void Open() connectionString = connectionStringBuilder.ToString(); } - if (string.IsNullOrWhiteSpace(connectionStringBuilder.GetProvider())) + if (string.IsNullOrWhiteSpace(connectionStringBuilder.Provider)) { var provider = GetMostRecentCompatibleProviders(dataAccessProviderType) .FirstOrDefault() .Key ?? throw new InvalidOperationException($"Unable to find any compatible {Enum.GetName(typeof(DataAccessProviderType), dataAccessProviderType)} provider for the connection string: {fileNameOrConnectionString}"); - connectionStringBuilder.SetProvider(provider); + connectionStringBuilder.Provider = provider; connectionString = connectionStringBuilder.ToString(); } @@ -596,9 +596,10 @@ public static string GetConnectionString(string provider, string fileName, DataA private static string ExpandDatabaseFilePath(string connectionString, DbProviderFactory dataAccessProviderFactory) { - var connectionStringBuilder = dataAccessProviderFactory.CreateConnectionStringBuilder(); + var providerType = GetDataAccessProviderType(dataAccessProviderFactory); + var connectionStringBuilder = new JetConnectionStringBuilder(providerType); connectionStringBuilder.ConnectionString = connectionString; - connectionStringBuilder.SetDataSource(JetStoreDatabaseHandling.ExpandFileName(connectionStringBuilder.GetDataSource())); + connectionStringBuilder.DataSource = JetStoreDatabaseHandling.ExpandFileName(connectionStringBuilder.DataSource); return connectionStringBuilder.ToString(); } @@ -805,4 +806,4 @@ public static bool IsFileName(string? fileNameOrConnectionString) [GeneratedRegex(@"^(?:.*;)?\s*Provider\s*=\s*\w+", RegexOptions.IgnoreCase, "en-AU")] private static partial Regex IsOleDbRegex(); } -} \ No newline at end of file +} diff --git a/src/EFCore.Jet.Data/JetStoreSchemaDefinition/JetStoreDatabaseHandling.cs b/src/EFCore.Jet.Data/JetStoreSchemaDefinition/JetStoreDatabaseHandling.cs index 114fba82..0e63024d 100644 --- a/src/EFCore.Jet.Data/JetStoreSchemaDefinition/JetStoreDatabaseHandling.cs +++ b/src/EFCore.Jet.Data/JetStoreSchemaDefinition/JetStoreDatabaseHandling.cs @@ -213,6 +213,7 @@ public static void DeleteFile(string fileName) JetConnection.ClearAllPools(); fileName = ExpandFileName(fileName); + ValidateDatabaseFileExtension(fileName); var directoryPath = Path.GetDirectoryName(fileName) ?? string.Empty; var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); @@ -240,6 +241,17 @@ public static void DeleteFile(string fileName) } } + private static void ValidateDatabaseFileExtension(string fileName) + { + var extension = Path.GetExtension(fileName); + if (!string.Equals(extension, ".accdb", StringComparison.OrdinalIgnoreCase) && + !string.Equals(extension, ".mdb", StringComparison.OrdinalIgnoreCase)) + { + throw new InvalidOperationException( + $"Only .accdb and .mdb database files can be dropped. The supplied path has extension '{extension}'."); + } + } + private static string UnescapeSingleQuotes(string value) => value.Replace("''", "'"); @@ -273,4 +285,4 @@ public static string EnsureFileExtension(string fileName) return fileName; } } -} \ No newline at end of file +} diff --git a/src/EFCore.Jet/Storage/Internal/JetSqlGenerationHelper.cs b/src/EFCore.Jet/Storage/Internal/JetSqlGenerationHelper.cs index c5d09280..630e82ee 100644 --- a/src/EFCore.Jet/Storage/Internal/JetSqlGenerationHelper.cs +++ b/src/EFCore.Jet/Storage/Internal/JetSqlGenerationHelper.cs @@ -26,7 +26,8 @@ public override string EscapeIdentifier(string identifier) Check.NotEmpty(identifier, nameof(identifier)); identifier = identifier - .Replace(".", "#"); + .Replace(".", "#") + .Replace("`", "``"); return identifier; } @@ -40,7 +41,8 @@ public override void EscapeIdentifier(StringBuilder builder, string identifier) Check.NotEmpty(identifier, nameof(identifier)); identifier = identifier - .Replace(".", "#"); + .Replace(".", "#") + .Replace("`", "``"); builder.Append(identifier); } diff --git a/test/EFCore.Jet.Data.Tests/ConnectionStringTest.cs b/test/EFCore.Jet.Data.Tests/ConnectionStringTest.cs index e916484c..806f812c 100644 --- a/test/EFCore.Jet.Data.Tests/ConnectionStringTest.cs +++ b/test/EFCore.Jet.Data.Tests/ConnectionStringTest.cs @@ -100,6 +100,26 @@ public void OleDb_read_connection_string_with_all_properties() Assert.AreEqual("DbPwd", csb.DatabasePassword); } + [TestMethod] + public void OleDb_connection_string_preserves_extra_keywords_when_normalized() + { + const string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Jet OLEDB:Engine Type=4;Jet OLEDB:MaxLocksPerFile=100000;Mode=Share Deny None;Persist Security Info=False;Extended Properties='MaxLocksPerFile=100000';Data Source=c:\Temp\Access97EF\test.mdb;"; + + var normalizedConnectionString = JetConnection.GetConnectionString(connectionString, OleDbFactory.Instance); + var csb = new JetConnectionStringBuilder(DataAccessProviderType.OleDb) { ConnectionString = normalizedConnectionString }; + + Assert.IsTrue(csb.TryGetValue("Jet OLEDB:Engine Type", out var engineType), normalizedConnectionString); + Assert.AreEqual("4", engineType); + Assert.IsTrue(csb.TryGetValue("Jet OLEDB:MaxLocksPerFile", out var maxLocksPerFile), normalizedConnectionString); + Assert.AreEqual("100000", maxLocksPerFile); + Assert.IsTrue(csb.TryGetValue("Mode", out var mode), normalizedConnectionString); + Assert.AreEqual("Share Deny None", mode); + Assert.IsTrue(csb.TryGetValue("Persist Security Info", out var persistSecurityInfo), normalizedConnectionString); + Assert.AreEqual("False", persistSecurityInfo); + Assert.IsTrue(csb.TryGetValue("Extended Properties", out var extendedProperties), normalizedConnectionString); + Assert.AreEqual("MaxLocksPerFile=100000", extendedProperties); + } + [TestMethod] public void OleDb_connection_string_with_all_properties() { @@ -133,4 +153,4 @@ public void OleDb_connection_string_with_all_properties_from_factory() or @"provider=Microsoft.ACE.OLEDB.12.0;data source=ConnectionStringTest.accdb;user id=Admin;password=hunter2;jet oledb:system database=SysDb;jet oledb:database password=DbPwd"); } } -} \ No newline at end of file +} From 191334893ab7e23e528034633bb7ad5e78cbdeda Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 30 Jun 2026 18:41:49 +0800 Subject: [PATCH 39/43] Update deps, refactor JetConnection string normalization - Bump .NET, EFCore, and Microsoft libs to 10.0.9 - Update Microsoft.NET.Test.Sdk to 18.7.0 and Build.Tasks.Core to 18.7.1 - Refactor JetConnection for robust ODBC/OLE DB string handling - Add test to ensure ODBC driver braces are preserved - Use default Microsoft.EntityFrameworkCore.Relational version in integration tests --- Dependencies.targets | 8 +- src/EFCore.Jet.Data/JetConnection.cs | 94 ++++++++++++++++--- .../ConnectionStringTest.cs | 14 +++ .../EFCore.Jet.FunctionalTests.csproj | 2 +- .../EFCore.Jet.IntegrationTests.csproj | 2 +- test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj | 2 +- 6 files changed, 101 insertions(+), 21 deletions(-) diff --git a/Dependencies.targets b/Dependencies.targets index 52d8f3df..62c772be 100644 --- a/Dependencies.targets +++ b/Dependencies.targets @@ -1,8 +1,8 @@ - [10.0.8,10.0.999] - [10.0.8,10.0.999] - [10.0.8,10.0.999] + [10.0.9,10.0.999] + [10.0.9,10.0.999] + [10.0.9,10.0.999] @@ -28,7 +28,7 @@ - + diff --git a/src/EFCore.Jet.Data/JetConnection.cs b/src/EFCore.Jet.Data/JetConnection.cs index c9a137c2..e13d2b76 100644 --- a/src/EFCore.Jet.Data/JetConnection.cs +++ b/src/EFCore.Jet.Data/JetConnection.cs @@ -360,22 +360,17 @@ public override void Open() // It is possible, that a connection string was provided, that left out the actual ACE/Jet provider // information, but is in a distinctive style (ODBC or OLE DB) anyway. // In that case, we need to retrieving the data access provider type's most recent ACE/Jet provider. - var connectionStringBuilder = new JetConnectionStringBuilder(dataAccessProviderType); - connectionStringBuilder.ConnectionString = connectionString; + var connectionStringBuilder = CreateConnectionStringBuilderForNormalization(connectionString, dataAccessProviderType); if (connectionStringBuilder.Remove("IgnoreMsys")) - { _ignoreMSys = true; - connectionString = connectionStringBuilder.ToString(); - } - if (string.IsNullOrWhiteSpace(connectionStringBuilder.Provider)) + if (string.IsNullOrWhiteSpace(connectionStringBuilder.GetProvider(dataAccessProviderType))) { var provider = GetMostRecentCompatibleProviders(dataAccessProviderType) .FirstOrDefault() .Key ?? throw new InvalidOperationException($"Unable to find any compatible {Enum.GetName(typeof(DataAccessProviderType), dataAccessProviderType)} provider for the connection string: {fileNameOrConnectionString}"); - connectionStringBuilder.Provider = provider; - connectionString = connectionStringBuilder.ToString(); + connectionStringBuilder.SetProvider(provider, dataAccessProviderType); } // Enable ExtendedAnsiSQL when using ODBC to support ODBC 4.0 statements (like CREATE VIEW). @@ -384,11 +379,13 @@ public override void Open() if (!connectionStringBuilder.ContainsKey("ExtendedAnsiSQL")) { connectionStringBuilder["ExtendedAnsiSQL"] = 1; - connectionString = connectionStringBuilder.ToString(); } } - connectionString = ExpandDatabaseFilePath(connectionString, DataAccessProviderFactory); + connectionStringBuilder.SetDataSource( + JetStoreDatabaseHandling.ExpandFileName(connectionStringBuilder.GetDataSource(dataAccessProviderType)), + dataAccessProviderType); + connectionString = RebuildConnectionString(connectionStringBuilder, dataAccessProviderType, DataAccessProviderFactory); try { @@ -597,11 +594,80 @@ public static string GetConnectionString(string provider, string fileName, DataA private static string ExpandDatabaseFilePath(string connectionString, DbProviderFactory dataAccessProviderFactory) { var providerType = GetDataAccessProviderType(dataAccessProviderFactory); - var connectionStringBuilder = new JetConnectionStringBuilder(providerType); - connectionStringBuilder.ConnectionString = connectionString; - connectionStringBuilder.DataSource = JetStoreDatabaseHandling.ExpandFileName(connectionStringBuilder.DataSource); + var connectionStringBuilder = CreateConnectionStringBuilderForNormalization(connectionString, providerType); + connectionStringBuilder.SetDataSource( + JetStoreDatabaseHandling.ExpandFileName(connectionStringBuilder.GetDataSource(providerType)), + providerType); + + return RebuildConnectionString(connectionStringBuilder, providerType, dataAccessProviderFactory); + } + + private static DbConnectionStringBuilder CreateConnectionStringBuilderForNormalization( + string connectionString, + DataAccessProviderType providerType) + => new(providerType == DataAccessProviderType.Odbc) + { + ConnectionString = NormalizeConnectionStringForBuilder(connectionString, providerType) + }; + + private static string RebuildConnectionString( + DbConnectionStringBuilder sourceBuilder, + DataAccessProviderType providerType, + DbProviderFactory dataAccessProviderFactory) + { + var targetBuilder = providerType == DataAccessProviderType.OleDb + ? new JetConnectionStringBuilder(providerType) + : dataAccessProviderFactory.CreateConnectionStringBuilder(); + + foreach (string key in sourceBuilder.Keys) + { + if (providerType == DataAccessProviderType.Odbc && + string.Equals(key, "Driver", StringComparison.OrdinalIgnoreCase)) + { + targetBuilder.SetProvider(NormalizeOdbcDriverValue(sourceBuilder[key]?.ToString()), providerType); + continue; + } + + if (string.Equals(key, "Provider", StringComparison.OrdinalIgnoreCase)) + { + targetBuilder.SetProvider(sourceBuilder[key]?.ToString()!, providerType); + continue; + } + + if (string.Equals(key, "Data Source", StringComparison.OrdinalIgnoreCase) || + string.Equals(key, "DBQ", StringComparison.OrdinalIgnoreCase)) + { + targetBuilder.SetDataSource(sourceBuilder[key]?.ToString()!, providerType); + continue; + } + + targetBuilder[key] = sourceBuilder[key]; + } + + return targetBuilder.ToString(); + } + + private static string NormalizeConnectionStringForBuilder(string connectionString, DataAccessProviderType providerType) + => providerType == DataAccessProviderType.Odbc + ? Regex.Replace( + connectionString, + @"(^|;)(\s*driver\s*=\s*)[""'](?\{[^;]*\})[""'](?=\s*(?:;|$))", + "$1$2${driver}", + RegexOptions.IgnoreCase) + : connectionString; + + private static string NormalizeOdbcDriverValue(string? driver) + { + driver = driver?.Trim() ?? string.Empty; + + if (driver.Length >= 2 && + ((driver[0] == '"' && driver[^1] == '"') || + (driver[0] == '\'' && driver[^1] == '\''))) + { + driver = driver[1..^1]; + } - return connectionStringBuilder.ToString(); + return driver.TrimStart('{').TrimEnd('}'); } public void DropDatabase() diff --git a/test/EFCore.Jet.Data.Tests/ConnectionStringTest.cs b/test/EFCore.Jet.Data.Tests/ConnectionStringTest.cs index 806f812c..c0b6df24 100644 --- a/test/EFCore.Jet.Data.Tests/ConnectionStringTest.cs +++ b/test/EFCore.Jet.Data.Tests/ConnectionStringTest.cs @@ -86,6 +86,20 @@ public void Odbc_connection_string_with_all_properties_from_factory() Assert.AreEqual("""driver="{Microsoft Access Driver (*.mdb, *.accdb)}";dbq=ConnectionStringTest.accdb;uid=Admin;pwd=DbPwd;systemdb=SysDb""", csb.ConnectionString); } + [TestMethod] + public void Odbc_connection_string_preserves_native_driver_braces_when_normalized() + { + const string connectionString = """driver="{Microsoft Access Driver (*.mdb, *.accdb)}";dbq=D:\toolkits\myefcorejet9\test\EFCore.Jet.Data.Tests\bin\x86\Debug\net10.0-windows7.0\ConnectionPoolingTest.accdb;extendedansisql=1"""; + + var normalizedConnectionString = JetConnection.GetConnectionString(connectionString, OdbcFactory.Instance); + + StringAssert.Contains(normalizedConnectionString, "Driver={Microsoft Access Driver (*.mdb, *.accdb)}"); + Assert.IsFalse( + normalizedConnectionString.Contains("driver=\"{Microsoft Access Driver (*.mdb, *.accdb)}\"", System.StringComparison.OrdinalIgnoreCase), + normalizedConnectionString); + StringAssert.Contains(normalizedConnectionString, "extendedansisql=1"); + } + [TestMethod] public void OleDb_read_connection_string_with_all_properties() { diff --git a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj index a2b74bec..7aecb8bf 100644 --- a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj +++ b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj @@ -23,7 +23,7 @@ - + diff --git a/test/EFCore.Jet.IntegrationTests/EFCore.Jet.IntegrationTests.csproj b/test/EFCore.Jet.IntegrationTests/EFCore.Jet.IntegrationTests.csproj index 7b9b5bd2..76a4ec50 100644 --- a/test/EFCore.Jet.IntegrationTests/EFCore.Jet.IntegrationTests.csproj +++ b/test/EFCore.Jet.IntegrationTests/EFCore.Jet.IntegrationTests.csproj @@ -87,7 +87,7 @@ - + diff --git a/test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj b/test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj index 9b01a45f..2a2f9362 100644 --- a/test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj +++ b/test/EFCore.Jet.Tests/EFCore.Jet.Tests.csproj @@ -34,7 +34,7 @@ - + From e2e180669f7e09abf6439f6e95f660dd147cb7a4 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Wed, 1 Jul 2026 01:28:04 +0800 Subject: [PATCH 40/43] update green tests for stuff removed from the test suite --- .../GreenTests/ace_2010_odbc_x86.txt | 3 --- .../GreenTests/ace_2010_oledb_x86.txt | 3 --- 2 files changed, 6 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index 26ecaff7..3a049b74 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -21254,7 +21254,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingMiscellaneousJetTest.Where_on_optional_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingMiscellaneousJetTest.Where_property_on_non_nullable_value_type EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingMiscellaneousJetTest.Where_property_on_nullable_value_type_Value -EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingPrimitiveCollectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingProjectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingProjectionJetTest.Select_associate_collection(queryTrackingBehavior: NoTracking) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingProjectionJetTest.Select_associate_collection(queryTrackingBehavior: TrackAll) @@ -21357,7 +21356,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.Navigatio EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsMiscellaneousJetTest.Where_on_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsMiscellaneousJetTest.Where_on_nested_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsMiscellaneousJetTest.Where_on_optional_associate_scalar_property -EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsPrimitiveCollectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsProjectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsProjectionJetTest.Select_associate_collection(queryTrackingBehavior: NoTracking) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsProjectionJetTest.Select_associate_collection(queryTrackingBehavior: TrackAll) @@ -21436,7 +21434,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.Owne EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsMiscellaneousJetTest.Where_on_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsMiscellaneousJetTest.Where_on_nested_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsMiscellaneousJetTest.Where_on_optional_associate_scalar_property -EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsPrimitiveCollectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_associate_collection(queryTrackingBehavior: NoTracking) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_associate_collection(queryTrackingBehavior: TrackAll) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index 3f7eae67..67877e88 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -21341,7 +21341,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingMiscellaneousJetTest.Where_on_optional_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingMiscellaneousJetTest.Where_property_on_non_nullable_value_type EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingMiscellaneousJetTest.Where_property_on_nullable_value_type_Value -EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingPrimitiveCollectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingProjectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingProjectionJetTest.Select_associate_collection(queryTrackingBehavior: NoTracking) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting.ComplexTableSplittingProjectionJetTest.Select_associate_collection(queryTrackingBehavior: TrackAll) @@ -21446,7 +21445,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.Navigatio EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsMiscellaneousJetTest.Where_on_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsMiscellaneousJetTest.Where_on_nested_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsMiscellaneousJetTest.Where_on_optional_associate_scalar_property -EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsPrimitiveCollectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsProjectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsProjectionJetTest.Select_associate_collection(queryTrackingBehavior: NoTracking) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations.NavigationsProjectionJetTest.Select_associate_collection(queryTrackingBehavior: TrackAll) @@ -21527,7 +21525,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.Owne EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsMiscellaneousJetTest.Where_on_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsMiscellaneousJetTest.Where_on_nested_associate_scalar_property EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsMiscellaneousJetTest.Where_on_optional_associate_scalar_property -EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsPrimitiveCollectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_associate_collection(queryTrackingBehavior: NoTracking) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_associate_collection(queryTrackingBehavior: TrackAll) From ee0379e517b20a4fb6ec0f21421fbf2fd4f43b42 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Wed, 1 Jul 2026 19:39:13 +0800 Subject: [PATCH 41/43] Update README: clarify usage, requirements, and CI feeds Improved README for clarity and completeness: reorganized build badges, updated compatibility matrix, added requirements section, expanded package descriptions, and included getting started instructions with code samples. Renamed "Daily Builds" to "CI Builds" and clarified MyGet usage. Updated support instructions to direct users to GitHub issues. --- docs/README.md | 78 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/docs/README.md b/docs/README.md index 7b60842f..1a9d9f3a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,15 +1,17 @@ # EntityFrameworkCore.Jet -[![Build status](https://github.com/CirrusRedOrg/EntityFrameworkCore.Jet/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/CirrusRedOrg/EntityFrameworkCore.Jet/actions/workflows/build.yml) +[![Build status](https://github.com/CirrusRedOrg/EntityFrameworkCore.Jet/actions/workflows/push.yml/badge.svg?branch=master)](https://github.com/CirrusRedOrg/EntityFrameworkCore.Jet/actions/workflows/push.yml) [![Stable release feed for official builds](https://img.shields.io/nuget/vpre/EntityFrameworkCore.Jet.svg?style=flat-square&label=NuGet)](https://www.nuget.org/packages/EntityFrameworkCore.Jet/) -[![Nightly build feed for release builds](https://img.shields.io/myget/cirrusred/vpre/EntityFrameworkCore.Jet.svg?label=Nightly)](https://www.myget.org/feed/cirrusred/package/nuget/EntityFrameworkCore.Jet) -[![Nightly build feed for debugging enabled builds](https://img.shields.io/myget/cirrusred-debug/vpre/EntityFrameworkCore.Jet.svg?label=Debug)](https://www.myget.org/feed/cirrusred-debug/package/nuget/EntityFrameworkCore.Jet) +[![CI build feed for release builds](https://img.shields.io/myget/cirrusred/vpre/EntityFrameworkCore.Jet.svg?label=CI%20Release)](https://www.myget.org/feed/cirrusred/package/nuget/EntityFrameworkCore.Jet) +[![CI build feed for debugging enabled builds](https://img.shields.io/myget/cirrusred-debug/vpre/EntityFrameworkCore.Jet.svg?label=CI%20Debug)](https://www.myget.org/feed/cirrusred-debug/package/nuget/EntityFrameworkCore.Jet) `EntityFrameworkCore.Jet` is an Entity Framework Core provider for Microsoft Jet/ACE databases (supporting the Microsoft Access database file formats `MDB` and `ACCDB`). ## Compatibility Matrix -| EntityFrameworkCore.Jet Version | EntityFrameworkCore Version | .NET (Core) | Notes | +| EntityFrameworkCore.Jet Version | Entity Framework Core Version | .NET | Notes | | ------------- | ------------- | ------------- | ------------- | +| 10.0.x | 10.0.x | 10.0+ | Current development line | +| 9.0.x | 9.0.x | 9.0+ | Supported | | 8.0.x | 8.0.x | 8.0+ | Alpha 2 onwards is compatible with EF Core RTM | | 7.0.x | 7.0.x | 6.0+ | | 6.0.x | 6.0.x | 6.0+ | @@ -17,12 +19,64 @@ The major version corresponds to the major version of EF Core (i.e. EFCore.Jet `3.x` is compatible with EF Core `3.y`). It runs on Windows operating systems only and can be used with either ODBC or OLE DB together with their respective Access Database driver/provider. +## Requirements + +`EntityFrameworkCore.Jet` requires: + +* Windows. +* A Microsoft Access Database Engine driver/provider for either ODBC or OLE DB. +* A process architecture (`x86` or `x64`) that matches the installed Access driver/provider. + +The provider works with Microsoft Access `MDB` and `ACCDB` database files. + ## Packages -* [EntityFrameworkCore.Jet](https://www.nuget.org/packages/EntityFrameworkCore.Jet/) -* [EntityFrameworkCore.Jet.Data](https://www.nuget.org/packages/EntityFrameworkCore.Jet.Data/) -* [EntityFrameworkCore.Jet.Odbc](https://www.nuget.org/packages/EntityFrameworkCore.Jet.Odbc/) -* [EntityFrameworkCore.Jet.OleDb](https://www.nuget.org/packages/EntityFrameworkCore.Jet.OleDb/) +* [EntityFrameworkCore.Jet](https://www.nuget.org/packages/EntityFrameworkCore.Jet/) - the EF Core provider. +* [EntityFrameworkCore.Jet.Data](https://www.nuget.org/packages/EntityFrameworkCore.Jet.Data/) - the shared ADO.NET-style data access layer used by the provider packages. +* [EntityFrameworkCore.Jet.Odbc](https://www.nuget.org/packages/EntityFrameworkCore.Jet.Odbc/) - ODBC support, including the `UseJetOdbc` extension method. +* [EntityFrameworkCore.Jet.OleDb](https://www.nuget.org/packages/EntityFrameworkCore.Jet.OleDb/) - OLE DB support, including the `UseJetOleDb` extension method. + +## Getting Started + +Install the provider package for the data access technology you want to use: + +```powershell +dotnet add package EntityFrameworkCore.Jet.OleDb +``` + +or: + +```powershell +dotnet add package EntityFrameworkCore.Jet.Odbc +``` + +Configure your `DbContext` with the matching `UseJet...` extension method: + +```csharp +using Microsoft.EntityFrameworkCore; + +public class BloggingContext : DbContext +{ + public DbSet Blogs => Set(); + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + => optionsBuilder.UseJetOleDb( + @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Data\Blogging.accdb"); +} + +public class Blog +{ + public int Id { get; set; } + public string? Url { get; set; } +} +``` + +For ODBC, use `UseJetOdbc` instead: + +```csharp +optionsBuilder.UseJetOdbc( + @"Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\Data\Blogging.accdb;"); +``` ## NuGet Feeds @@ -30,9 +84,9 @@ It runs on Windows operating systems only and can be used with either ODBC or OL All official releases are available on [nuget.org](https://www.nuget.org/packages/EntityFrameworkCore.Jet/). -### Daily Builds +### CI Builds -To use the latest daily builds, add a `NuGet.config` file to your solution root, add the daily feeds you are interested in and enable _prereleases_: +CI publishes each build to MyGet. To use the latest CI builds, add a `NuGet.config` file to your solution root, add the feeds you are interested in and enable _prereleases_: ```xml @@ -45,7 +99,7 @@ To use the latest daily builds, add a `NuGet.config` file to your solution root, ``` -There are two daily build feeds available, one with (optimized) `Release` configuration builds and one with (unoptimized) `Debug` configuration builds. +There are two CI build feeds available, one with (optimized) `Release` configuration builds and one with (unoptimized) `Debug` configuration builds. All packages use SourceLink. ## Fluent API @@ -62,4 +116,4 @@ More information can be found on our [Wiki](https://www.github.com/CirrusRedOrg/ ## Questions -Any questions about how to use `EntityFrameworkCore.Jet` can be ask on [StackOverflow](https://stackoverflow.com/) using the `jet-ef-provider` and `entity-framework-core` tags. +Questions, bug reports, and feature requests can be opened as [GitHub issues](https://github.com/CirrusRedOrg/EntityFrameworkCore.Jet/issues). From 870a889b6ac153be93f27ff6e35054fbf22d21f6 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Wed, 1 Jul 2026 22:09:39 +0800 Subject: [PATCH 42/43] Update CI workflows: action versions & test sharding Upgraded GitHub Actions to latest versions (checkout v5, github-script v8, upload-artifact v6, setup-dotnet v5, test-reporter v3). Improved test sharding by splitting functional tests into core, associations/translations, and non-query shards, each with consistent retry and crash detection logic. Updated artifact handling and clarified comments. --- .github/workflows/auto_commit.yml | 4 +- .github/workflows/pull_request.yml | 69 +++++++++++++++++++++++----- .github/workflows/push.yml | 73 ++++++++++++++++++++++++------ .github/workflows/test_results.yml | 11 ++--- 4 files changed, 123 insertions(+), 34 deletions(-) diff --git a/.github/workflows/auto_commit.yml b/.github/workflows/auto_commit.yml index a54bada3..cfaf66c3 100644 --- a/.github/workflows/auto_commit.yml +++ b/.github/workflows/auto_commit.yml @@ -11,7 +11,7 @@ jobs: if: github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_commit.author.email != 'github-actions@github.com' || github.event.workflow_run.head_commit.message != '[GitHub Actions] Update green tests.') steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: repository: ${{ github.event.workflow_run.head_repository.full_name }} ref: ${{ github.event.workflow_run.head_branch }} @@ -19,7 +19,7 @@ jobs: fetch-depth: 0 - name: 'Download Green Tests' id: DownloadGreenTests - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ac90f27f..4894c9aa 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -28,7 +28,7 @@ jobs: run: | echo 'EventName: ${{ github.event_name }}' - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: ${{ env.checkoutFetchDepth }} - name: 'Get Head Commit Info' @@ -76,7 +76,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set additional variables shell: pwsh run: | @@ -229,7 +229,7 @@ jobs: run: | $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m - - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 1 - Query)' + - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 1 - Query Core)' if: always() && env.skipTests != 'true' shell: pwsh run: | @@ -241,7 +241,7 @@ jobs: } $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' - & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName~.FunctionalTests.Query." + & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName~.FunctionalTests.Query.&FullyQualifiedName!~.FunctionalTests.Query.Associations.&FullyQualifiedName!~.FunctionalTests.Query.Translations." # # Check for test runner crashes: @@ -274,12 +274,57 @@ jobs: exit 2 } exit 0 - - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 2 - Non-Query)' + - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 2 - Query Associations and Translations)' if: always() && env.skipTests != 'true' shell: pwsh run: | $shardDir = '.\test\EFCore.Jet.FunctionalTests\TestResults\shard2' + for ($i = 0; $i -lt 3; $i++) { + if (Test-Path $shardDir -PathType Container) { + Get-ChildItem $shardDir | Remove-Item -Recurse -Force + } + + $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' + & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName~.FunctionalTests.Query.Associations.|FullyQualifiedName~.FunctionalTests.Query.Translations." + + # + # Check for test runner crashes: + # + + $currentTestRunTrx = Get-ChildItem $shardDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1 + if ($null -eq $currentTestRunTrx) { + echo 'Test runner log file is missing.' + exit 3 + } + + $currentTestRunDir = Join-Path $shardDir $currentTestRunTrx.BaseName + if (Test-Path $currentTestRunDir) { + if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) { + # Split string because searching the log for that phrase should only show actual crashes and not this line. + echo ('Test runner cras' + 'hed.') + continue + } + } + + echo 'Test runner ran until the end.' + break + } + + $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" + $failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath + + if ($i -ge 3 -and $failIfKeepsCrashing) { + echo 'Test runner keeps crashing.' + exit 2 + } + exit 0 + - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 3 - Non-Query)' + if: always() && env.skipTests != 'true' + shell: pwsh + run: | + $shardDir = '.\test\EFCore.Jet.FunctionalTests\TestResults\shard3' + for ($i = 0; $i -lt 3; $i++) { if (Test-Path $shardDir -PathType Container) { Get-ChildItem $shardDir | Remove-Item -Recurse -Force @@ -326,7 +371,7 @@ jobs: Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose } - name: 'Upload Test Results' if: always() && env.skipTests != 'true' && env.uploadTestResults == 'true' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: test-results_${{ env.matrixId }} path: | @@ -386,7 +431,7 @@ jobs: echo 'Check succeeded.' - name: 'Upload Green Tests' if: env.commitGreenTestsFile != '' && env.autoCommitGreenTests == 'true' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: green-tests_${{ env.matrixId }} path: ${{ env.commitGreenTestsFile }} @@ -400,7 +445,7 @@ jobs: steps: - name: 'Check Test Results Artifacts' id: CheckTestResultsArtifacts - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -420,14 +465,14 @@ jobs: - name: 'Merge Test Results' id: MergeTestResults if: steps.CheckTestResultsArtifacts.outputs.artifactsAvailable == 'true' - uses: actions/upload-artifact/merge@v4 + uses: actions/upload-artifact/merge@v6 with: name: test-results pattern: test-results_* delete-merged: true - name: 'Check Green Tests Artifacts' id: CheckGreenTestsArtifacts - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -447,7 +492,7 @@ jobs: - name: 'Merge Green Tests' id: MergeGreenTests if: steps.CheckGreenTestsArtifacts.outputs.artifactsAvailable == 'true' - uses: actions/upload-artifact/merge@v4 + uses: actions/upload-artifact/merge@v6 with: name: green-tests pattern: green-tests_* @@ -469,7 +514,7 @@ jobs: # echo $env:NEEDS_CONTEXT - name: 'Download Green Tests' if: needs.MergeArtifacts.outputs.greenTestsAvailable == 'true' - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v7 with: name: green-tests path: green-tests diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c242e1df..ecad2fd2 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -30,7 +30,7 @@ jobs: run: | echo 'EventName: ${{ github.event_name }}' - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: ${{ env.checkoutFetchDepth }} - name: 'Get Head Commit Info' @@ -78,7 +78,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set additional variables shell: pwsh run: | @@ -231,7 +231,7 @@ jobs: run: | $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m - - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 1 - Query)' + - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 1 - Query Core)' if: always() && env.skipTests != 'true' shell: pwsh run: | @@ -243,7 +243,7 @@ jobs: } $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' - & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName~.FunctionalTests.Query." + & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName~.FunctionalTests.Query.&FullyQualifiedName!~.FunctionalTests.Query.Associations.&FullyQualifiedName!~.FunctionalTests.Query.Translations." # # Check for test runner crashes: @@ -276,12 +276,57 @@ jobs: exit 2 } exit 0 - - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 2 - Non-Query)' + - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 2 - Query Associations and Translations)' if: always() && env.skipTests != 'true' shell: pwsh run: | $shardDir = '.\test\EFCore.Jet.FunctionalTests\TestResults\shard2' + for ($i = 0; $i -lt 3; $i++) { + if (Test-Path $shardDir -PathType Container) { + Get-ChildItem $shardDir | Remove-Item -Recurse -Force + } + + $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' + & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m --results-directory $shardDir --filter "FullyQualifiedName~.FunctionalTests.Query.Associations.|FullyQualifiedName~.FunctionalTests.Query.Translations." + + # + # Check for test runner crashes: + # + + $currentTestRunTrx = Get-ChildItem $shardDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1 + if ($null -eq $currentTestRunTrx) { + echo 'Test runner log file is missing.' + exit 3 + } + + $currentTestRunDir = Join-Path $shardDir $currentTestRunTrx.BaseName + if (Test-Path $currentTestRunDir) { + if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) { + # Split string because searching the log for that phrase should only show actual crashes and not this line. + echo ('Test runner cras' + 'hed.') + continue + } + } + + echo 'Test runner ran until the end.' + break + } + + $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" + $failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath + + if ($i -ge 3 -and $failIfKeepsCrashing) { + echo 'Test runner keeps crashing.' + exit 2 + } + exit 0 + - name: 'Run Tests: EFCore.Jet.FunctionalTests (Shard 3 - Non-Query)' + if: always() && env.skipTests != 'true' + shell: pwsh + run: | + $shardDir = '.\test\EFCore.Jet.FunctionalTests\TestResults\shard3' + for ($i = 0; $i -lt 3; $i++) { if (Test-Path $shardDir -PathType Container) { Get-ChildItem $shardDir | Remove-Item -Recurse -Force @@ -328,7 +373,7 @@ jobs: Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose } - name: 'Upload Test Results' if: always() && env.skipTests != 'true' && env.uploadTestResults == 'true' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: test-results_${{ env.matrixId }} path: | @@ -388,7 +433,7 @@ jobs: echo 'Check succeeded.' - name: 'Upload Green Tests' if: ${{ env.commitGreenTestsFile != '' }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: green-tests_${{ env.matrixId }} path: ${{ env.commitGreenTestsFile }} @@ -402,7 +447,7 @@ jobs: steps: - name: 'Check Test Results Artifacts' id: CheckTestResultsArtifacts - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -422,14 +467,14 @@ jobs: - name: 'Merge Test Results' id: MergeTestResults if: steps.CheckTestResultsArtifacts.outputs.artifactsAvailable == 'true' - uses: actions/upload-artifact/merge@v4 + uses: actions/upload-artifact/merge@v6 with: name: test-results pattern: test-results_* delete-merged: true - name: 'Check Green Tests Artifacts' id: CheckGreenTestsArtifacts - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -449,7 +494,7 @@ jobs: - name: 'Merge Green Tests' id: MergeGreenTests if: steps.CheckGreenTestsArtifacts.outputs.artifactsAvailable == 'true' - uses: actions/upload-artifact/merge@v4 + uses: actions/upload-artifact/merge@v6 with: name: green-tests pattern: green-tests_* @@ -462,9 +507,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup .NET SDK - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: global-json-file: global.json - name: .NET Information @@ -542,7 +587,7 @@ jobs: echo "pushToMygetOrg=$pushToMygetOrg" >> $env:GITHUB_ENV echo "pushToNugetOrg=$pushToNugetOrg" >> $env:GITHUB_ENV - name: Upload Artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: nupkgs path: nupkgs diff --git a/.github/workflows/test_results.yml b/.github/workflows/test_results.yml index bcad7a3e..7a7f13db 100644 --- a/.github/workflows/test_results.yml +++ b/.github/workflows/test_results.yml @@ -17,7 +17,7 @@ jobs: shell: bash run: | # - # The later used dorny/test-reporter@v1 action can throw the following exception when enough tests have been + # The later used dorny/test-reporter action can throw the following exception when enough tests have been # executed: # RangeError: Maximum call stack size exceeded # @@ -36,16 +36,15 @@ jobs: which node node --version - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: repository: ${{ github.event.workflow_run.head_repository.full_name }} ref: ${{ github.event.workflow_run.head_branch }} fetch-depth: 1 - # The dorny/test-reporter@v1 action doesn't support actions/upload-artifact@v4 yet. - # We therefore download the artifact manually and feed it to dorny/test-reporter@v1 as local files. + # Download the artifact manually and feed it to dorny/test-reporter as local files. - name: 'Download Test Results' id: DownloadTestResults - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -83,7 +82,7 @@ jobs: dir -Recurse | Select-Object -ExpandProperty FullName - name: 'Publish Test Report' if: steps.ExtractArtifact.conclusion == 'success' - uses: dorny/test-reporter@v1 + uses: dorny/test-reporter@v3 env: # # Can throw the following exception, when enough tests have been executed: From 3418ee053aa8cd47c487b071131c9e8050ee427d Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 1 Jul 2026 17:37:22 +0000 Subject: [PATCH 43/43] [GitHub Actions] Update green tests. --- .../GreenTests/ace_2010_oledb_x86.txt | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index 67877e88..ae1b8b76 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -198,6 +198,8 @@ EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest. EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_Where_set_constant(async: True) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_Where_set_null(async: False) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_Where_set_null(async: True) +EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_Where_set_nullable_int_constant_via_discard_lambda(async: False) +EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_Where_set_nullable_int_constant_via_discard_lambda(async: True) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_Where_set_parameter_from_closure_array(async: False) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_Where_set_parameter_from_closure_array(async: True) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_Where_set_parameter_from_inline_list(async: False) @@ -230,6 +232,10 @@ EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest. EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_LeftJoin(async: True) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_RightJoin(async: False) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_RightJoin(async: True) +EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_select_mixed_entity_scalar_anonymous_projection(async: False) +EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_select_mixed_entity_scalar_anonymous_projection(async: True) +EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_select_scalar_anonymous_projection(async: False) +EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_select_scalar_anonymous_projection(async: True) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_two_inner_joins(async: False) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_with_two_inner_joins(async: True) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesJetTest.Update_without_property_to_set_throws(async: False) @@ -640,6 +646,22 @@ EntityFrameworkCore.Jet.FunctionalTests.CommandInterceptionJetTestBase+CommandIn EntityFrameworkCore.Jet.FunctionalTests.CommandInterceptionJetTestBase+CommandInterceptionWithDiagnosticsJetTest.Intercept_scalar_with_one_app_and_one_injected_interceptor(async: True) EntityFrameworkCore.Jet.FunctionalTests.CommandInterceptionJetTestBase+CommandInterceptionWithDiagnosticsJetTest.Intercept_scalar_with_two_injected_interceptors(async: False) EntityFrameworkCore.Jet.FunctionalTests.CommandInterceptionJetTestBase+CommandInterceptionWithDiagnosticsJetTest.Intercept_scalar_with_two_injected_interceptors(async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_collection(newState: Modified, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_collection(newState: Modified, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_collection(newState: Unchanged, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_collection(newState: Unchanged, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_field_collection(newState: Modified, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_field_collection(newState: Modified, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_field_collection(newState: Unchanged, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_field_collection(newState: Unchanged, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_field_record_collection(newState: Modified, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_field_record_collection(newState: Modified, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_field_record_collection(newState: Unchanged, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_field_record_collection(newState: Unchanged, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_record_collection(newState: Modified, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_record_collection(newState: Modified, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_record_collection(newState: Unchanged, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_change_state_from_Deleted_with_complex_record_collection(newState: Unchanged, async: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_detect_added_elements_in_complex_type_collections(trackFromQuery: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_detect_added_elements_in_complex_type_collections(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_detect_changes_to_nested_teams_members_in_complex_type_collections(trackFromQuery: False) @@ -690,6 +712,8 @@ EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_mark_com EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_mark_complex_type_properties_modified_with_fields(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_mark_complex_type_properties_modified(trackFromQuery: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_mark_complex_type_properties_modified(trackFromQuery: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_null_complex_property_with_default_values_and_multiple_properties(async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_null_complex_property_with_default_values_and_multiple_properties(async: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_read_original_values_for_properties_of_complex_field_collections(trackFromQuery: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_read_original_values_for_properties_of_complex_field_collections(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_read_original_values_for_properties_of_complex_property_bag_collections(trackFromQuery: False) @@ -714,6 +738,10 @@ EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_read_ori EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_read_original_values_for_properties_of_structs_with_fields(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_read_original_values_for_properties_of_structs(trackFromQuery: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_read_original_values_for_properties_of_structs(trackFromQuery: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_remove_from_complex_collection_with_nested_complex_collection(trackFromQuery: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_remove_from_complex_collection_with_nested_complex_collection(trackFromQuery: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_remove_from_complex_field_collection_with_nested_complex_collection(trackFromQuery: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_remove_from_complex_field_collection_with_nested_complex_collection(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_save_default_values_in_optional_complex_property_with_multiple_properties(async: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_save_default_values_in_optional_complex_property_with_multiple_properties(async: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Can_save_null_second_level_complex_property_with_required_properties(async: False) @@ -853,6 +881,22 @@ EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Throws_only_ EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Throws_only_when_saving_with_null_top_level_complex_property(async: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Throws_only_when_saving_with_null_top_level_complex_property(async: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingJetTest.Throws_when_accessing_complex_entries_using_incorrect_cardinality +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_collection(newState: Modified, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_collection(newState: Modified, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_collection(newState: Unchanged, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_collection(newState: Unchanged, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_field_collection(newState: Modified, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_field_collection(newState: Modified, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_field_collection(newState: Unchanged, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_field_collection(newState: Unchanged, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_field_record_collection(newState: Modified, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_field_record_collection(newState: Modified, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_field_record_collection(newState: Unchanged, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_field_record_collection(newState: Unchanged, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_record_collection(newState: Modified, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_record_collection(newState: Modified, async: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_record_collection(newState: Unchanged, async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_change_state_from_Deleted_with_complex_record_collection(newState: Unchanged, async: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_detect_added_elements_in_complex_type_collections(trackFromQuery: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_detect_added_elements_in_complex_type_collections(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_detect_changes_to_nested_teams_members_in_complex_type_collections(trackFromQuery: False) @@ -903,6 +947,8 @@ EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_m EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_mark_complex_type_properties_modified_with_fields(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_mark_complex_type_properties_modified(trackFromQuery: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_mark_complex_type_properties_modified(trackFromQuery: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_null_complex_property_with_default_values_and_multiple_properties(async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_null_complex_property_with_default_values_and_multiple_properties(async: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_read_original_values_for_properties_of_complex_field_collections(trackFromQuery: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_read_original_values_for_properties_of_complex_field_collections(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_read_original_values_for_properties_of_complex_property_bag_collections(trackFromQuery: False) @@ -927,6 +973,12 @@ EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_r EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_read_original_values_for_properties_of_structs_with_fields(trackFromQuery: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_read_original_values_for_properties_of_structs(trackFromQuery: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_read_original_values_for_properties_of_structs(trackFromQuery: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_remove_from_complex_collection_with_nested_complex_collection(trackFromQuery: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_remove_from_complex_collection_with_nested_complex_collection(trackFromQuery: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_remove_from_complex_field_collection_with_nested_complex_collection(trackFromQuery: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_remove_from_complex_field_collection_with_nested_complex_collection(trackFromQuery: True) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_save_default_values_in_optional_complex_property_with_multiple_properties(async: False) +EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_save_default_values_in_optional_complex_property_with_multiple_properties(async: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_save_null_second_level_complex_property_with_required_properties(async: False) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_save_null_second_level_complex_property_with_required_properties(async: True) EntityFrameworkCore.Jet.FunctionalTests.ComplexTypesTrackingProxiesJetTest.Can_save_null_third_level_complex_property_with_all_optional_properties(async: False) @@ -4033,6 +4085,8 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Require EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Reset_unknown_original_value_when_current_value_is_set(async: False) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Reset_unknown_original_value_when_current_value_is_set(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Resetting_a_deleted_reference_fixes_up_again EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Save_changed_optional_one_to_one_with_alternate_key_in_store EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Save_changed_optional_one_to_one_with_alternate_key(changeMechanism: 1, useExistingEntities: False, deleteOrphansTiming: Immediate) @@ -5813,6 +5867,8 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Requir EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Reset_unknown_original_value_when_current_value_is_set(async: False) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Reset_unknown_original_value_when_current_value_is_set(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Resetting_a_deleted_reference_fixes_up_again EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Save_changed_optional_one_to_one_with_alternate_key_in_store EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Save_changed_optional_one_to_one_with_alternate_key(changeMechanism: 1, useExistingEntities: False, deleteOrphansTiming: Immediate) @@ -7362,6 +7418,16 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_man EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: null, deleteOrphansTiming: null) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: OnSaveChanges) @@ -7580,6 +7646,8 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_one EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Reset_unknown_original_value_when_current_value_is_set(async: False) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Reset_unknown_original_value_when_current_value_is_set(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Resetting_a_deleted_reference_fixes_up_again EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Save_changed_optional_one_to_one_with_alternate_key_in_store EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Save_changed_optional_one_to_one_with_alternate_key(changeMechanism: 1, useExistingEntities: False, deleteOrphansTiming: Immediate) @@ -9138,6 +9206,16 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_t EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: null, deleteOrphansTiming: null) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: OnSaveChanges) @@ -9356,6 +9434,8 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_one_to EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Reset_unknown_original_value_when_current_value_is_set(async: False) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Reset_unknown_original_value_when_current_value_is_set(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Resetting_a_deleted_reference_fixes_up_again EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Save_changed_optional_one_to_one_with_alternate_key_in_store EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Save_changed_optional_one_to_one_with_alternate_key(changeMechanism: 1, useExistingEntities: False, deleteOrphansTiming: Immediate) @@ -10909,6 +10989,16 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Immediate, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: Never, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: null, deleteOrphansTiming: null) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached(cascadeDeleteTiming: Immediate, deleteOrphansTiming: OnSaveChanges) @@ -11127,6 +11217,8 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Immediate) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: Never) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added(cascadeDeleteTiming: OnSaveChanges, deleteOrphansTiming: OnSaveChanges) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Reset_unknown_original_value_when_current_value_is_set(async: False) +EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Reset_unknown_original_value_when_current_value_is_set(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Resetting_a_deleted_reference_fixes_up_again EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Save_changed_optional_one_to_one_with_alternate_key_in_store EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetTptIdentityTest.Save_changed_optional_one_to_one_with_alternate_key(changeMechanism: 1, useExistingEntities: False, deleteOrphansTiming: Immediate) @@ -18995,6 +19087,8 @@ EntityFrameworkCore.Jet.FunctionalTests.OptimisticConcurrencyJetTest.Deleting_th EntityFrameworkCore.Jet.FunctionalTests.OptimisticConcurrencyJetTest.External_model_builder_uses_validation EntityFrameworkCore.Jet.FunctionalTests.OptimisticConcurrencyJetTest.Nullable_client_side_concurrency_token_can_be_used EntityFrameworkCore.Jet.FunctionalTests.OptimisticConcurrencyJetTest.Property_entry_original_value_is_set +EntityFrameworkCore.Jet.FunctionalTests.OptimisticConcurrencyJetTest.Row_version_with_TPT_and_owned_types(updateOwnedFirst: True) +EntityFrameworkCore.Jet.FunctionalTests.OptimisticConcurrencyJetTest.Ulong_row_version_with_TPT_and_table_splitting(updateDependentFirst: True) EntityFrameworkCore.Jet.FunctionalTests.OverzealousInitializationJetTest.Fixup_ignores_eagerly_initialized_reference_navs EntityFrameworkCore.Jet.FunctionalTests.PropertyValuesJetTest.Complex_collection_current_values_can_be_accessed_as_a_property_dictionary EntityFrameworkCore.Jet.FunctionalTests.PropertyValuesJetTest.Complex_collection_original_values_can_be_accessed_as_a_property_dictionary @@ -21166,10 +21260,18 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocAdvancedMappingsQueryJetTest. EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocAdvancedMappingsQueryJetTest.Setting_IsUnicode_generates_unicode_literal_in_SQL EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocAdvancedMappingsQueryJetTest.Two_similar_complex_properties_projected_with_split_query1 EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocAdvancedMappingsQueryJetTest.Two_similar_complex_properties_projected_with_split_query2 +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Complex_json_collection_inside_left_join_subquery EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Complex_type_equality_with_non_default_type_mapping EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Complex_type_equals_parameter_with_nested_types_with_property_of_same_name +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Nested_nullable_complex_type_with_discriminator_null_to_non_null_roundtrip EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Non_optional_complex_type_with_all_nullable_properties +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Non_optional_complex_type_with_all_nullable_properties_via_left_join EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Nullable_complex_type_with_discriminator_and_shadow_property +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Nullable_complex_type_with_discriminator_non_null_to_null_roundtrip +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Nullable_complex_type_with_discriminator_null_to_non_null_roundtrip +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Nullable_complex_type_with_discriminator_set_to_different_value +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Nullable_complex_type_with_discriminator_set_to_null +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Nullable_complex_type_with_discriminator_update_non_null_entity_roundtrip EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Optional_complex_type_with_discriminator EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocComplexTypeQueryJetTest.Projecting_complex_property_does_not_auto_include_owned_types EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocManyToManyQueryJetTest.Many_to_many_load_works_when_join_entity_has_custom_key(async: False) @@ -21194,6 +21296,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Dat EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Discriminator_type_is_handled_correctly EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Entity_equality_with_Contains_and_Parameter(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Entity_equality_with_Contains_and_Parameter(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Enum_has_flag_applies_explicit_cast_for_constant +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Enum_has_flag_does_not_apply_explicit_cast_for_non_constant EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Enum_with_value_converter_matching_take_value(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Enum_with_value_converter_matching_take_value(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Explicitly_compiled_query_does_not_add_cache_entry @@ -21288,6 +21392,7 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQueryFiltersQueryJetTest.Quer EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQueryFiltersQueryJetTest.Query_filter_with_db_set_should_not_block_other_filters EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQueryFiltersQueryJetTest.Query_filter_with_null_constant EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQueryFiltersQueryJetTest.Query_filter_with_pk_fk_optimization +EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQueryFiltersQueryJetTest.Query_filter_with_primary_constructor_parameter EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQueryFiltersQueryJetTest.Self_reference_in_query_filter_works EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQueryFiltersQueryJetTest.Weak_entities_with_query_filter_subquery_flattening EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQuerySplittingQueryJetTest.Can_configure_SingleQuery_at_context_level @@ -21556,6 +21661,7 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.Owne EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_root(queryTrackingBehavior: TrackAll) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_scalar_property_on_required_associate(queryTrackingBehavior: NoTracking) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_scalar_property_on_required_associate(queryTrackingBehavior: TrackAll) +EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior: TrackAll) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior: TrackAll) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior: TrackAll) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations.OwnedNavigationsProjectionJetTest.Select_unmapped_associate_scalar_property(queryTrackingBehavior: NoTracking) @@ -21616,6 +21722,7 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting.O EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting.OwnedTableSplittingProjectionJetTest.Select_required_nested_on_required_associate(queryTrackingBehavior: TrackAll) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting.OwnedTableSplittingProjectionJetTest.Select_scalar_property_on_required_associate(queryTrackingBehavior: NoTracking) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting.OwnedTableSplittingProjectionJetTest.Select_scalar_property_on_required_associate(queryTrackingBehavior: TrackAll) +EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting.OwnedTableSplittingProjectionJetTest.Select_subquery_FirstOrDefault_complex_collection(queryTrackingBehavior: TrackAll) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting.OwnedTableSplittingProjectionJetTest.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior: TrackAll) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting.OwnedTableSplittingProjectionJetTest.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior: TrackAll) EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting.OwnedTableSplittingProjectionJetTest.Select_unmapped_associate_scalar_property(queryTrackingBehavior: NoTracking) @@ -22933,6 +23040,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Can_qu EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Can_query_entity_which_is_split_selecting_only_part_3_properties(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Can_query_entity_which_is_split_selecting_only_part_3_properties(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Check_all_tests_overridden +EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Compare_split_entity_to_null(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Compare_split_entity_to_null(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Custom_projection_trim_when_multiple_tables(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Custom_projection_trim_when_multiple_tables(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.EntitySplittingQueryJetTest.Include_collection_on_split_entity(async: False) @@ -24544,6 +24653,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.S EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.Skip_navigation_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_with_predicate(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_with_predicate(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_without_predicate(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type_unidirectional(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type_unidirectional(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type(async: False) @@ -24712,6 +24823,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_naviga EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_navigation_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_navigation_long_count_with_predicate(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_navigation_long_count_with_predicate(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_navigation_long_count_without_predicate(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_navigation_long_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_navigation_of_type_unidirectional(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_navigation_of_type_unidirectional(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ManyToManyQueryJetTest.Skip_navigation_of_type(async: False) @@ -26279,6 +26392,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoi EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoin_simple2(isAsync: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoin_simple3(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoin_simple3(isAsync: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoin_subquery_projection_outer_mixed(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoin_subquery_projection_outer_mixed(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoin_Subquery_with_Take_Then_SelectMany_Where(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoin_Subquery_with_Take_Then_SelectMany_Where(isAsync: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindJoinQueryJetTest.GroupJoin_Where_OrderBy(isAsync: False) @@ -26429,6 +26544,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Can_cast_CreateQuery_result_to_IQueryable_T_bug_1730 EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Can_convert_manually_build_expression_with_default(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Can_convert_manually_build_expression_with_default(isAsync: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Captured_variable_from_switch_case_pattern_matching(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Captured_variable_from_switch_case_pattern_matching(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Cast_results_to_object(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Cast_results_to_object(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Cast_to_object_over_parameter_directly_in_lambda(async: False) @@ -27808,6 +27925,10 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQue EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_distinct_is_server_evaluated(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_force_alias_uniquefication(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_force_alias_uniquefication(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_on_additional_from_clause_with_filter(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_on_additional_from_clause_with_filter(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_on_additional_from_clause(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_on_additional_from_clause(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_on_additional_from_clause2(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_on_additional_from_clause2(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_on_join_clause_with_order_by_and_filter(async: False) @@ -27850,6 +27971,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQue EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_with_client_filter(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_with_conditional_order_by(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_with_conditional_order_by(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_with_cross_join_clause_with_filter(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_with_cross_join_clause_with_filter(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_with_filter_reordered(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_with_filter_reordered(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_collection_with_filter(async: False) @@ -27870,6 +27993,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQue EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_duplicate_collection_result_operator(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_duplicate_collection_result_operator2(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_duplicate_collection_result_operator2(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_duplicate_collection(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_duplicate_collection(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_duplicate_reference(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_duplicate_reference(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeNoTrackingQueryJetTest.Include_duplicate_reference2(async: False) @@ -27991,6 +28116,10 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest. EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_distinct_is_server_evaluated(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_force_alias_uniquefication(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_force_alias_uniquefication(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_on_additional_from_clause_with_filter(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_on_additional_from_clause_with_filter(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_on_additional_from_clause(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_on_additional_from_clause(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_on_additional_from_clause2(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_on_additional_from_clause2(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_on_join_clause_with_order_by_and_filter(async: False) @@ -28033,6 +28162,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest. EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_with_client_filter(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_with_conditional_order_by(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_with_conditional_order_by(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_with_cross_join_clause_with_filter(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_with_cross_join_clause_with_filter(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_with_filter_reordered(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_with_filter_reordered(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_collection_with_filter(async: False) @@ -28053,6 +28184,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest. EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_duplicate_collection_result_operator(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_duplicate_collection_result_operator2(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_duplicate_collection_result_operator2(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_duplicate_collection(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_duplicate_collection(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_duplicate_reference(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_duplicate_reference(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindSplitIncludeQueryJetTest.Include_duplicate_reference2(async: False) @@ -28917,6 +29050,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_sem EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_semantics_applied_to_CompareTo_equality(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_semantics_applied_when_comparing_function_with_nullable_argument_to_a_nullable_column(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_semantics_applied_when_comparing_function_with_nullable_argument_to_a_nullable_column(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_semantics_applied_when_comparing_two_functions_with_multiple_nullable_arguments(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_semantics_applied_when_comparing_two_functions_with_multiple_nullable_arguments(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_semantics_applied_when_comparing_two_functions_with_nullable_arguments(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_semantics_applied_when_comparing_two_functions_with_nullable_arguments(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NullSemanticsQueryJetTest.Null_semantics_coalesce(async: False) @@ -29535,6 +29670,7 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.P EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int_with_EF_Parameter EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct @@ -31047,6 +31183,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTes EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTest.Skip_navigation_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_with_predicate(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_with_predicate(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_without_predicate(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type_unidirectional(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type_unidirectional(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type(async: False) @@ -31216,6 +31354,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_nav EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_navigation_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_navigation_long_count_with_predicate(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_navigation_long_count_with_predicate(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_navigation_long_count_without_predicate(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_navigation_long_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_navigation_of_type_unidirectional(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_navigation_of_type_unidirectional(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPCManyToManyQueryJetTest.Skip_navigation_of_type(async: False) @@ -32755,6 +32895,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTes EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTest.Skip_navigation_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_with_predicate(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_with_predicate(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_without_predicate(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTest.Skip_navigation_long_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type_unidirectional(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type_unidirectional(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyNoTrackingQueryJetTest.Skip_navigation_of_type(async: False) @@ -32924,6 +33066,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_nav EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_navigation_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_navigation_long_count_with_predicate(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_navigation_long_count_with_predicate(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_navigation_long_count_without_predicate(async: False) +EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_navigation_long_count_without_predicate(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_navigation_of_type_unidirectional(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_navigation_of_type_unidirectional(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.TPTManyToManyQueryJetTest.Skip_navigation_of_type(async: False) @@ -33186,6 +33330,7 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MathTranslationsJetTe EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MathTranslationsJetTest.Truncate_project_and_order_by_it_twice3 EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Convert_ToBoolean +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Convert_ToByte EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Convert_ToDouble EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Convert_ToInt16 EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Convert_ToInt32 @@ -33200,6 +33345,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslat EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Random_Shared_Next_with_no_args EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Random_Shared_Next_with_one_arg EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Random_Shared_Next_with_two_args +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Sum_over_bool +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.Sum_over_bool_with_ternary EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.TimeSpan_Compare_to_simple_zero(compareTo: False) EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.MiscellaneousTranslationsJetTest.TimeSpan_Compare_to_simple_zero(compareTo: True) EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Operators.ArithmeticOperatorTranslationsJetTest.Add @@ -33299,6 +33446,7 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJet EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.IsNullOrEmpty EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.IsNullOrEmpty_negated EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.IsNullOrWhiteSpace +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Join_non_aggregate EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Join_over_non_nullable_column EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Join_over_nullable_column EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Join_with_ordering @@ -33328,6 +33476,7 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJet EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Substring_with_one_arg_with_constant EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Substring_with_one_arg_with_parameter EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Substring_with_one_arg_with_zero_startIndex +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Substring_with_two_args_with_IndexOf EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Substring_with_two_args_with_parameter EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Substring_with_two_args_with_zero_length EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.StringTranslationsJetTest.Substring_with_two_args_with_zero_startIndex @@ -33357,11 +33506,15 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTran EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.FromDateTime_compared_to_constant_and_parameter EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.FromDateTime_compared_to_property EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.Month +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.ToDateTime_constant_DateTime_with_property_TimeOnly +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.ToDateTime_property_with_constant_TimeOnly +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.ToDateTime_property_with_property_TimeOnly EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.ToDateTime_with_complex_DateTime EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.ToDateTime_with_complex_TimeOnly EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateOnlyTranslationsJetTest.Year EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.AddDays EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.AddHours +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.AddMilliseconds EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.AddMinutes EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.AddMonths EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.AddSeconds @@ -33369,10 +33522,13 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffs EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Day EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.DayOfYear +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Hour EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Milliseconds_parameter_and_constant +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Minute EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Month EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Now EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Second +EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.TimeOfDay EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.ToUnixTimeSecond EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeOffsetTranslationsJetTest.Year EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal.DateTimeTranslationsJetTest.AddYear @@ -33566,6 +33722,10 @@ EntityFrameworkCore.Jet.FunctionalTests.SaveChangesInterceptionJetTestBase+SaveC EntityFrameworkCore.Jet.FunctionalTests.SaveChangesInterceptionJetTestBase+SaveChangesInterceptionWithDiagnosticsJetTest.Intercept_to_suppress_concurrency_exception(async: True, inject: False, noAcceptChanges: True) EntityFrameworkCore.Jet.FunctionalTests.SaveChangesInterceptionJetTestBase+SaveChangesInterceptionWithDiagnosticsJetTest.Intercept_to_suppress_concurrency_exception(async: True, inject: True, noAcceptChanges: False) EntityFrameworkCore.Jet.FunctionalTests.SaveChangesInterceptionJetTestBase+SaveChangesInterceptionWithDiagnosticsJetTest.Intercept_to_suppress_concurrency_exception(async: True, inject: True, noAcceptChanges: True) +EntityFrameworkCore.Jet.FunctionalTests.Scaffolding.CompiledModelJetTest.BigModel +EntityFrameworkCore.Jet.FunctionalTests.Scaffolding.CompiledModelJetTest.BigModel_with_JSON_columns +EntityFrameworkCore.Jet.FunctionalTests.Scaffolding.CompiledModelJetTest.CheckConstraints +EntityFrameworkCore.Jet.FunctionalTests.Scaffolding.CompiledModelJetTest.Throws_for_custom_function_translation EntityFrameworkCore.Jet.FunctionalTests.Scaffolding.JetDatabaseModelFactoryTest.Column_nullability_is_set EntityFrameworkCore.Jet.FunctionalTests.Scaffolding.JetDatabaseModelFactoryTest.Column_with_sysname_assigns_underlying_store_type_and_nullability EntityFrameworkCore.Jet.FunctionalTests.Scaffolding.JetDatabaseModelFactoryTest.ConcurrencyToken_is_set_for_rowVersion @@ -34580,6 +34740,7 @@ EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendB EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendBulkInsertOperation_appends_insert_if_no_store_generated_columns_exist_default_values_only EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendDeleteOperation_creates_full_delete_command_text EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendDeleteOperation_creates_full_delete_command_text_with_concurrency_check +EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendInsertOperation_appends_insert_and_select_rowcount_if_no_store_generated_columns_exist_or_conditions_exist EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendInsertOperation_for_all_store_generated_columns EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendInsertOperation_for_only_identity EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendInsertOperation_for_only_single_identity_columns @@ -34589,6 +34750,13 @@ EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendU EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendUpdateOperation_for_computed_property EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendUpdateOperation_if_store_generated_columns_dont_exist EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.AppendUpdateOperation_if_store_generated_columns_exist +EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.GenerateNextSequenceValueOperation_correctly_handles_schemas +EntityFrameworkCore.Jet.FunctionalTests.Update.JetUpdateSqlGeneratorTest.GenerateNextSequenceValueOperation_returns_statement_with_sanitized_sequence +EntityFrameworkCore.Jet.FunctionalTests.Update.MismatchedKeyTypesJetTest.Can_update_and_delete_composite_keys_mismatched_in_store +EntityFrameworkCore.Jet.FunctionalTests.Update.MismatchedKeyTypesJetTest.Can_update_and_delete_with_string_FK_and_GUID_PK +EntityFrameworkCore.Jet.FunctionalTests.Update.MismatchedKeyTypesJetTest.Can_update_and_delete_with_tinyint_FK_and_smallint_PK +EntityFrameworkCore.Jet.FunctionalTests.Update.MismatchedKeyTypesJetTest.Queries_work_but_SaveChanges_fails_when_composite_keys_incompatible_in_store +EntityFrameworkCore.Jet.FunctionalTests.Update.MismatchedKeyTypesJetTest.Queries_work_but_SaveChanges_fails_when_keys_incompatible_in_store EntityFrameworkCore.Jet.FunctionalTests.Update.NonSharedModelUpdatesJetTest.DbUpdateException_Entries_is_correct_with_multiple_inserts(async: False) EntityFrameworkCore.Jet.FunctionalTests.Update.NonSharedModelUpdatesJetTest.DbUpdateException_Entries_is_correct_with_multiple_inserts(async: True) EntityFrameworkCore.Jet.FunctionalTests.Update.NonSharedModelUpdatesJetTest.Principal_and_dependent_roundtrips_with_cycle_breaking(async: False)