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
-27
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,6 @@ public class TodoItem : Identifiable
20
20
21
21
The left side of this relationship is of type `TodoItem` (public name: "todoItems") and the right side is of type `Person` (public name: "persons").
22
22
23
-
24
23
## HasMany
25
24
26
25
This exposes a to-many relationship.
@@ -35,32 +34,6 @@ public class Person : Identifiable
35
34
36
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").
37
36
38
-
39
-
## HasManyThrough
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, we have decided to fill this gap by allowing applications to declare a relationship as `HasManyThrough`.
43
-
JsonApiDotNetCore will expose this relationship to the client the same way as any other `HasMany` relationship.
44
-
However, under the covers it will 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
/// Gets all attributes for <typeparamref name="TResource" /> that are targeted by the selector. If no selector is provided, all exposed fields are
30
+
/// Gets all attributes for <typeparamref name="TResource" /> that are targeted by the selector. If no selector is provided, all exposed attributes are
31
31
/// returned.
32
32
/// </summary>
33
33
/// <typeparam name="TResource">
34
-
/// The resource for which to retrieve attributes.
34
+
/// The resource type for which to retrieve attributes.
35
35
/// </typeparam>
36
36
/// <param name="selector">
37
-
/// Should be of the form: (TResource e) => new { e.Attribute1, e.Attribute2 }
37
+
/// Should be of the form: (TResource r) => new { r.Attribute1, r.Attribute2 }
/// Gets all relationships for <typeparamref name="TResource" /> that are targeted by the selector. If no selector is provided, all exposed fields are
44
-
/// returned.
43
+
/// Gets all relationships for <typeparamref name="TResource" /> that are targeted by the selector. If no selector is provided, all exposed relationships
44
+
/// are returned.
45
45
/// </summary>
46
46
/// <typeparam name="TResource">
47
-
/// The resource for which to retrieve relationships.
47
+
/// The resource type for which to retrieve relationships.
48
48
/// </typeparam>
49
49
/// <param name="selector">
50
-
/// Should be of the form: (TResource e) => new { e.Relationship1, e.Relationship2 }
50
+
/// Should be of the form: (TResource r) => new { r.Relationship1, r.Relationship2 }
0 commit comments