Skip to content

Commit e7ef95a

Browse files
committed
Fixup navigations to/from join entity when new many-to-many relationship is created
Fixes #26779 Also cleanup of delay-fixup/suspended detection logic, and tests for #26074.
1 parent 57d1ec9 commit e7ef95a

File tree

11 files changed

+1612
-141
lines changed

11 files changed

+1612
-141
lines changed

src/EFCore/ChangeTracking/Internal/ChangeDetector.cs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public class ChangeDetector : IChangeDetector
1717
{
1818
private readonly IDiagnosticsLogger<DbLoggerCategory.ChangeTracking> _logger;
1919
private readonly ILoggingOptions _loggingOptions;
20-
private bool _suspended;
2120

2221
/// <summary>
2322
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -33,24 +32,6 @@ public ChangeDetector(
3332
_loggingOptions = loggingOptions;
3433
}
3534

36-
/// <summary>
37-
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
38-
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
39-
/// any release. You should only use it directly in your code with extreme caution and knowing that
40-
/// doing so can result in application failures when updating to a new Entity Framework Core release.
41-
/// </summary>
42-
public virtual void Suspend()
43-
=> _suspended = true;
44-
45-
/// <summary>
46-
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
47-
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
48-
/// any release. You should only use it directly in your code with extreme caution and knowing that
49-
/// doing so can result in application failures when updating to a new Entity Framework Core release.
50-
/// </summary>
51-
public virtual void Resume()
52-
=> _suspended = false;
53-
5435
/// <summary>
5536
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
5637
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
@@ -59,8 +40,7 @@ public virtual void Resume()
5940
/// </summary>
6041
public virtual void PropertyChanged(InternalEntityEntry entry, IPropertyBase propertyBase, bool setModified)
6142
{
62-
if (_suspended
63-
|| entry.EntityState == EntityState.Detached
43+
if (entry.EntityState == EntityState.Detached
6444
|| propertyBase is IServiceProperty)
6545
{
6646
return;
@@ -103,8 +83,7 @@ private static void ThrowIfKeyChanged(InternalEntityEntry entry, IProperty prope
10383
/// </summary>
10484
public virtual void PropertyChanging(InternalEntityEntry entry, IPropertyBase propertyBase)
10585
{
106-
if (_suspended
107-
|| entry.EntityState == EntityState.Detached
86+
if (entry.EntityState == EntityState.Detached
10887
|| propertyBase is IServiceProperty)
10988
{
11089
return;

src/EFCore/ChangeTracking/Internal/IChangeDetector.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,4 @@ public interface IChangeDetector
4848
/// doing so can result in application failures when updating to a new Entity Framework Core release.
4949
/// </summary>
5050
void DetectChanges(InternalEntityEntry entry);
51-
52-
/// <summary>
53-
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
54-
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
55-
/// any release. You should only use it directly in your code with extreme caution and knowing that
56-
/// doing so can result in application failures when updating to a new Entity Framework Core release.
57-
/// </summary>
58-
void Suspend();
59-
60-
/// <summary>
61-
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
62-
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
63-
/// any release. You should only use it directly in your code with extreme caution and knowing that
64-
/// doing so can result in application failures when updating to a new Entity Framework Core release.
65-
/// </summary>
66-
void Resume();
6751
}

src/EFCore/ChangeTracking/Internal/INavigationFixer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ public interface INavigationFixer
2323
/// any release. You should only use it directly in your code with extreme caution and knowing that
2424
/// doing so can result in application failures when updating to a new Entity Framework Core release.
2525
/// </summary>
26-
void BeginAttachGraph();
26+
bool BeginDelayedFixup();
2727

2828
/// <summary>
2929
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
3030
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
3131
/// any release. You should only use it directly in your code with extreme caution and knowing that
3232
/// doing so can result in application failures when updating to a new Entity Framework Core release.
3333
/// </summary>
34-
void CompleteAttachGraph();
34+
void CompleteDelayedFixup();
3535

3636
/// <summary>
3737
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
3838
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
3939
/// any release. You should only use it directly in your code with extreme caution and knowing that
4040
/// doing so can result in application failures when updating to a new Entity Framework Core release.
4141
/// </summary>
42-
void AbortAttachGraph();
42+
void AbortDelayedFixup();
4343

4444
/// <summary>
4545
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to

0 commit comments

Comments
 (0)