Class ReferenceConverterExtensions

Extensions for ReferenceConverter.

Inheritance
System.Object
ReferenceConverterExtensions
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: Mediachase.Commerce.Catalog
Assembly: Mediachase.Commerce.dll
Version: 10.8.0
Syntax
public static class ReferenceConverterExtensions

Methods

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.

        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);
}

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.

        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);
}

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.

        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);
}

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.

        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);
}