Class Relation
Abstract base class for relations describing catalog structure.
Inherited Members
Namespace: EPiServer.Commerce.Catalog.Linking
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0Syntax
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 |
---|---|
CatalogContentType[] |
AllowedParentTypes
Gets the types allowed for Parent.
Declaration
protected abstract CatalogContentType[] AllowedParentTypes { get; }
Property Value
Type | Description |
---|---|
CatalogContentType[] |
Child
The child catalog content in the parent-child relation.
Declaration
public ContentReference Child { get; set; }
Property Value
Type | Description |
---|---|
EPiServer.Core.ContentReference | The EPiServer.Core.ContentReference of the catalog content (CatalogContentBase) that is the child in the relation. |
IsReadOnly
Indicates whether the current object instance is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Parent
The parent catalog content in the parent-child relation.
Declaration
public ContentReference Parent { get; set; }
Property Value
Type | Description |
---|---|
EPiServer.Core.ContentReference | The EPiServer.Core.ContentReference of the catalog content (CatalogContentBase) that is the parent in the relation. |
SortOrder
Gets the sort order.
Declaration
public int SortOrder { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The sort order used when sorting all child objects of the same type with the same parent. |
SourceAccessor
Declaration
[Obsolete("This property is no longer used, use GetParents/GetChildren instead. Will remain at least until August 2019.")]
protected abstract ContentReference SourceAccessor { get; set; }
Property Value
Type | Description |
---|---|
EPiServer.Core.ContentReference |
TargetAccessor
Declaration
[Obsolete("This property is no longer used, use GetParents/GetChildren instead. Will remain at least until August 2019.")]
protected abstract ContentReference TargetAccessor { get; set; }
Property Value
Type | Description |
---|---|
EPiServer.Core.ContentReference |
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.NotSupportedException. I.e. the semantics is "deep read-only".
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 EPiServer.Data.Validator.ValidateNotReadOnly(EPiServer.Data.Entity.IReadOnly) which throws an exception if the item is in read-only mode. Subtypes should call this before accepting any modification to the object.
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 |
---|---|---|
ReferenceConverter | referenceConverter | The reference converter. |
EPiServer.Core.ContentReference | contentLink | The content link. |
System.String | propertyName | Name of the property. |
CatalogContentType[] | allowedTypes | The allowed types. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown if the reference is not of any of the allowed types. |