Skip to content

Commit 23dbad0

Browse files
committed
update documentation
1 parent 8a69eff commit 23dbad0

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

src/JsonApiDotNetCore/Models/HasManyThroughAttribute.cs

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,36 @@
44
namespace JsonApiDotNetCore.Models
55
{
66
/// <summary>
7-
///
7+
/// Create a HasMany relationship through a many-to-many join relationship.
88
/// </summary>
99
///
1010
/// <example>
11-
///
11+
/// In the following example, we expose a relationship named "tags"
12+
/// through the navigation property `ArticleTags`.
13+
/// The `Tags` property is decorated as `NotMapped` so that EF does not try
14+
/// to map this to a database relationship.
15+
/// <code>
16+
/// [NotMapped]
17+
/// [HasManyThrough("tags", nameof(ArticleTags))]
18+
/// public List&lt;Tag&gt; Tags { get; set; }
19+
/// public List&lt;ArticleTag&gt; ArticleTags { get; set; }
20+
/// </code>
1221
/// </example>
1322
public class HasManyThroughAttribute : HasManyAttribute
1423
{
1524
/// <summary>
16-
///
25+
/// Create a HasMany relationship through a many-to-many join relationship.
26+
/// The public name exposed through the API will be based on the configured convention.
1727
/// </summary>
1828
///
19-
/// <param name="publicName">The relationship name as exposed by the API</param>
2029
/// <param name="internalThroughName">The name of the navigation property that will be used to get the HasMany relationship</param>
2130
/// <param name="documentLinks">Which links are available. Defaults to <see cref="Link.All"/></param>
2231
/// <param name="canInclude">Whether or not this relationship can be included using the <c>?include=public-name</c> query string</param>
2332
///
2433
/// <example>
25-
///
34+
/// <code>
35+
/// [HasManyThrough(nameof(ArticleTags), documentLinks: Link.All, canInclude: true)]
36+
/// </code>
2637
/// </example>
2738
public HasManyThroughAttribute(string internalThroughName, Link documentLinks = Link.All, bool canInclude = true)
2839
: base(null, documentLinks, canInclude)
@@ -31,7 +42,7 @@ public HasManyThroughAttribute(string internalThroughName, Link documentLinks =
3142
}
3243

3344
/// <summary>
34-
///
45+
/// Create a HasMany relationship through a many-to-many join relationship.
3546
/// </summary>
3647
///
3748
/// <param name="publicName">The relationship name as exposed by the API</param>
@@ -40,19 +51,36 @@ public HasManyThroughAttribute(string internalThroughName, Link documentLinks =
4051
/// <param name="canInclude">Whether or not this relationship can be included using the <c>?include=public-name</c> query string</param>
4152
///
4253
/// <example>
43-
///
54+
/// <code>
55+
/// [HasManyThrough("tags", nameof(ArticleTags), documentLinks: Link.All, canInclude: true)]
56+
/// </code>
4457
/// </example>
4558
public HasManyThroughAttribute(string publicName, string internalThroughName, Link documentLinks = Link.All, bool canInclude = true)
4659
: base(publicName, documentLinks, canInclude)
4760
{
4861
InternalThroughName = internalThroughName;
4962
}
5063

64+
/// <summary>
65+
/// The name of the join property on the parent resource.
66+
/// </summary>
67+
/// <example>
68+
/// In the `[HasManyThrough("tags", nameof(ArticleTags))]` example
69+
/// this would be "ArticleTags".
70+
/// </example>
5171
public string InternalThroughName { get; private set; }
72+
73+
/// <summary>
74+
/// The join type.
75+
/// </summary>
76+
/// <example>
77+
/// In the `[HasManyThrough("tags", nameof(ArticleTags))]` example
78+
/// this would be `ArticleTag`.
79+
/// </example>
5280
public Type ThroughType { get; internal set; }
5381

5482
/// <summary>
55-
/// The navigation property back to the parent resource.
83+
/// The navigation property back to the parent resource from the join type.
5684
/// </summary>
5785
///
5886
/// <example>
@@ -67,7 +95,7 @@ public HasManyThroughAttribute(string publicName, string internalThroughName, Li
6795
public PropertyInfo LeftProperty { get; internal set; }
6896

6997
/// <summary>
70-
/// The navigation property to the related resource.
98+
/// The navigation property to the related resource from the join type.
7199
/// </summary>
72100
///
73101
/// <example>

0 commit comments

Comments
 (0)