Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -2210,8 +2210,8 @@ protected virtual void DiffData(
continue;
}

var sourceValue = sourceColumnModification.OriginalValue;
var targetValue = targetColumnModification.Value;
var sourceValue = NormalizeStringValue(sourceColumnModification.OriginalValue);
var targetValue = NormalizeStringValue(targetColumnModification.Value);
var comparer = targetColumn.ProviderValueComparer;
if (sourceColumn.ProviderClrType == targetColumn.ProviderClrType
&& comparer.Equals(sourceValue, targetValue))
Comment thread
TomasMoralesBarr marked this conversation as resolved.
Outdated
Comment thread
TomasMoralesBarr marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -2519,6 +2519,9 @@ private static bool MultilineEquals(string? sourceString, string? targetString,
&& targetString is not null
&& string.Equals(sourceString.ReplaceLineEndings(), targetString.ReplaceLineEndings(), comparisonType));

private static object? NormalizeStringValue(object? value)
=> value is string s ? s.Normalize() : value;
Comment thread
TomasMoralesBarr marked this conversation as resolved.
Outdated

/// <summary>
/// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8369,6 +8369,35 @@ public void Change_TPT_to_TPC_with_FKs_and_seed_data()
Assert.Equal(ReferentialAction.Cascade, operation.OnDelete);
}));

[ConditionalFact]
Comment thread
TomasMoralesBarr marked this conversation as resolved.
Outdated
public void Seed_data_with_NFD_vs_NFC_unicode_string_is_considered_unchanged()
{
var nfcString = "Caf\u00E9";
var nfdString = "Cafe\u0301";

Assert.NotEqual(nfcString, nfdString);
Assert.Equal(nfcString, nfdString.Normalize());
Comment thread
TomasMoralesBarr marked this conversation as resolved.
Outdated
Comment thread
TomasMoralesBarr marked this conversation as resolved.
Outdated

Execute(
source => source.Entity(
"BusinessType",
x =>
{
x.Property<int>("BusinessTypeId");
x.Property<string>("WebDescription");
x.HasData(new { BusinessTypeId = 28, WebDescription = nfcString });
}),
target => target.Entity(
"BusinessType",
x =>
{
x.Property<int>("BusinessTypeId");
x.Property<string>("WebDescription");
x.HasData(new { BusinessTypeId = 28, WebDescription = nfdString });
}),
operations => Assert.Empty(operations));
Comment thread
TomasMoralesBarr marked this conversation as resolved.
Outdated
Comment thread
TomasMoralesBarr marked this conversation as resolved.
Outdated
}
Comment thread
TomasMoralesBarr marked this conversation as resolved.

[ConditionalFact]
public void Change_TPT_to_TPC_with_excluded_base()
=> Execute(
Expand Down
Loading