Class RelationBase
Base class for relations.
Inherited Members
Namespace: StylelabsStylelabs.MSdkStylelabs.M.Sdk.ModelsBase
Assembly: Stylelabs.M.Sdk.dll
Syntax
Constructors
RelationBase(IMClient, string, IDictionary<long, IDictionary<string, JToken>>)
Initializes a new instance of the RelationBase class.
Declaration
Parameters
RelationBase(string, IDictionary<long, IDictionary<string, JToken>>)
Initializes a new instance of the RelationBase class.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
The name of the relation. |
| IDictionary<, >longIDictionary<, >stringJToken | properties |
The properties of the linked entity. |
Properties
DefinitionType
Gets the definition type.
Declaration
Property Value
| Type | Description |
|---|---|
| MemberDefinitionType |
Overrides
Properties
Gets the properties of the linked entity.
Declaration
Property Value
| Type | Description |
|---|---|
| IDictionary<, >longIDictionary<, >stringJToken |
Role
Gets the role of this instance in the relation.
Declaration
Property Value
| Type | Description |
|---|---|
| RelationRole |
Methods
Clear()
Clears the value(s) of the relation.
Declaration
GetIds()
This utility method allows getting the value of any type of relation.
In case of an IToManyRelation the result will contain all ids on the relation.
In case of an IToOneRelation the list can contain 1 id (maximum) if an id was set on the relation. If no id was set on the relation, an empty list is returned.
Declaration
Returns
| Type | Description |
|---|---|
| IList<>long |
A list of ids (never null). |
GetTypeName()
Gets the name of the relation type.
Declaration
Returns
| Type | Description |
|---|---|
| string |
The name of the type. |
SetIdentifiersAsync(IEnumerable<string>)
Sets the ids on the relations values based on the given identifiers.
In case of an IToManyRelation, the list of ids will be set on the relation.
In case of an IToOneRelation, identifiers can have at most one value.
If the list is empty then the value will be set to null.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<>string | identifiers |
Identifiers. |
Returns
| Type | Description |
|---|---|
| Task |
A representing the asynchronous operation. |
SetIds(IEnumerable<long>)
Sets the ids on the relations values. The values should be strictly positive.
In case of an IToManyRelation, the list of ids will be set on the relation.
In case of an IToOneRelation, ids can have at most one value.
If the list is empty then the value will be set to null.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<>long | ids |
Ids. |