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: 11.8.3Syntax
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 |
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 |
Type Parameters
Name | Description |
---|---|
T | The type of relation to filter by. |
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
[Obsolete("This method is no longer used, use GetParents/GetChildren instead. Will remain at least until May 2018.")]
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
[Obsolete("This method is no longer used, use GetParents/GetChildren instead. Will remain at least until May 2018.")]
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
[Obsolete("This method is no longer used, use GetParents/GetChildren instead. Will remain at least until May 2018.")]
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
[Obsolete("This method is no longer used, use GetParents/GetChildren instead. Will remain at least until May 2018.")]
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 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. |