Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dotnet/efcore
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 59af0345ab32ba93445c400f29f199c1a37030a6
Choose a base ref
..
head repository: dotnet/efcore
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 72564a517f933f25eb3d8133b59e35f8365c6887
Choose a head ref
Showing with 11 additions and 11 deletions.
  1. +11 −11 src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs
Original file line number Diff line number Diff line change
@@ -1390,9 +1390,9 @@ private bool TryRewriteEntityEquality(
|| IsNullSqlConstantExpression(right))
{
var nonNullEntityReference = (IsNullSqlConstantExpression(left) ? rightEntityReference : leftEntityReference)!;
var entityType1 = nonNullEntityReference.EntityType;
var primaryKeyProperties1 = entityType1.FindPrimaryKey()?.Properties;
if (primaryKeyProperties1 == null)
var nullComparedEntityType = nonNullEntityReference.EntityType;
var nullComparedEntityTypePrimaryKeyProperties = nullComparedEntityType.FindPrimaryKey()?.Properties;
if (nullComparedEntityTypePrimaryKeyProperties == null)
{
throw new InvalidOperationException(
CoreStrings.EntityEqualityOnKeylessEntityNotSupported(
@@ -1401,17 +1401,17 @@ private bool TryRewriteEntityEquality(
: equalsMethod
? "!" + nameof(object.Equals)
: "!=",
entityType1.DisplayName()));
nullComparedEntityType.DisplayName()));
}

if (entityType1.GetRootType() == entityType1
&& entityType1.GetMappingStrategy() != RelationalAnnotationNames.TpcMappingStrategy)
if (nullComparedEntityType.GetRootType() == nullComparedEntityType
&& nullComparedEntityType.GetMappingStrategy() != RelationalAnnotationNames.TpcMappingStrategy)
{
var table = entityType1.GetViewOrTableMappings().SingleOrDefault()?.Table
?? entityType1.GetDefaultMappings().Single().Table;
if (table.IsOptional(entityType1))
var table = nullComparedEntityType.GetViewOrTableMappings().SingleOrDefault()?.Table
?? nullComparedEntityType.GetDefaultMappings().Single().Table;
if (table.IsOptional(nullComparedEntityType))
{
var condition = entityType1.GetNonPrincipalSharedNonPkProperties(table)
var condition = nullComparedEntityType.GetNonPrincipalSharedNonPkProperties(table)
.Where(e => !e.IsNullable)
.Select(
p =>
@@ -1433,7 +1433,7 @@ private bool TryRewriteEntityEquality(
}

result = Visit(
primaryKeyProperties1.Select(
nullComparedEntityTypePrimaryKeyProperties.Select(
p =>
{
var comparison = Expression.Call(