Interface IRelation

Base interface for relations.

Namespace: StylelabsStylelabs.MSdkStylelabs.M.Sdk.ContractsBase
Assembly: Stylelabs.M.Sdk.dll
Syntax
RequestResponse

public interface IRelation : IMember, IDirtyTracking

Properties

Properties

Gets the properties of the linked entity.

Declaration
RequestResponse

IDictionary<long, IDictionary<string, JToken>> Properties { get; }
Property Value
TypeDescription
IDictionary<, >longIDictionary<, >stringJToken

Role

Gets the role of this instance in the relation.

Declaration
RequestResponse

RelationRole Role { get; }
Property Value
TypeDescription
RelationRole

Methods

Clear()

Clears the value(s) of the relation.

Declaration
RequestResponse

void Clear()

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
RequestResponse

IList<long> GetIds()
Returns
TypeDescription
IList<>long

A list of ids (never null).

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
RequestResponse

Task SetIdentifiersAsync(IEnumerable<string> identifiers)
Parameters
TypeNameDescription
IEnumerable<>stringidentifiers

Identifiers.

Returns
TypeDescription
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
RequestResponse

void SetIds(IEnumerable<long> ids)
Parameters
TypeNameDescription
IEnumerable<>longids

Ids.

Do you have some feedback for us?

If you have suggestions for improving this article,