November Happy Hour will be moved to Thursday December 5th.

Interface IRelationRepository

Handles CRUD operations for catalog structure objects (relations), including linking entries to additional categories, categories to other categories (using NodeRelation), variations to products (using ProductVariation) and setting up the items included in bundles and packages (using BundleEntry and PackageEntry).

Namespace: EPiServer.Commerce.Catalog.Linking
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0
Syntax
public interface IRelationRepository

Methods

GetChildren<T>(ContentReference)

Gets the children linked to a specific content.

Declaration
IEnumerable<T> GetChildren<T>(ContentReference parentLink)
    where T : Relation
Parameters
Type Name Description
EPiServer.Core.ContentReference parentLink

EPiServer.Core.ContentReference representing the content to get child relations for.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

The linked content represented as instances of Relation, or matching ones if a more specific type is specified by T.

Type Parameters
Name Description
T

The type of relation to filter by.

GetParents<T>(ContentReference)

Gets the parents which a specific content is linked to.

Declaration
IEnumerable<T> GetParents<T>(ContentReference childLink)
    where T : Relation
Parameters
Type Name Description
EPiServer.Core.ContentReference childLink

EPiServer.Core.ContentReference representing the content to get parent relations for.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

The linked content represented as instances of Relation, or matching ones if a more specific type is specified by T.

Type Parameters
Name Description
T

The type of relation to filter by.

RemoveRelations(IEnumerable<Relation>)

Removes the specified relations.

Declaration
void RemoveRelations(IEnumerable<Relation> relations)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Relation> relations

The relations to remove.

Remarks

Any relations contained in relations that don't match an existing relation will be ignored.

SetNodeParent(ContentReference, ContentReference)

Changes the parent of a catalog node to a different catalog node or a catalog.

Declaration
void SetNodeParent(ContentReference contentLink, ContentReference newParentLink)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The link to the node to change the parent of.

EPiServer.Core.ContentReference newParentLink

The link to the new parent.

UpdateRelations(IEnumerable<Relation>)

Updates matching relations and creates new relations when there is no existing relation to match.

Declaration
void UpdateRelations(IEnumerable<Relation> relations)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Relation> relations

The relations to update or create.

Extension Methods