Skip to content

Commit

Permalink
Add quirk mode for #23180
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriySvyryd committed Nov 4, 2020
1 parent 9f04e8b commit 35e1f54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,8 @@ public virtual void AcceptChanges()
{
if (!_storeGeneratedValues.IsEmpty)
{
var useOldBehavior = AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue23180", out var isEnabled)
&& isEnabled;
foreach (var property in EntityType.GetProperties())
{
var storeGeneratedIndex = property.GetStoreGeneratedIndex();
Expand All @@ -1273,7 +1275,8 @@ public virtual void AcceptChanges()
{
var equals = ValuesEqualFunc(property);
var defaultValue = property.ClrType.GetDefaultValue();
if (!equals(value, defaultValue))
if (!equals(value, defaultValue)
&& !useOldBehavior)
{
this[property] = value;
}
Expand Down

0 comments on commit 35e1f54

Please sign in to comment.