Class Relation
Abstract base class for relations describing catalog structure.
Inherited Members
Namespace: EPiServer.Commerce.Catalog.Linking
Assembly: EPiServer.Business.Commerce.dll
Version: 11.8.3Syntax
public abstract class Relation : IReadOnly<Relation>, IReadOnly
Constructors
Relation()
Declaration
protected Relation()
Properties
AllowedChildTypes
Gets the types allowed for Child.
Declaration
protected abstract CatalogContentType[] AllowedChildTypes { get; }
Property Value
Type | Description |
---|---|
Catalog |
AllowedParentTypes
Gets the types allowed for Parent.
Declaration
protected abstract CatalogContentType[] AllowedParentTypes { get; }
Property Value
Type | Description |
---|---|
Catalog |
Child
The child catalog content in the parent-child relation.
Declaration
public ContentReference Child { get; set; }
Property Value
Type | Description |
---|---|
EPi |
The EPi |
IsReadOnly
Indicates whether the current object instance is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System. |
Parent
The parent catalog content in the parent-child relation.
Declaration
public ContentReference Parent { get; set; }
Property Value
Type | Description |
---|---|
EPi |
The EPi |
SortOrder
Gets the sort order.
Declaration
public int SortOrder { get; set; }
Property Value
Type | Description |
---|---|
System. |
The sort order used when sorting all child objects of the same type with the same parent. |
Source
Gets or sets the source of the relation (the item that has the relation).
For Node
Declaration
[Obsolete("This property is no longer used, use Parent/Child instead. Will remain at least until May 2018.")]
public ContentReference Source { get; set; }
Property Value
Type | Description |
---|---|
EPi |
Remarks
Using Child and Source is recommended over using
Target and Bundle
SourceAccessor
Backing implementation for Source
Declaration
protected abstract ContentReference SourceAccessor { get; set; }
Property Value
Type | Description |
---|---|
EPi |
Target
Gets or sets the target of the relation (the item we're relating to).
For Node
Declaration
[Obsolete("This property is no longer used, use Parent/Child instead. Will remain at least until May 2018.")]
public ContentReference Target { get; set; }
Property Value
Type | Description |
---|---|
EPi |
Remarks
Using Parent and Child is recommended over using Source and Target as the parent-child analogy of relations is less abstract and in most cases easier to understand than source-target.
TargetAccessor
Backing implementation for Target
Declaration
protected abstract ContentReference TargetAccessor { get; set; }
Property Value
Type | Description |
---|---|
EPi |
Methods
CreateWritableClone()
Creates a writable copy of the current object.
Declaration
public Relation CreateWritableClone()
Returns
Type | Description |
---|---|
Relation | A writable copy of the current object. |
Remarks
The cloning is a deep-copy.
CreateWritableClone<T>()
Creates a writable copy of the current object.
Declaration
public T CreateWritableClone<T>()
where T : Relation
Returns
Type | Description |
---|---|
T | A writable copy of the current object. |
Type Parameters
Name | Description |
---|---|
T | The type to clone to. |
Remarks
The cloning is a deep-copy.
CreateWritableCloneImplementation()
Implements the deep clone. Override to add any operations not handled by the base implementation (which includes a shallow copy by MemberwiseClone).
Declaration
protected virtual Relation CreateWritableCloneImplementation()
Returns
Type | Description |
---|---|
Relation | A cloned instance in read-write mode. |
MakeReadOnly()
Changes the object instance into a read-only object.
Declaration
public void MakeReadOnly()
Remarks
After calling this method, any attempt to change the object instance or any contained object
will generate a System.
Note! After setting an object to read-only it is not possible to revert back to read-write mode. You will have to call the CreateWritableClone method to get a copy that can be modified.
ThrowIfReadOnly()
Calls EPi
Declaration
protected void ThrowIfReadOnly()
ValidateType(ReferenceConverter, ContentReference, String, CatalogContentType[])
Validates that a content reference points to a catalog content of one of the specified types.
Declaration
protected void ValidateType(ReferenceConverter referenceConverter, ContentReference contentLink, string propertyName, params CatalogContentType[] allowedTypes)
Parameters
Type | Name | Description |
---|---|---|
Reference |
referenceConverter | The reference converter. |
EPi |
contentLink | The content link. |
System. |
propertyName | Name of the property. |
Catalog |
allowedTypes | The allowed types. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown if the reference is not of any of the allowed types. |