Skip to content

Commit

Permalink
Remove quirks
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Mar 11, 2022
1 parent a061538 commit 1ddc0d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1445,9 +1445,6 @@ public void AcceptChanges()
}
}

private readonly static bool _useOldBehavior27455 =
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue27455", out var enabled27455) && enabled27455;

/// <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 Expand Up @@ -1475,7 +1472,7 @@ public InternalEntityEntry PrepareToSave()
if (property.IsKey()
&& property.IsForeignKey()
&& _stateData.IsPropertyFlagged(property.GetIndex(), PropertyFlag.Unknown)
&& (_useOldBehavior27455 || !IsStoreGenerated(property)))
&& !IsStoreGenerated(property))
{
if (property.GetContainingForeignKeys().Any(fk => fk.IsOwnership))
{
Expand Down
6 changes: 1 addition & 5 deletions src/EFCore/Metadata/Internal/PropertyExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ public static bool ForUpdate(this ValueGenerated valueGenerated)
return null;
}

private readonly static bool _useOldBehavior27455 =
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue27455", out var enabled27455) && enabled27455;

/// <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 All @@ -84,8 +81,7 @@ public static bool RequiresValueGenerator(this IReadOnlyProperty property)
&& property.IsKey()
&& (!property.IsForeignKey()
|| property.IsForeignKeyToSelf()
|| (!_useOldBehavior27455
&& property.GetContainingForeignKeys().All(fk => fk.Properties.Any(p => p != property && p.IsNullable)))))
|| (property.GetContainingForeignKeys().All(fk => fk.Properties.Any(p => p != property && p.IsNullable)))))
|| property.GetValueGeneratorFactory() != null;

/// <summary>
Expand Down

0 comments on commit 1ddc0d9

Please sign in to comment.