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

Adding model for Many to Many scenarios #20491

Merged
merged 1 commit into from
Apr 2, 2020
Merged

Adding model for Many to Many scenarios #20491

merged 1 commit into from
Apr 2, 2020

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Apr 1, 2020

Entities:

One, Two, Three - regular
CompositeKey - entity with composite key
Root, Branch, Leaf - inheritance

Navigations (all many to many have corresponding navigation on the other side that is not listed here):

One

  • TwoFullySpecified
  • ThreeFullySpecifiedWithPayload
  • TwoSharedEntity
  • ThreeSharedEntity
  • SelfSharedEntityWithPayload
  • BranchFullySpecified

Two

  • ThreeFullySpecified
  • SelfFullySpecified
  • CompositeSharedEntity

Three

  • CompositeFullySpecified
  • RootSharedEntity

Composite

  • RootSharedEntity
  • LeafSharedEntity

For now shared entity scenarios are not supported in metadata API so we added linking entities temporarily. Those should be removed once the support is in.

.HasMany(e => e.SelfSharedEntityLeftWithPayload)
.WithMany(e => e.SelfSharedEntityRightWithPayload)
.UsingEntity<OneSelfSharedEntityWithPayload>(
r => r.HasOne(x => x.Right).WithMany().OnDelete(DeleteBehavior.NoAction),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndriySvyryd is this how we should configure self many to many? (i.e. the OnDelete part)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if needed

@maumar maumar force-pushed the many_to_many_model branch 2 times, most recently from 2ff7693 to 6d36cbd Compare April 1, 2020 23:11
namespace Microsoft.EntityFrameworkCore.TestModels.ManyToManyModel
{
// TODO: remove and use shared entity instead
public class OneToTwoSharedEntity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's shared type, not shared entity

Entities:

One, Two, Three - regular
CompositeKey - entity with composite key
Root, Branch, Leaf - inheritance

Navigations (all many to many have corresponding navigation on the other side that is not listed here):

One
- TwoFullySpecified
- ThreeFullySpecifiedWithPayload
- TwoSharedType
- ThreeSharedType
- SelfSharedTypeWithPayload
- BranchFullySpecified

Two
- ThreeFullySpecified
- SelfFullySpecified
- CompositeSharedType

Three
- CompositeFullySpecified
- RootSharedType

Composite
- RootSharedType
- LeafSharedType

For now shared type scenarios are not supported in metadata API so we added linking entities temporarily. Those should be removed once the support is in.
@maumar maumar merged commit 2aaaa35 into master Apr 2, 2020
@maumar maumar deleted the many_to_many_model branch April 2, 2020 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants