-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark join entities as Added when either side is Added (#22669)
Fixes #22647 **Description** If the entity on either end of a many-to-many relationship is Added, then any join entity instance must be new since it references a new entity via a required relationship. This change improves the many-to-many experience by detecting this case. **Customer Impact** This is an improvement to the experience for the new many-to-many feature. Doing this now instead of in the future avoids a breaking change after 5.0. Therefore, doing this now will help customers have a seamless update to 6.0. **How found** Customer reported on RC1. **Test coverage** Added additional test coverage around this case. **Regression?** No; new feature. **Risk** Low; small change in behavior.
- Loading branch information
1 parent
3a1fd2d
commit 89f0e61
Showing
5 changed files
with
272 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
test/EFCore.Specification.Tests/TestModels/ManyToManyModel/GeneratedKeysLeft.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace Microsoft.EntityFrameworkCore.TestModels.ManyToManyModel | ||
{ | ||
public class GeneratedKeysLeft | ||
{ | ||
public virtual int Id { get; set; } | ||
public virtual string Name { get; set; } | ||
|
||
public virtual ICollection<GeneratedKeysRight> Rights { get; } = new ObservableCollection<GeneratedKeysRight>(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
test/EFCore.Specification.Tests/TestModels/ManyToManyModel/GeneratedKeysRight.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace Microsoft.EntityFrameworkCore.TestModels.ManyToManyModel | ||
{ | ||
public class GeneratedKeysRight | ||
{ | ||
public virtual int Id { get; set; } | ||
public virtual string Name { get; set; } | ||
|
||
public virtual ICollection<GeneratedKeysLeft> Lefts { get; } = new ObservableCollection<GeneratedKeysLeft>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters