Skip to content

Commit

Permalink
Add quirk mode for #23792
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriySvyryd committed Jan 14, 2021
1 parent 84506bb commit f28edd3
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,7 @@ protected virtual Dictionary<IEntityType, List<ITable>> DiffData(
principalSourceTable = mainSourceEntityType.GetTableMappings().First().Table;
}

var useOldBehavior = AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue23792", out var enabled) && enabled;
foreach (var sourceSeed in sourceEntityType.GetSeedData())
{
var sourceEntry = GetEntry(sourceSeed, sourceEntityType, _sourceUpdateAdapter);
Expand Down Expand Up @@ -1985,7 +1986,7 @@ protected virtual Dictionary<IEntityType, List<ITable>> DiffData(
{
if (targetProperty.GetAfterSaveBehavior() != PropertySaveBehavior.Save
&& (targetProperty.ValueGenerated & ValueGenerated.OnUpdate) == 0
&& (targetKeyMap.Count == 1 || entry.EntityType.Name == sourceEntityType.Name))
&& (useOldBehavior || targetKeyMap.Count == 1 || entry.EntityType.Name == sourceEntityType.Name))
{
entryMapping.RecreateRow = true;
break;
Expand Down

0 comments on commit f28edd3

Please sign in to comment.