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

Support for Self-Referencing ManyToMany Relationships #790

Closed
askvortsov1 opened this issue Jul 9, 2020 · 3 comments · Fixed by #875
Closed

Support for Self-Referencing ManyToMany Relationships #790

askvortsov1 opened this issue Jul 9, 2020 · 3 comments · Fixed by #875

Comments

@askvortsov1
Copy link

Description

  • When trying to use HasManyThrough on a self-referencing ManyToMany relationship, an error is thrown. This is because SingleOrDefault is used to find the left and right joining properties:
    hasManyThroughAttribute.LeftProperty = throughProperties.SingleOrDefault(x => x.PropertyType == entityType)
    . A special case should be added if the property annotated by HasManyThrough is an IEnumerable of the same type as the current class.

Environment

  • JsonApiDotNetCore Version: v4.0.0-alpha5
  • Other Relevant Package Versions: Asp Net Core 3.1
@bart-degreed
Copy link
Contributor

I'm not sure I understand how this would work. Can you post your resource class and related join type?

@maurei
Copy link
Member

maurei commented Sep 4, 2020

Closing due to inactivity. Feel free to reply with new information and we'll reconsider.

@bart-degreed
Copy link
Contributor

@askvortsov1 We have a fix for this in c0ed9a9 (part of #874).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants