Class LinksRepository
Default implementation of the ILinksRepository interface.
Inheritance
Inherited Members
Namespace: EPiServer.Commerce.Catalog.Linking
Assembly: EPiServer.Business.Commerce.dll
Version: 11.8.3Syntax
[Obsolete("The ILinksRepository interface is obsolete, please use the base IRelationRepository and IAssociationRepository interfaces directly. Will remain at least until September 2017.")]
public class LinksRepository : ILinksRepository, IRelationRepository, IAssociationRepository
Constructors
LinksRepository(IRelationRepository, IAssociationRepository)
Initializes a new instance of the LinksRepository class.
Declaration
public LinksRepository(IRelationRepository relationRepository, IAssociationRepository associationRepository)
Parameters
Type | Name | Description |
---|---|---|
IRelationRepository | relationRepository | The relation repository. |
IAssociationRepository | associationRepository | The association repository. |
LinksRepository(ICatalogSystem, ReferenceConverter, CatalogContentLoader)
Declaration
[Obsolete("Use constructor with IRelationRepository and IAssociationRepository parameters. Will remain at least until September 2017.")]
public LinksRepository(ICatalogSystem catalogContext, ReferenceConverter referenceConverter, CatalogContentLoader contentLoader)
Parameters
Type | Name | Description |
---|---|---|
ICatalogSystem | catalogContext | |
ReferenceConverter | referenceConverter | |
CatalogContentLoader | contentLoader |
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> |
GetChildren<T>(ContentReference)
Declaration
public IEnumerable<T> GetChildren<T>(ContentReference parentLink)
where T : Relation
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | parentLink |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
GetParents<T>(ContentReference)
Declaration
public IEnumerable<T> GetParents<T>(ContentReference childLink)
where T : Relation
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | childLink |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
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 specified relations.
Declaration
public 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
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 and creates new relations when there is no existing relation to match.
Declaration
public void UpdateRelations(IEnumerable<Relation> relations)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Relation> | relations | The relations to update or create. |