Interface IRelationRepository

Describes a service for handling relations of catalog content.

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

Methods

GetRelationsBySource(ContentReference)

Gets the relations with Source matching the specified content link. Depending on what content type the specified content link points to this will return instances of one or more of the following relation types: ProductVariation where Target is a product variation. BundleEntry or PackageEntry where Target is a bundle/package entry. NodeRelation where Target is a (parent) category.

Declaration
IEnumerable<Relation> GetRelationsBySource(ContentReference contentLink)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The source content link to match.

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

The matching relations.

GetRelationsBySource<T>(ContentReference)

Gets the relations with Source matching the specified content link. Depending on what content type the specified content link points to this will return instances of one or more of the following relation types: ProductVariation where Target is a product variation. BundleEntry or PackageEntry where Target is a bundle/package entry. NodeRelation where Target is a (parent) category.

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

The source content link to match.

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

The matching relations.

Type Parameters
Name Description
T

The type of relation to filter by, e.g. return only ProductVariation instances.

GetRelationsByTarget(ContentReference)

Gets the relations with Target matching the speified content link. Depending on what content type the specified content link points to this will return instances of one or more of the following relation types: ProductVariation where Source is the parent product of the variation. BundleEntry or PackageEntry where Source is a bundle/package containing the entry. NodeRelation where Source is an entry or (sub) category in the specified category. However, that information is probably simpler to retrieve by using EPiServer.IContentLoaders GetChildren method.

Declaration
IEnumerable<Relation> GetRelationsByTarget(ContentReference contentLink)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The target content link to match.

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

GetRelationsByTarget<T>(ContentReference)

Gets the relations with Target matching the speified content link. Depending on what content type the specified content link points to this will return instances of one or more of the following relation types: ProductVariation where Source is the parent product of the variation. BundleEntry or PackageEntry where Source is a bundle/package containing the entry. NodeRelation where Source is an entry or (sub) category in the specified category. However, that information is probably simpler to retrieve by using EPiServer.IContentLoaders GetChildren method.

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

The target content link to match.

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

The type of relation to filter by, e.g. return only ProductVariation instances.

RemoveRelations(IEnumerable<Relation>)

Removes the relations.

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

The relations to remove.

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 or adds new relations for an entry or node.

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

The relations.

Extension Methods