Skip to content

Adding model for Many to Many scenarios #20491

New issue

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

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

Already on GitHub? # to your account

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.

@maumar maumar requested review from smitpatel and AndriySvyryd April 1, 2020 22:06
.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 force-pushed the many_to_many_model branch from 6d36cbd to 2aaaa35 Compare April 2, 2020 00:04
@maumar maumar merged commit 2aaaa35 into master Apr 2, 2020
@maumar maumar deleted the many_to_many_model branch April 2, 2020 01:28
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants