From 490072698e11efdf105f37295786b45971e4ca47 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 20:20:48 +0000 Subject: [PATCH 1/4] Update dependencies from https://github.com/dotnet/arcade build 20240404.3 (#33512) [release/8.0] Update dependencies from dotnet/arcade --- NuGet.config | 2 -- eng/Version.Details.xml | 12 ++++++------ eng/Versions.props | 2 +- eng/common/native/init-compiler.sh | 2 +- eng/common/templates-official/job/job.yml | 3 ++- eng/common/templates-official/job/onelocbuild.yml | 2 +- .../templates-official/job/publish-build-assets.yml | 4 ++-- eng/common/templates-official/job/source-build.yml | 2 +- .../templates-official/job/source-index-stage1.yml | 2 +- .../templates-official/post-build/post-build.yml | 10 +++++----- .../steps/component-governance.yml | 2 +- .../templates-official/variables/pool-providers.yml | 2 +- eng/common/templates/steps/component-governance.yml | 2 +- global.json | 4 ++-- 14 files changed, 25 insertions(+), 26 deletions(-) diff --git a/NuGet.config b/NuGet.config index a86e73bfa95..77b2bf048ad 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,6 @@ - @@ -19,7 +18,6 @@ - diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6a9637e4386..bfe45fc24c5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -56,17 +56,17 @@ - + https://github.com/dotnet/arcade - f311667e0587f19c3fa9553a909975662107a351 + 188340e12c0a372b1681ad6a5e72c608021efdba - + https://github.com/dotnet/arcade - f311667e0587f19c3fa9553a909975662107a351 + 188340e12c0a372b1681ad6a5e72c608021efdba - + https://github.com/dotnet/arcade - f311667e0587f19c3fa9553a909975662107a351 + 188340e12c0a372b1681ad6a5e72c608021efdba diff --git a/eng/Versions.props b/eng/Versions.props index b56edb94084..9c3eff2ec9d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -32,7 +32,7 @@ 8.0.4-servicing.24169.9 - 8.0.0-beta.24165.4 + 8.0.0-beta.24204.3 diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index f5c1ec7eafe..2d5660642b8 100644 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -63,7 +63,7 @@ if [ -z "$CLR_CC" ]; then # Set default versions if [ -z "$majorVersion" ]; then # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero. - if [ "$compiler" = "clang" ]; then versions="17 16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5" + if [ "$compiler" = "clang" ]; then versions="18 17 16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5" elif [ "$compiler" = "gcc" ]; then versions="13 12 11 10 9 8 7 6 5 4.9"; fi for version in $versions; do diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index a2709d10562..1f035fee73f 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -128,7 +128,7 @@ jobs: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - task: MicroBuildSigningPlugin@3 + - task: MicroBuildSigningPlugin@4 displayName: Install MicroBuild plugin inputs: signType: $(_SignType) @@ -136,6 +136,7 @@ jobs: feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json env: TeamName: $(_TeamName) + MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) diff --git a/eng/common/templates-official/job/onelocbuild.yml b/eng/common/templates-official/job/onelocbuild.yml index ba9ba493032..52b4d05d3f8 100644 --- a/eng/common/templates-official/job/onelocbuild.yml +++ b/eng/common/templates-official/job/onelocbuild.yml @@ -56,7 +56,7 @@ jobs: # If it's not devdiv, it's dnceng ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: name: $(DncEngInternalBuildPool) - image: 1es-windows-2022-pt + image: 1es-windows-2022 os: windows steps: diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml index 53138622fe7..589ac80a18b 100644 --- a/eng/common/templates-official/job/publish-build-assets.yml +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -60,8 +60,8 @@ jobs: os: windows # If it's not devdiv, it's dnceng ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: $(DncEngInternalBuildPool) - image: 1es-windows-2022-pt + name: NetCore1ESPool-Publishing-Internal + image: windows.vs2019.amd64 os: windows steps: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: diff --git a/eng/common/templates-official/job/source-build.yml b/eng/common/templates-official/job/source-build.yml index 8aba3b44bb2..f193dfbe236 100644 --- a/eng/common/templates-official/job/source-build.yml +++ b/eng/common/templates-official/job/source-build.yml @@ -52,7 +52,7 @@ jobs: ${{ if eq(variables['System.TeamProject'], 'internal') }}: name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] - image: 1es-mariner-2-pt + image: 1es-mariner-2 os: linux ${{ if ne(parameters.platform.pool, '') }}: diff --git a/eng/common/templates-official/job/source-index-stage1.yml b/eng/common/templates-official/job/source-index-stage1.yml index 4b633739170..f0513aee5b0 100644 --- a/eng/common/templates-official/job/source-index-stage1.yml +++ b/eng/common/templates-official/job/source-index-stage1.yml @@ -33,7 +33,7 @@ jobs: demands: ImageOverride -equals windows.vs2019.amd64.open ${{ if eq(variables['System.TeamProject'], 'internal') }}: name: $(DncEngInternalBuildPool) - image: 1es-windows-2022-pt + image: windows.vs2022.amd64 os: windows steps: diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml index 5c98fe1c0f3..da1f40958b4 100644 --- a/eng/common/templates-official/post-build/post-build.yml +++ b/eng/common/templates-official/post-build/post-build.yml @@ -110,7 +110,7 @@ stages: # If it's not devdiv, it's dnceng ${{ else }}: name: $(DncEngInternalBuildPool) - image: 1es-windows-2022-pt + image: 1es-windows-2022 os: windows steps: @@ -150,7 +150,7 @@ stages: # If it's not devdiv, it's dnceng ${{ else }}: name: $(DncEngInternalBuildPool) - image: 1es-windows-2022-pt + image: 1es-windows-2022 os: windows steps: - template: setup-maestro-vars.yml @@ -208,7 +208,7 @@ stages: # If it's not devdiv, it's dnceng ${{ else }}: name: $(DncEngInternalBuildPool) - image: 1es-windows-2022-pt + image: 1es-windows-2022 os: windows steps: - template: setup-maestro-vars.yml @@ -261,8 +261,8 @@ stages: os: windows # If it's not devdiv, it's dnceng ${{ else }}: - name: $(DncEngInternalBuildPool) - image: 1es-windows-2022-pt + name: NetCore1ESPool-Publishing-Internal + image: windows.vs2019.amd64 os: windows steps: - template: setup-maestro-vars.yml diff --git a/eng/common/templates-official/steps/component-governance.yml b/eng/common/templates-official/steps/component-governance.yml index 0ecec47b0c9..cbba0596709 100644 --- a/eng/common/templates-official/steps/component-governance.yml +++ b/eng/common/templates-official/steps/component-governance.yml @@ -4,7 +4,7 @@ parameters: steps: - ${{ if eq(parameters.disableComponentGovernance, 'true') }}: - - script: "echo ##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" displayName: Set skipComponentGovernanceDetection variable - ${{ if ne(parameters.disableComponentGovernance, 'true') }}: - task: ComponentGovernanceComponentDetection@0 diff --git a/eng/common/templates-official/variables/pool-providers.yml b/eng/common/templates-official/variables/pool-providers.yml index beab7d1bfba..1f308b24efc 100644 --- a/eng/common/templates-official/variables/pool-providers.yml +++ b/eng/common/templates-official/variables/pool-providers.yml @@ -23,7 +23,7 @@ # # pool: # name: $(DncEngInternalBuildPool) -# image: 1es-windows-2022-pt +# image: 1es-windows-2022 variables: # Coalesce the target and source branches so we know when a PR targets a release branch diff --git a/eng/common/templates/steps/component-governance.yml b/eng/common/templates/steps/component-governance.yml index 0ecec47b0c9..cbba0596709 100644 --- a/eng/common/templates/steps/component-governance.yml +++ b/eng/common/templates/steps/component-governance.yml @@ -4,7 +4,7 @@ parameters: steps: - ${{ if eq(parameters.disableComponentGovernance, 'true') }}: - - script: "echo ##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" displayName: Set skipComponentGovernanceDetection variable - ${{ if ne(parameters.disableComponentGovernance, 'true') }}: - task: ComponentGovernanceComponentDetection@0 diff --git a/global.json b/global.json index bd1f68c7529..83a7611b408 100644 --- a/global.json +++ b/global.json @@ -13,7 +13,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24165.4", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24165.4" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24204.3", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24204.3" } } From 02855c7c8469ba8e5bf6d15eafb02e3839b0fceb Mon Sep 17 00:00:00 2001 From: vseanreesermsft <78103370+vseanreesermsft@users.noreply.github.com> Date: Wed, 1 May 2024 15:31:20 -0700 Subject: [PATCH 2/4] Update branding to 8.0.6 (#33659) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 9c3eff2ec9d..42120a486a5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,6 +1,6 @@ - 8.0.5 + 8.0.6 servicing From d6e69a0c776efb1959b51fd123b5d16696110db0 Mon Sep 17 00:00:00 2001 From: Andriy Svyryd Date: Wed, 1 May 2024 15:31:56 -0700 Subject: [PATCH 3/4] Don't generate a discriminator in the snapshot if there's no discriminator property. (#33622) Fixes #33605 --- .../Design/CSharpSnapshotGenerator.cs | 97 +++++++-------- .../Design/CSharpMigrationsGeneratorTest.cs | 9 +- .../Migrations/ModelSnapshotSqlServerTest.cs | 113 ++++++++++++++++-- 3 files changed, 157 insertions(+), 62 deletions(-) diff --git a/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs b/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs index f05da43282a..ab95476bbe4 100644 --- a/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs +++ b/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs @@ -886,65 +886,68 @@ protected virtual void GenerateKeyAnnotations(string keyBuilderName, IKey key, I ?? discriminatorValueAnnotation?.Value) != null) { - stringBuilder - .AppendLine() - .Append(entityTypeBuilderName) - .Append('.') - .Append("HasDiscriminator"); - var discriminatorProperty = entityType.FindDiscriminatorProperty(); - if (discriminatorPropertyAnnotation?.Value != null - && discriminatorProperty != null) - { - var propertyClrType = FindValueConverter(discriminatorProperty)?.ProviderClrType - .MakeNullable(discriminatorProperty.IsNullable) - ?? discriminatorProperty.ClrType; - stringBuilder - .Append('<') - .Append(Code.Reference(propertyClrType)) - .Append(">(") - .Append(Code.Literal(discriminatorProperty.Name)) - .Append(')'); - } - else + if (discriminatorProperty != null) { stringBuilder - .Append("()"); - } + .AppendLine() + .Append(entityTypeBuilderName) + .Append('.') + .Append("HasDiscriminator"); - if (discriminatorMappingCompleteAnnotation?.Value != null) - { - var value = (bool)discriminatorMappingCompleteAnnotation.Value; + if (discriminatorProperty.DeclaringType == entityType + && discriminatorProperty.Name != "Discriminator") + { + var propertyClrType = FindValueConverter(discriminatorProperty)?.ProviderClrType + .MakeNullable(discriminatorProperty.IsNullable) + ?? discriminatorProperty.ClrType; + stringBuilder + .Append('<') + .Append(Code.Reference(propertyClrType)) + .Append(">(") + .Append(Code.Literal(discriminatorProperty.Name)) + .Append(')'); + } + else + { + stringBuilder + .Append("()"); + } - stringBuilder - .Append('.') - .Append("IsComplete") - .Append('(') - .Append(Code.Literal(value)) - .Append(')'); - } + if (discriminatorMappingCompleteAnnotation?.Value != null) + { + var value = (bool)discriminatorMappingCompleteAnnotation.Value; - if (discriminatorValueAnnotation?.Value != null) - { - var value = discriminatorValueAnnotation.Value; - if (discriminatorProperty != null) + stringBuilder + .Append('.') + .Append("IsComplete") + .Append('(') + .Append(Code.Literal(value)) + .Append(')'); + } + + if (discriminatorValueAnnotation?.Value != null) { - var valueConverter = FindValueConverter(discriminatorProperty); - if (valueConverter != null) + var value = discriminatorValueAnnotation.Value; + if (discriminatorProperty != null) { - value = valueConverter.ConvertToProvider(value); + var valueConverter = FindValueConverter(discriminatorProperty); + if (valueConverter != null) + { + value = valueConverter.ConvertToProvider(value); + } } + + stringBuilder + .Append('.') + .Append("HasValue") + .Append('(') + .Append(Code.UnknownLiteral(value)) + .Append(')'); } - stringBuilder - .Append('.') - .Append("HasValue") - .Append('(') - .Append(Code.UnknownLiteral(value)) - .Append(')'); + stringBuilder.AppendLine(";"); } - - stringBuilder.AppendLine(";"); } GenerateAnnotations(entityTypeBuilderName, entityType, stringBuilder, annotations, inChainedCall: false); diff --git a/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.cs b/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.cs index 58e161ecff2..da2340028c2 100644 --- a/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.cs +++ b/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.cs @@ -134,14 +134,7 @@ public void Test_new_annotations_handled_for_entity_types() }, { CoreAnnotationNames.DiscriminatorValue, ("MyDiscriminatorValue", - _toTable - + ";" - + _nl - + _nl - + "entityTypeBuilder.HasDiscriminator" - + "()." - + nameof(DiscriminatorBuilder.HasValue) - + @"(""MyDiscriminatorValue"")") + _toTable) }, { RelationalAnnotationNames.Comment, ("My Comment", diff --git a/test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs b/test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs index c942f6ee484..5642e6e7516 100644 --- a/test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs +++ b/test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs @@ -999,6 +999,105 @@ protected override void BuildModel(ModelBuilder modelBuilder) Assert.Null(humanPetType.GetViewName()); }); + [ConditionalFact] // Issue #33605 + public virtual void Abstract_base_class_with_TPT() + => Test( + builder => + { + builder.Entity().ToTable("Cats"); + builder.Entity().ToTable("Dogs"); + builder.Entity(); + builder.Ignore(); + builder.Ignore(); + builder.Ignore(); + }, + """ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace RootNamespace +{ + [DbContext(typeof(DbContext))] + partial class Snapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("DefaultSchema") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.EntityFrameworkCore.Migrations.ModelSnapshotSqlServerTest+Cat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EducationLevel") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Vet") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Cats", "DefaultSchema"); + }); + + modelBuilder.Entity("Microsoft.EntityFrameworkCore.Migrations.ModelSnapshotSqlServerTest+Dog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FavoriteToy") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Vet") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Dogs", "DefaultSchema"); + }); +#pragma warning restore 612, 618 + } + } +} + +""", + model => + { + Assert.Equal(5, model.GetAnnotations().Count()); + Assert.Equal(2, model.GetEntityTypes().Count()); + + var catType = model.FindEntityType("Microsoft.EntityFrameworkCore.Migrations.ModelSnapshotSqlServerTest+Cat"); + Assert.Equal("Cats", catType.GetTableName()); + Assert.Null(catType.GetViewName()); + Assert.Null(catType.FindProperty("Discriminator")); + + var dogType = model.FindEntityType("Microsoft.EntityFrameworkCore.Migrations.ModelSnapshotSqlServerTest+Dog"); + Assert.Equal("Dogs", dogType.GetTableName()); + Assert.Null(dogType.GetViewName()); + }); + [ConditionalFact] public virtual void Entity_splitting_is_stored_in_snapshot_with_tables() => Test( @@ -1678,7 +1777,7 @@ public virtual void CheckConstraint_is_only_stored_in_snapshot_once_for_TPH() b.ToTable("BaseEntity", "DefaultSchema"); - b.HasDiscriminator("Discriminator").HasValue("BaseEntity"); + b.HasDiscriminator().HasValue("BaseEntity"); b.UseTphMappingStrategy(); }); @@ -2011,7 +2110,7 @@ public virtual void BaseType_is_stored_in_snapshot() b.ToTable("BaseEntity", "DefaultSchema"); - b.HasDiscriminator("Discriminator").HasValue("BaseEntity"); + b.HasDiscriminator().HasValue("BaseEntity"); b.UseTphMappingStrategy(); }); @@ -2082,7 +2181,7 @@ public virtual void Discriminator_annotations_are_stored_in_snapshot() b.ToTable("BaseEntity", "DefaultSchema"); - b.HasDiscriminator("Discriminator").IsComplete(true).HasValue("BaseEntity"); + b.HasDiscriminator().IsComplete(true).HasValue("BaseEntity"); b.UseTphMappingStrategy(); }); @@ -2158,7 +2257,7 @@ public virtual void Converted_discriminator_annotations_are_stored_in_snapshot() b.ToTable("BaseEntityWithStructDiscriminator", "DefaultSchema"); - b.HasDiscriminator("Discriminator").IsComplete(true).HasValue("Base"); + b.HasDiscriminator().IsComplete(true).HasValue("Base"); b.UseTphMappingStrategy(); }); @@ -4614,7 +4713,7 @@ public virtual void Property_column_name_is_stored_in_snapshot_when_DefaultColum b.ToTable("BarBase", "DefaultSchema"); - b.HasDiscriminator("Discriminator").HasValue("BarBase"); + b.HasDiscriminator().HasValue("BarBase"); b.UseTphMappingStrategy(); }); @@ -4830,7 +4929,7 @@ public virtual void Property_column_name_on_specific_table_is_stored_in_snapshot b.ToTable("BaseEntity", "DefaultSchema"); - b.HasDiscriminator("Discriminator").HasValue("BaseEntity"); + b.HasDiscriminator().HasValue("BaseEntity"); b.UseTphMappingStrategy(); }); @@ -7090,7 +7189,7 @@ public virtual void Do_not_generate_entity_type_builder_again_if_no_foreign_key_ b.ToTable("BaseType", "DefaultSchema"); - b.HasDiscriminator("Discriminator").HasValue("BaseType"); + b.HasDiscriminator().HasValue("BaseType"); b.UseTphMappingStrategy(); }); From ea5724dbb5048013a0eac7ae4e859befd2841227 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Thu, 2 May 2024 01:32:48 +0300 Subject: [PATCH 4/4] [release/8.0] Fix parameter names for nested types in complex type equality (#33527) (#33548) * Fix parameter names for nested types in complex type equality (#33527) Fixes #33449 (cherry picked from commit 89e9446ccd7412eb00103434dbe8a905cbc97705) * adding missing test code --------- Co-authored-by: maumar --- ...lationalSqlTranslatingExpressionVisitor.cs | 30 ++++++- .../InMemoryComplianceTest.cs | 1 + .../Query/AdHocComplexTypeQueryTestBase.cs | 82 +++++++++++++++++++ .../AdHocComplexTypeQuerySqlServerTest.cs | 32 ++++++++ .../Query/ComplexTypeQuerySqlServerTest.cs | 24 +++--- .../Query/AdHocComplexTypeQuerySqliteTest.cs | 10 +++ .../Query/ComplexTypeQuerySqliteTest.cs | 24 +++--- 7 files changed, 175 insertions(+), 28 deletions(-) create mode 100644 test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs create mode 100644 test/EFCore.SqlServer.FunctionalTests/Query/AdHocComplexTypeQuerySqlServerTest.cs create mode 100644 test/EFCore.Sqlite.FunctionalTests/Query/AdHocComplexTypeQuerySqliteTest.cs diff --git a/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs index a9932d09def..4a42e26c611 100644 --- a/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs +++ b/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Diagnostics.CodeAnalysis; +using System.Text; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Query.SqlExpressions; @@ -60,6 +61,9 @@ public class RelationalSqlTranslatingExpressionVisitor : ExpressionVisitor private bool _throwForNotTranslatedEfProperty; + private static readonly bool UseOldBehavior33449 = + AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue33449", out var enabled33449) && enabled33449; + /// /// Creates a new instance of the class. /// @@ -2045,11 +2049,29 @@ private Expression CreatePropertyAccessExpression(Expression target, IProperty p Expression.Constant(property, typeof(IProperty))), QueryCompilationContext.QueryContextParameter); - var newParameterName = - $"{RuntimeParameterPrefix}" - + $"{chainExpression.ParameterExpression.Name[QueryCompilationContext.QueryParameterPrefix.Length..]}_{property.Name}"; + if (UseOldBehavior33449) + { + var newParameterName = + $"{RuntimeParameterPrefix}" + + $"{chainExpression.ParameterExpression.Name[QueryCompilationContext.QueryParameterPrefix.Length..]}_{property.Name}"; - return _queryCompilationContext.RegisterRuntimeParameter(newParameterName, lambda); + return _queryCompilationContext.RegisterRuntimeParameter(newParameterName, lambda); + } + else + { + var parameterNameBuilder = new StringBuilder(RuntimeParameterPrefix) + .Append(chainExpression.ParameterExpression.Name[QueryCompilationContext.QueryParameterPrefix.Length..]) + .Append('_'); + + foreach (var complexProperty in chainExpression.ComplexPropertyChain) + { + parameterNameBuilder.Append(complexProperty.Name).Append('_'); + } + + parameterNameBuilder.Append(property.Name); + + return _queryCompilationContext.RegisterRuntimeParameter(parameterNameBuilder.ToString(), lambda); + } } case MemberInitExpression memberInitExpression diff --git a/test/EFCore.InMemory.FunctionalTests/InMemoryComplianceTest.cs b/test/EFCore.InMemory.FunctionalTests/InMemoryComplianceTest.cs index c6539c804e2..666a22e8a8e 100644 --- a/test/EFCore.InMemory.FunctionalTests/InMemoryComplianceTest.cs +++ b/test/EFCore.InMemory.FunctionalTests/InMemoryComplianceTest.cs @@ -9,6 +9,7 @@ public class InMemoryComplianceTest : ComplianceTestBase { // No in-memory tests typeof(ComplexTypeQueryTestBase<>), + typeof(AdHocComplexTypeQueryTestBase), typeof(PrimitiveCollectionsQueryTestBase<>), typeof(NonSharedPrimitiveCollectionsQueryTestBase), typeof(FunkyDataQueryTestBase<>), diff --git a/test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs new file mode 100644 index 00000000000..93e1a435cd3 --- /dev/null +++ b/test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs @@ -0,0 +1,82 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.EntityFrameworkCore.Query; + +// ReSharper disable ClassNeverInstantiated.Local + +public abstract class AdHocComplexTypeQueryTestBase : NonSharedModelTestBase +{ + #region 33449 + + [ConditionalFact] + public virtual async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() + { + var contextFactory = await InitializeAsync( + seed: context => + { + context.AddRange( + new Context33449.EntityType + { + ComplexContainer = new() + { + Id = 1, + Containee1 = new() { Id = 2 }, + Containee2 = new() { Id = 3 } + } + }); + context.SaveChanges(); + }); + + await using var context = contextFactory.CreateContext(); + + var container = new Context33449.ComplexContainer + { + Id = 1, + Containee1 = new() { Id = 2 }, + Containee2 = new() { Id = 3 } + }; + + _ = await context.Set().Where(b => b.ComplexContainer == container).SingleAsync(); + } + + private class Context33449(DbContextOptions options) : DbContext(options) + { + protected override void OnModelCreating(ModelBuilder modelBuilder) + => modelBuilder.Entity().ComplexProperty(b => b.ComplexContainer, x => + { + x.IsRequired(); + x.ComplexProperty(c => c.Containee1).IsRequired(); + x.ComplexProperty(c => c.Containee2).IsRequired(); + }); + + public class EntityType + { + public int Id { get; set; } + public ComplexContainer ComplexContainer { get; set; } = null!; + } + + public class ComplexContainer + { + public int Id { get; set; } + + public ComplexContainee1 Containee1 { get; set; } = null!; + public ComplexContainee2 Containee2 { get; set; } = null!; + } + + public class ComplexContainee1 + { + public int Id { get; set; } + } + + public class ComplexContainee2 + { + public int Id { get; set; } + } + } + + #endregion 33449 + + protected override string StoreName + => "AdHocComplexTypeQueryTest"; +} diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocComplexTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocComplexTypeQuerySqlServerTest.cs new file mode 100644 index 00000000000..4438bd8366f --- /dev/null +++ b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocComplexTypeQuerySqlServerTest.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.EntityFrameworkCore.Query; + +public class AdHocComplexTypeQuerySqlServerTest : AdHocComplexTypeQueryTestBase +{ + public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() + { + await base.Complex_type_equals_parameter_with_nested_types_with_property_of_same_name(); + + AssertSql( + """ +@__entity_equality_container_0_Id='1' (Nullable = true) +@__entity_equality_container_0_Containee1_Id='2' (Nullable = true) +@__entity_equality_container_0_Containee2_Id='3' (Nullable = true) + +SELECT TOP(2) [e].[Id], [e].[ComplexContainer_Id], [e].[ComplexContainer_Containee1_Id], [e].[ComplexContainer_Containee2_Id] +FROM [EntityType] AS [e] +WHERE [e].[ComplexContainer_Id] = @__entity_equality_container_0_Id AND [e].[ComplexContainer_Containee1_Id] = @__entity_equality_container_0_Containee1_Id AND [e].[ComplexContainer_Containee2_Id] = @__entity_equality_container_0_Containee2_Id +"""); + } + + protected TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; + + protected void AssertSql(params string[] expected) + => TestSqlLoggerFactory.AssertBaseline(expected); + + protected override ITestStoreFactory TestStoreFactory + => SqlServerTestStoreFactory.Instance; +} diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexTypeQuerySqlServerTest.cs index cbaf021a01c..5cff404a8c6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexTypeQuerySqlServerTest.cs @@ -233,12 +233,12 @@ public override async Task Complex_type_equals_parameter(bool async) """ @__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 4000) @__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Code='US' (Size = 4000) -@__entity_equality_address_0_FullName='United States' (Size = 4000) +@__entity_equality_address_0_Country_Code='US' (Size = 4000) +@__entity_equality_address_0_Country_FullName='United States' (Size = 4000) SELECT [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName] FROM [Customer] AS [c] -WHERE [c].[ShippingAddress_AddressLine1] = @__entity_equality_address_0_AddressLine1 AND [c].[ShippingAddress_AddressLine2] IS NULL AND [c].[ShippingAddress_ZipCode] = @__entity_equality_address_0_ZipCode AND [c].[ShippingAddress_Country_Code] = @__entity_equality_address_0_Code AND [c].[ShippingAddress_Country_FullName] = @__entity_equality_address_0_FullName +WHERE [c].[ShippingAddress_AddressLine1] = @__entity_equality_address_0_AddressLine1 AND [c].[ShippingAddress_AddressLine2] IS NULL AND [c].[ShippingAddress_ZipCode] = @__entity_equality_address_0_ZipCode AND [c].[ShippingAddress_Country_Code] = @__entity_equality_address_0_Country_Code AND [c].[ShippingAddress_Country_FullName] = @__entity_equality_address_0_Country_FullName """); } @@ -264,15 +264,15 @@ public override async Task Contains_over_complex_type(bool async) """ @__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 4000) @__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Code='US' (Size = 4000) -@__entity_equality_address_0_FullName='United States' (Size = 4000) +@__entity_equality_address_0_Country_Code='US' (Size = 4000) +@__entity_equality_address_0_Country_FullName='United States' (Size = 4000) SELECT [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName] FROM [Customer] AS [c] WHERE EXISTS ( SELECT 1 FROM [Customer] AS [c0] - WHERE [c0].[ShippingAddress_AddressLine1] = @__entity_equality_address_0_AddressLine1 AND [c0].[ShippingAddress_AddressLine2] IS NULL AND [c0].[ShippingAddress_ZipCode] = @__entity_equality_address_0_ZipCode AND [c0].[ShippingAddress_Country_Code] = @__entity_equality_address_0_Code AND [c0].[ShippingAddress_Country_FullName] = @__entity_equality_address_0_FullName) + WHERE [c0].[ShippingAddress_AddressLine1] = @__entity_equality_address_0_AddressLine1 AND [c0].[ShippingAddress_AddressLine2] IS NULL AND [c0].[ShippingAddress_ZipCode] = @__entity_equality_address_0_ZipCode AND [c0].[ShippingAddress_Country_Code] = @__entity_equality_address_0_Country_Code AND [c0].[ShippingAddress_Country_FullName] = @__entity_equality_address_0_Country_FullName) """); } @@ -600,12 +600,12 @@ public override async Task Struct_complex_type_equals_parameter(bool async) """ @__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 4000) @__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Code='US' (Size = 4000) -@__entity_equality_address_0_FullName='United States' (Size = 4000) +@__entity_equality_address_0_Country_Code='US' (Size = 4000) +@__entity_equality_address_0_Country_FullName='United States' (Size = 4000) SELECT [v].[Id], [v].[Name], [v].[BillingAddress_AddressLine1], [v].[BillingAddress_AddressLine2], [v].[BillingAddress_ZipCode], [v].[BillingAddress_Country_Code], [v].[BillingAddress_Country_FullName], [v].[ShippingAddress_AddressLine1], [v].[ShippingAddress_AddressLine2], [v].[ShippingAddress_ZipCode], [v].[ShippingAddress_Country_Code], [v].[ShippingAddress_Country_FullName] FROM [ValuedCustomer] AS [v] -WHERE [v].[ShippingAddress_AddressLine1] = @__entity_equality_address_0_AddressLine1 AND [v].[ShippingAddress_AddressLine2] IS NULL AND [v].[ShippingAddress_ZipCode] = @__entity_equality_address_0_ZipCode AND [v].[ShippingAddress_Country_Code] = @__entity_equality_address_0_Code AND [v].[ShippingAddress_Country_FullName] = @__entity_equality_address_0_FullName +WHERE [v].[ShippingAddress_AddressLine1] = @__entity_equality_address_0_AddressLine1 AND [v].[ShippingAddress_AddressLine2] IS NULL AND [v].[ShippingAddress_ZipCode] = @__entity_equality_address_0_ZipCode AND [v].[ShippingAddress_Country_Code] = @__entity_equality_address_0_Country_Code AND [v].[ShippingAddress_Country_FullName] = @__entity_equality_address_0_Country_FullName """); } @@ -624,15 +624,15 @@ public override async Task Contains_over_struct_complex_type(bool async) """ @__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 4000) @__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Code='US' (Size = 4000) -@__entity_equality_address_0_FullName='United States' (Size = 4000) +@__entity_equality_address_0_Country_Code='US' (Size = 4000) +@__entity_equality_address_0_Country_FullName='United States' (Size = 4000) SELECT [v].[Id], [v].[Name], [v].[BillingAddress_AddressLine1], [v].[BillingAddress_AddressLine2], [v].[BillingAddress_ZipCode], [v].[BillingAddress_Country_Code], [v].[BillingAddress_Country_FullName], [v].[ShippingAddress_AddressLine1], [v].[ShippingAddress_AddressLine2], [v].[ShippingAddress_ZipCode], [v].[ShippingAddress_Country_Code], [v].[ShippingAddress_Country_FullName] FROM [ValuedCustomer] AS [v] WHERE EXISTS ( SELECT 1 FROM [ValuedCustomer] AS [v0] - WHERE [v0].[ShippingAddress_AddressLine1] = @__entity_equality_address_0_AddressLine1 AND [v0].[ShippingAddress_AddressLine2] IS NULL AND [v0].[ShippingAddress_ZipCode] = @__entity_equality_address_0_ZipCode AND [v0].[ShippingAddress_Country_Code] = @__entity_equality_address_0_Code AND [v0].[ShippingAddress_Country_FullName] = @__entity_equality_address_0_FullName) + WHERE [v0].[ShippingAddress_AddressLine1] = @__entity_equality_address_0_AddressLine1 AND [v0].[ShippingAddress_AddressLine2] IS NULL AND [v0].[ShippingAddress_ZipCode] = @__entity_equality_address_0_ZipCode AND [v0].[ShippingAddress_Country_Code] = @__entity_equality_address_0_Country_Code AND [v0].[ShippingAddress_Country_FullName] = @__entity_equality_address_0_Country_FullName) """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/AdHocComplexTypeQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/AdHocComplexTypeQuerySqliteTest.cs new file mode 100644 index 00000000000..f9aa99e7c4a --- /dev/null +++ b/test/EFCore.Sqlite.FunctionalTests/Query/AdHocComplexTypeQuerySqliteTest.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.EntityFrameworkCore.Query; + +public class AdHocComplexTypeQuerySqliteTest : AdHocComplexTypeQueryTestBase +{ + protected override ITestStoreFactory TestStoreFactory + => SqliteTestStoreFactory.Instance; +} diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/ComplexTypeQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/ComplexTypeQuerySqliteTest.cs index ace097abb2a..5c9fe48a4c2 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/ComplexTypeQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/ComplexTypeQuerySqliteTest.cs @@ -233,12 +233,12 @@ public override async Task Complex_type_equals_parameter(bool async) """ @__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 21) @__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Code='US' (Size = 2) -@__entity_equality_address_0_FullName='United States' (Size = 13) +@__entity_equality_address_0_Country_Code='US' (Size = 2) +@__entity_equality_address_0_Country_FullName='United States' (Size = 13) SELECT "c"."Id", "c"."Name", "c"."BillingAddress_AddressLine1", "c"."BillingAddress_AddressLine2", "c"."BillingAddress_ZipCode", "c"."BillingAddress_Country_Code", "c"."BillingAddress_Country_FullName", "c"."ShippingAddress_AddressLine1", "c"."ShippingAddress_AddressLine2", "c"."ShippingAddress_ZipCode", "c"."ShippingAddress_Country_Code", "c"."ShippingAddress_Country_FullName" FROM "Customer" AS "c" -WHERE "c"."ShippingAddress_AddressLine1" = @__entity_equality_address_0_AddressLine1 AND "c"."ShippingAddress_AddressLine2" IS NULL AND "c"."ShippingAddress_ZipCode" = @__entity_equality_address_0_ZipCode AND "c"."ShippingAddress_Country_Code" = @__entity_equality_address_0_Code AND "c"."ShippingAddress_Country_FullName" = @__entity_equality_address_0_FullName +WHERE "c"."ShippingAddress_AddressLine1" = @__entity_equality_address_0_AddressLine1 AND "c"."ShippingAddress_AddressLine2" IS NULL AND "c"."ShippingAddress_ZipCode" = @__entity_equality_address_0_ZipCode AND "c"."ShippingAddress_Country_Code" = @__entity_equality_address_0_Country_Code AND "c"."ShippingAddress_Country_FullName" = @__entity_equality_address_0_Country_FullName """); } @@ -264,15 +264,15 @@ public override async Task Contains_over_complex_type(bool async) """ @__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 21) @__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Code='US' (Size = 2) -@__entity_equality_address_0_FullName='United States' (Size = 13) +@__entity_equality_address_0_Country_Code='US' (Size = 2) +@__entity_equality_address_0_Country_FullName='United States' (Size = 13) SELECT "c"."Id", "c"."Name", "c"."BillingAddress_AddressLine1", "c"."BillingAddress_AddressLine2", "c"."BillingAddress_ZipCode", "c"."BillingAddress_Country_Code", "c"."BillingAddress_Country_FullName", "c"."ShippingAddress_AddressLine1", "c"."ShippingAddress_AddressLine2", "c"."ShippingAddress_ZipCode", "c"."ShippingAddress_Country_Code", "c"."ShippingAddress_Country_FullName" FROM "Customer" AS "c" WHERE EXISTS ( SELECT 1 FROM "Customer" AS "c0" - WHERE "c0"."ShippingAddress_AddressLine1" = @__entity_equality_address_0_AddressLine1 AND "c0"."ShippingAddress_AddressLine2" IS NULL AND "c0"."ShippingAddress_ZipCode" = @__entity_equality_address_0_ZipCode AND "c0"."ShippingAddress_Country_Code" = @__entity_equality_address_0_Code AND "c0"."ShippingAddress_Country_FullName" = @__entity_equality_address_0_FullName) + WHERE "c0"."ShippingAddress_AddressLine1" = @__entity_equality_address_0_AddressLine1 AND "c0"."ShippingAddress_AddressLine2" IS NULL AND "c0"."ShippingAddress_ZipCode" = @__entity_equality_address_0_ZipCode AND "c0"."ShippingAddress_Country_Code" = @__entity_equality_address_0_Country_Code AND "c0"."ShippingAddress_Country_FullName" = @__entity_equality_address_0_Country_FullName) """); } @@ -600,12 +600,12 @@ public override async Task Struct_complex_type_equals_parameter(bool async) """ @__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 21) @__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Code='US' (Size = 2) -@__entity_equality_address_0_FullName='United States' (Size = 13) +@__entity_equality_address_0_Country_Code='US' (Size = 2) +@__entity_equality_address_0_Country_FullName='United States' (Size = 13) SELECT "v"."Id", "v"."Name", "v"."BillingAddress_AddressLine1", "v"."BillingAddress_AddressLine2", "v"."BillingAddress_ZipCode", "v"."BillingAddress_Country_Code", "v"."BillingAddress_Country_FullName", "v"."ShippingAddress_AddressLine1", "v"."ShippingAddress_AddressLine2", "v"."ShippingAddress_ZipCode", "v"."ShippingAddress_Country_Code", "v"."ShippingAddress_Country_FullName" FROM "ValuedCustomer" AS "v" -WHERE "v"."ShippingAddress_AddressLine1" = @__entity_equality_address_0_AddressLine1 AND "v"."ShippingAddress_AddressLine2" IS NULL AND "v"."ShippingAddress_ZipCode" = @__entity_equality_address_0_ZipCode AND "v"."ShippingAddress_Country_Code" = @__entity_equality_address_0_Code AND "v"."ShippingAddress_Country_FullName" = @__entity_equality_address_0_FullName +WHERE "v"."ShippingAddress_AddressLine1" = @__entity_equality_address_0_AddressLine1 AND "v"."ShippingAddress_AddressLine2" IS NULL AND "v"."ShippingAddress_ZipCode" = @__entity_equality_address_0_ZipCode AND "v"."ShippingAddress_Country_Code" = @__entity_equality_address_0_Country_Code AND "v"."ShippingAddress_Country_FullName" = @__entity_equality_address_0_Country_FullName """); } @@ -624,15 +624,15 @@ public override async Task Contains_over_struct_complex_type(bool async) """ @__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 21) @__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Code='US' (Size = 2) -@__entity_equality_address_0_FullName='United States' (Size = 13) +@__entity_equality_address_0_Country_Code='US' (Size = 2) +@__entity_equality_address_0_Country_FullName='United States' (Size = 13) SELECT "v"."Id", "v"."Name", "v"."BillingAddress_AddressLine1", "v"."BillingAddress_AddressLine2", "v"."BillingAddress_ZipCode", "v"."BillingAddress_Country_Code", "v"."BillingAddress_Country_FullName", "v"."ShippingAddress_AddressLine1", "v"."ShippingAddress_AddressLine2", "v"."ShippingAddress_ZipCode", "v"."ShippingAddress_Country_Code", "v"."ShippingAddress_Country_FullName" FROM "ValuedCustomer" AS "v" WHERE EXISTS ( SELECT 1 FROM "ValuedCustomer" AS "v0" - WHERE "v0"."ShippingAddress_AddressLine1" = @__entity_equality_address_0_AddressLine1 AND "v0"."ShippingAddress_AddressLine2" IS NULL AND "v0"."ShippingAddress_ZipCode" = @__entity_equality_address_0_ZipCode AND "v0"."ShippingAddress_Country_Code" = @__entity_equality_address_0_Code AND "v0"."ShippingAddress_Country_FullName" = @__entity_equality_address_0_FullName) + WHERE "v0"."ShippingAddress_AddressLine1" = @__entity_equality_address_0_AddressLine1 AND "v0"."ShippingAddress_AddressLine2" IS NULL AND "v0"."ShippingAddress_ZipCode" = @__entity_equality_address_0_ZipCode AND "v0"."ShippingAddress_Country_Code" = @__entity_equality_address_0_Country_Code AND "v0"."ShippingAddress_Country_FullName" = @__entity_equality_address_0_Country_FullName) """); }