Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove quirks #27622

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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