Class ReferenceConverterExtensions
Extensions for ReferenceConverter.
Inheritance
Inherited Members
Namespace: Mediachase.Commerce.Catalog
Assembly: Mediachase.Commerce.dll
Version: 13.30.0Syntax
public static class ReferenceConverterExtensions
Methods
GetEntryContentLink(ReferenceConverter, Int32)
Get the EPiServer.Core.ContentReference of an entry by specified entry id.
Declaration
public static ContentReference GetEntryContentLink(this ReferenceConverter referenceConverter, int objectId)
Parameters
Type | Name | Description |
---|---|---|
ReferenceConverter | referenceConverter | The reference converter. |
System.Int32 | objectId | The id of the entry object. |
Returns
Type | Description |
---|---|
EPiServer.Core.ContentReference | The content link. |
Examples
public void ConversionEntryContentLink(EntryContentBase entryContent)
{
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
// Convert from ContentReference to catalog entry id
var entryId = referenceConverter.GetObjectId(entryContent.ContentLink);
// Convert from catalog entry id to ContentReference
var entryContentLink = referenceConverter.GetEntryContentLink(entryId);
// or with version id
var sameEntryContentLink = referenceConverter.GetEntryContentLink(entryId, 0);
}
public void ConversionNodeContentLink(NodeContent nodeContent)
{
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
// Convert from ContentReference to catalog node id
var nodeId = referenceConverter.GetObjectId(nodeContent.ContentLink);
// Convert from catalog node id to ContentReference
var nodeContentLink = referenceConverter.GetNodeContentLink(nodeId);
// or with version id
var sameNodeContentLink = referenceConverter.GetNodeContentLink(nodeId, 0);
}
GetEntryContentLink(ReferenceConverter, Int32, Int32)
Get the EPiServer.Core.ContentReference of an entry by specified entry id and version id.
Declaration
public static ContentReference GetEntryContentLink(this ReferenceConverter referenceConverter, int objectId, int versionId)
Parameters
Type | Name | Description |
---|---|---|
ReferenceConverter | referenceConverter | The reference converter. |
System.Int32 | objectId | The id of the entry object. |
System.Int32 | versionId | The version ID to set in the EPiServer.Core.ContentReference instance. |
Returns
Type | Description |
---|---|
EPiServer.Core.ContentReference | The content link. |
Examples
public void ConversionEntryContentLink(EntryContentBase entryContent)
{
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
// Convert from ContentReference to catalog entry id
var entryId = referenceConverter.GetObjectId(entryContent.ContentLink);
// Convert from catalog entry id to ContentReference
var entryContentLink = referenceConverter.GetEntryContentLink(entryId);
// or with version id
var sameEntryContentLink = referenceConverter.GetEntryContentLink(entryId, 0);
}
public void ConversionNodeContentLink(NodeContent nodeContent)
{
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
// Convert from ContentReference to catalog node id
var nodeId = referenceConverter.GetObjectId(nodeContent.ContentLink);
// Convert from catalog node id to ContentReference
var nodeContentLink = referenceConverter.GetNodeContentLink(nodeId);
// or with version id
var sameNodeContentLink = referenceConverter.GetNodeContentLink(nodeId, 0);
}
GetNodeContentLink(ReferenceConverter, Int32)
Get the EPiServer.Core.ContentReference of a node by specified node id.
Declaration
public static ContentReference GetNodeContentLink(this ReferenceConverter referenceConverter, int objectId)
Parameters
Type | Name | Description |
---|---|---|
ReferenceConverter | referenceConverter | The reference converter. |
System.Int32 | objectId | The id of the node object. |
Returns
Type | Description |
---|---|
EPiServer.Core.ContentReference | The content link. |
Examples
public void ConversionEntryContentLink(EntryContentBase entryContent)
{
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
// Convert from ContentReference to catalog entry id
var entryId = referenceConverter.GetObjectId(entryContent.ContentLink);
// Convert from catalog entry id to ContentReference
var entryContentLink = referenceConverter.GetEntryContentLink(entryId);
// or with version id
var sameEntryContentLink = referenceConverter.GetEntryContentLink(entryId, 0);
}
public void ConversionNodeContentLink(NodeContent nodeContent)
{
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
// Convert from ContentReference to catalog node id
var nodeId = referenceConverter.GetObjectId(nodeContent.ContentLink);
// Convert from catalog node id to ContentReference
var nodeContentLink = referenceConverter.GetNodeContentLink(nodeId);
// or with version id
var sameNodeContentLink = referenceConverter.GetNodeContentLink(nodeId, 0);
}
GetNodeContentLink(ReferenceConverter, Int32, Int32)
Get the EPiServer.Core.ContentReference of node by specified node id and version id.
Declaration
public static ContentReference GetNodeContentLink(this ReferenceConverter referenceConverter, int objectId, int versionId)
Parameters
Type | Name | Description |
---|---|---|
ReferenceConverter | referenceConverter | The reference converter. |
System.Int32 | objectId | The id of the node object. |
System.Int32 | versionId | The version ID to set in the EPiServer.Core.ContentReference instance. |
Returns
Type | Description |
---|---|
EPiServer.Core.ContentReference | The content link. |
Examples
public void ConversionEntryContentLink(EntryContentBase entryContent)
{
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
// Convert from ContentReference to catalog entry id
var entryId = referenceConverter.GetObjectId(entryContent.ContentLink);
// Convert from catalog entry id to ContentReference
var entryContentLink = referenceConverter.GetEntryContentLink(entryId);
// or with version id
var sameEntryContentLink = referenceConverter.GetEntryContentLink(entryId, 0);
}
public void ConversionNodeContentLink(NodeContent nodeContent)
{
var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
// Convert from ContentReference to catalog node id
var nodeId = referenceConverter.GetObjectId(nodeContent.ContentLink);
// Convert from catalog node id to ContentReference
var nodeContentLink = referenceConverter.GetNodeContentLink(nodeId);
// or with version id
var sameNodeContentLink = referenceConverter.GetNodeContentLink(nodeId, 0);
}