-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathResourceTypeRelationship.cs
More file actions
45 lines (40 loc) · 1.73 KB
/
ResourceTypeRelationship.cs
File metadata and controls
45 lines (40 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Reflection;
namespace JSONAPI.Core
{
/// <summary>
/// A ResourceTypeField representing a relationship to another resource type
/// </summary>
public abstract class ResourceTypeRelationship : ResourceTypeField
{
internal ResourceTypeRelationship(PropertyInfo property, string jsonKey, Type relatedType,
string selfLinkTemplate, string relatedResourceLinkTemplate, bool isToMany)
: base(property, jsonKey)
{
RelatedType = relatedType;
SelfLinkTemplate = selfLinkTemplate;
RelatedResourceLinkTemplate = relatedResourceLinkTemplate;
IsToMany = isToMany;
}
/// <summary>
/// Whether this relationship represents a link to a collection of resources or a single one.
/// </summary>
public bool IsToMany { get; private set; }
/// <summary>
/// The type of resource found on the other side of this relationship
/// </summary>
public Type RelatedType { get; private set; }
/// <summary>
/// The template for building URLs to access the relationship itself.
/// If the string {1} appears in the template, it will be replaced by the ID of resource this
/// relationship belongs to.
/// </summary>
public string SelfLinkTemplate { get; private set; }
/// <summary>
/// The template for building URLs to access the data making up the other side of this relationship.
/// If the string {1} appears in the template, it will be replaced by the ID of resource this
/// relationship belongs to.
/// </summary>
public string RelatedResourceLinkTemplate { get; private set; }
}
}