You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage/resources/relationships.md
+26
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,32 @@ public class Person : Identifiable
34
34
35
35
The left side of this relationship is of type `Person` (public name: "persons") and the right side is of type `TodoItem` (public name: "todoItems").
36
36
37
+
## HasManyThrough
38
+
39
+
_removed since v5.0_
40
+
41
+
Earlier versions of Entity Framework Core (up to v5) [did not support](https://github.com/aspnet/EntityFrameworkCore/issues/1368) many-to-many relationships without a join entity.
42
+
For this reason, earlier versions of JsonApiDotNetCore filled this gap by allowing applications to declare a relationship as `HasManyThrough`,
43
+
which would expose the relationship to the client the same way as any other `HasMany` relationship.
44
+
However, under the covers it would use the join type and Entity Framework Core's APIs to get and set the relationship.
45
+
46
+
```c#
47
+
publicclassArticle : Identifiable
48
+
{
49
+
// tells Entity Framework Core to ignore this property
50
+
[NotMapped]
51
+
52
+
// tells JsonApiDotNetCore to use the join table below
53
+
[HasManyThrough(nameof(ArticleTags))]
54
+
publicICollection<Tag> Tags { get; set; }
55
+
56
+
// this is the Entity Framework Core navigation to the join table
0 commit comments