Class LinksRepository

Default implementation of the ILinksRepository interface.

Inheritance
System.Object
LinksRepository
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Commerce.Catalog.Linking
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0
Syntax
public class LinksRepository : ILinksRepository, IRelationRepository, IAssociationRepository

Constructors

LinksRepository(ICatalogSystem, ReferenceConverter, CatalogContentLoader)

Initializes a new instance of the LinksRepository class.

Declaration
public LinksRepository(ICatalogSystem catalogContext, ReferenceConverter referenceConverter, CatalogContentLoader contentLoader)
Parameters
Type Name Description
ICatalogSystem catalogContext

The catalog context.

ReferenceConverter referenceConverter

The reference converter.

CatalogContentLoader contentLoader

The catalog content loader.

Methods

GetAssociations(ContentReference)

Gets the associations for the catalog content specified by the content link.

Declaration
public IEnumerable<Association> GetAssociations(ContentReference contentLink)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The content link.

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

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
public 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
public 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
public 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
public 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.

RemoveAssociations(IEnumerable<Association>)

Removes the associations.

Declaration
public void RemoveAssociations(IEnumerable<Association> associations)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Association> associations

The associations to remove.

RemoveRelations(IEnumerable<Relation>)

Removes the relations.

Declaration
public 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
public 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.

UpdateAssociations(IEnumerable<Association>)

Updates matching associations and adds new associations for an entry.

Declaration
public void UpdateAssociations(IEnumerable<Association> associations)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Association> associations

The associations.

UpdateRelations(IEnumerable<Relation>)

Updates matching relations or adds new relations for an entry or node.

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

The relations.

Implements

Extension Methods