Class CatalogContentProvider

Content provider for Commerce object

Inheritance
System.Object
CatalogContentProvider
Namespace: EPiServer.Commerce.Catalog.Provider
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0
Syntax
public class CatalogContentProvider : ContentProvider

Constructors

CatalogContentProvider()

Initializes a new instance of the CatalogContentProvider class.

Declaration
public CatalogContentProvider()

CatalogContentProvider(ContentFactory, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ILanguageBranchRepository, LanguageSelectorFactory, IContentLoader, CatalogContentLoader, ReferenceConverter, ILinksRepository, IContentCopyHandler, IPriceService, IWarehouseInventoryService, IValidationService, ICatalogSystem, ISynchronizedObjectInstanceCache, CatalogContentCommitterHandler, CatalogContentVersionStore, ContentGuidAdmin)

Initializes a new instance of the CatalogContentProvider class.

Declaration
[Obsolete("Due to the new IContentCacheKeyCreator member, this contructor is no longer used. Please use the contructor with IContentCacheKeyCreator instead. Will remain at least until January 2017.")]
public CatalogContentProvider(ContentFactory contentFactory, ServiceAccessor<IContentTypeRepository> contentTypeRepositoryAccessor, TemplateResolver templateResolver, UrlSegmentHandler urlSegmentHandler, ILanguageBranchRepository languageBranchRepository, LanguageSelectorFactory languageSelectorFactory, IContentLoader contentLoader, CatalogContentLoader catalogContentLoader, ReferenceConverter referenceConverter, ILinksRepository linksRepository, IContentCopyHandler contentCopyHandler, IPriceService priceService, IWarehouseInventoryService warehouseInventoryService, IValidationService validationService, ICatalogSystem catalogSystem, ISynchronizedObjectInstanceCache objectInstanceCache, CatalogContentCommitterHandler catalogContentCommitterHandler, CatalogContentVersionStore contentVersionStore, ContentGuidAdmin contentGuidAdmin)
Parameters
Type Name Description
EPiServer.Construction.Internal.ContentFactory contentFactory
EPiServer.ServiceLocation.ServiceAccessor<EPiServer.DataAbstraction.IContentTypeRepository> contentTypeRepositoryAccessor
EPiServer.Web.TemplateResolver templateResolver
EPiServer.Web.UrlSegmentHandler urlSegmentHandler
EPiServer.DataAbstraction.ILanguageBranchRepository languageBranchRepository
EPiServer.Core.LanguageSelectorFactory languageSelectorFactory
EPiServer.IContentLoader contentLoader
CatalogContentLoader catalogContentLoader
ReferenceConverter referenceConverter
ILinksRepository linksRepository
EPiServer.Core.Transfer.IContentCopyHandler contentCopyHandler
IPriceService priceService
IWarehouseInventoryService warehouseInventoryService
EPiServer.Validation.IValidationService validationService
ICatalogSystem catalogSystem
EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache objectInstanceCache
CatalogContentCommitterHandler catalogContentCommitterHandler
CatalogContentVersionStore contentVersionStore
ContentGuidAdmin contentGuidAdmin

CatalogContentProvider(ContentFactory, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ILanguageBranchRepository, LanguageSelectorFactory, IContentLoader, CatalogContentLoader, ReferenceConverter, ILinksRepository, IContentCopyHandler, IPriceService, IWarehouseInventoryService, IValidationService, ICatalogSystem, ISynchronizedObjectInstanceCache, CatalogContentCommitterHandler, CatalogContentVersionStore, ContentGuidAdmin, CatalogContentDB)

Declaration
[Obsolete("Due to the new IContentCacheKeyCreator member, this contructor is no longer used. Please use the contructor with IContentCacheKeyCreator instead. Will remain at least until April 2017.")]
public CatalogContentProvider(ContentFactory contentFactory, ServiceAccessor<IContentTypeRepository> contentTypeRepositoryAccessor, TemplateResolver templateResolver, UrlSegmentHandler urlSegmentHandler, ILanguageBranchRepository languageBranchRepository, LanguageSelectorFactory languageSelectorFactory, IContentLoader contentLoader, CatalogContentLoader catalogContentLoader, ReferenceConverter referenceConverter, ILinksRepository linksRepository, IContentCopyHandler contentCopyHandler, IPriceService priceService, IWarehouseInventoryService warehouseInventoryService, IValidationService validationService, ICatalogSystem catalogSystem, ISynchronizedObjectInstanceCache objectInstanceCache, CatalogContentCommitterHandler catalogContentCommitterHandler, CatalogContentVersionStore contentVersionStore, ContentGuidAdmin contentGuidAdmin, CatalogContentDB catalogContentDB)
Parameters
Type Name Description
EPiServer.Construction.Internal.ContentFactory contentFactory
EPiServer.ServiceLocation.ServiceAccessor<EPiServer.DataAbstraction.IContentTypeRepository> contentTypeRepositoryAccessor
EPiServer.Web.TemplateResolver templateResolver
EPiServer.Web.UrlSegmentHandler urlSegmentHandler
EPiServer.DataAbstraction.ILanguageBranchRepository languageBranchRepository
EPiServer.Core.LanguageSelectorFactory languageSelectorFactory
EPiServer.IContentLoader contentLoader
CatalogContentLoader catalogContentLoader
ReferenceConverter referenceConverter
ILinksRepository linksRepository
EPiServer.Core.Transfer.IContentCopyHandler contentCopyHandler
IPriceService priceService
IWarehouseInventoryService warehouseInventoryService
EPiServer.Validation.IValidationService validationService
ICatalogSystem catalogSystem
EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache objectInstanceCache
CatalogContentCommitterHandler catalogContentCommitterHandler
CatalogContentVersionStore contentVersionStore
ContentGuidAdmin contentGuidAdmin
CatalogContentDB catalogContentDB

CatalogContentProvider(ContentFactory, ServiceAccessor<IContentTypeRepository>, TemplateResolver, UrlSegmentHandler, ILanguageBranchRepository, LanguageSelectorFactory, IContentLoader, CatalogContentLoader, ReferenceConverter, ILinksRepository, IContentCopyHandler, IPriceService, IWarehouseInventoryService, IValidationService, ICatalogSystem, ISynchronizedObjectInstanceCache, CatalogContentCommitterHandler, CatalogContentVersionStore, ContentGuidAdmin, CatalogContentDB, IContentCacheKeyCreator)

Initializes a new instance of the CatalogContentProvider class.

Declaration
[Obsolete("Due to the dependency structure of the base ContentProvider class, this contructor is no longer used. Please use simplified contructor without ContentFactory etc. Will remain at least until May 2017.")]
public CatalogContentProvider(ContentFactory contentFactory, ServiceAccessor<IContentTypeRepository> contentTypeRepositoryAccessor, TemplateResolver templateResolver, UrlSegmentHandler urlSegmentHandler, ILanguageBranchRepository languageBranchRepository, LanguageSelectorFactory languageSelectorFactory, IContentLoader contentLoader, CatalogContentLoader catalogContentLoader, ReferenceConverter referenceConverter, ILinksRepository linksRepository, IContentCopyHandler contentCopyHandler, IPriceService priceService, IWarehouseInventoryService warehouseInventoryService, IValidationService validationService, ICatalogSystem catalogSystem, ISynchronizedObjectInstanceCache objectInstanceCache, CatalogContentCommitterHandler catalogContentCommitterHandler, CatalogContentVersionStore contentVersionStore, ContentGuidAdmin contentGuidAdmin, CatalogContentDB catalogContentDB, IContentCacheKeyCreator contentCacheKeyCreator)
Parameters
Type Name Description
EPiServer.Construction.Internal.ContentFactory contentFactory

The content factory.

EPiServer.ServiceLocation.ServiceAccessor<EPiServer.DataAbstraction.IContentTypeRepository> contentTypeRepositoryAccessor

The content type repository accessor.

EPiServer.Web.TemplateResolver templateResolver

The template resolver.

EPiServer.Web.UrlSegmentHandler urlSegmentHandler

The URL segment handler.

EPiServer.DataAbstraction.ILanguageBranchRepository languageBranchRepository

The language branch repository.

EPiServer.Core.LanguageSelectorFactory languageSelectorFactory

The language selector factory.

EPiServer.IContentLoader contentLoader

The content loader.

CatalogContentLoader catalogContentLoader

The catalog content loader.

ReferenceConverter referenceConverter

The reference converter.

ILinksRepository linksRepository

The links repository.

EPiServer.Core.Transfer.IContentCopyHandler contentCopyHandler

The content copy handler.

IPriceService priceService

The price service.

IWarehouseInventoryService warehouseInventoryService

The warehouse inventory service.

EPiServer.Validation.IValidationService validationService

Validation service dependency

ICatalogSystem catalogSystem

The catalog system.

EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache objectInstanceCache

The object instance cache.

CatalogContentCommitterHandler catalogContentCommitterHandler

The committer to commit changes to the ECF database.

CatalogContentVersionStore contentVersionStore

The catalog content version store.

ContentGuidAdmin contentGuidAdmin

The catalog guid admin.

CatalogContentDB catalogContentDB

The catalog content DB.

EPiServer.Core.IContentCacheKeyCreator contentCacheKeyCreator

Handles generation of Cache keys.

CatalogContentProvider(IContentLoader, CatalogContentLoader, ReferenceConverter, ILinksRepository, IPriceService, IWarehouseInventoryService, ICatalogSystem, ISynchronizedObjectInstanceCache, CatalogContentCommitterHandler, CatalogContentVersionStore, ContentGuidAdmin, CatalogContentDB, IContentCacheKeyCreator)

Initializes a new instance of the CatalogContentProvider class.

Declaration
[Obsolete("Use constructor with Mediachase.Commerce.InventoryService.IInventoryService instead. Will remain at least until October 2017.")]
public CatalogContentProvider(IContentLoader contentLoader, CatalogContentLoader catalogContentLoader, ReferenceConverter referenceConverter, ILinksRepository linksRepository, IPriceService priceService, IWarehouseInventoryService warehouseInventoryService, ICatalogSystem catalogSystem, ISynchronizedObjectInstanceCache objectInstanceCache, CatalogContentCommitterHandler catalogContentCommitterHandler, CatalogContentVersionStore contentVersionStore, ContentGuidAdmin contentGuidAdmin, CatalogContentDB catalogContentDB, IContentCacheKeyCreator contentCacheKeyCreator)
Parameters
Type Name Description
EPiServer.IContentLoader contentLoader

The content loader.

CatalogContentLoader catalogContentLoader

The catalog content loader.

ReferenceConverter referenceConverter

The reference converter.

ILinksRepository linksRepository

The links repository.

IPriceService priceService

The price service.

IWarehouseInventoryService warehouseInventoryService

The warehouse inventory service.

ICatalogSystem catalogSystem

The catalog system.

EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache objectInstanceCache

The object instance cache.

CatalogContentCommitterHandler catalogContentCommitterHandler

The committer to commit changes to the ECF database.

CatalogContentVersionStore contentVersionStore

The catalog content version store.

ContentGuidAdmin contentGuidAdmin

The catalog guid admin.

CatalogContentDB catalogContentDB

The catalog content DB.

EPiServer.Core.IContentCacheKeyCreator contentCacheKeyCreator

Handles generation of Cache keys.

CatalogContentProvider(IContentLoader, CatalogContentLoader, ReferenceConverter, ILinksRepository, IPriceService, IInventoryService, ICatalogSystem, ISynchronizedObjectInstanceCache, CatalogContentCommitterHandler, CatalogContentVersionStore, ContentGuidAdmin, CatalogContentDB, IContentCacheKeyCreator)

Declaration
public CatalogContentProvider(IContentLoader contentLoader, CatalogContentLoader catalogContentLoader, ReferenceConverter referenceConverter, ILinksRepository linksRepository, IPriceService priceService, IInventoryService inventoryService, ICatalogSystem catalogSystem, ISynchronizedObjectInstanceCache objectInstanceCache, CatalogContentCommitterHandler catalogContentCommitterHandler, CatalogContentVersionStore contentVersionStore, ContentGuidAdmin contentGuidAdmin, CatalogContentDB catalogContentDB, IContentCacheKeyCreator contentCacheKeyCreator)
Parameters
Type Name Description
EPiServer.IContentLoader contentLoader
CatalogContentLoader catalogContentLoader
ReferenceConverter referenceConverter
ILinksRepository linksRepository
IPriceService priceService
IInventoryService inventoryService
ICatalogSystem catalogSystem
EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache objectInstanceCache
CatalogContentCommitterHandler catalogContentCommitterHandler
CatalogContentVersionStore contentVersionStore
ContentGuidAdmin contentGuidAdmin
CatalogContentDB catalogContentDB
EPiServer.Core.IContentCacheKeyCreator contentCacheKeyCreator

Fields

DefaultProviderKey

Default key of the CatalogContentProvider, used in the automatic registration of the content provider and in in creating EPiServer.Core.ContentReferences to catalog content in it.

Declaration
public const string DefaultProviderKey = "CatalogContent"
Field Value
Type Description
System.String

Properties

ProviderCapabilities

Gets the capabilities that this content provider supports.

Declaration
public override ContentProviderCapabilities ProviderCapabilities { get; }
Property Value
Type Description
EPiServer.Core.ContentProviderCapabilities

ProviderKey

Gets the provider key.

Declaration
public override string ProviderKey { get; }
Property Value
Type Description
System.String

VersionRepository

Gets the version repository for catalog content.

Declaration
public override IContentVersionRepository VersionRepository { get; }
Property Value
Type Description
EPiServer.Core.IContentVersionRepository

Methods

Copy(ContentReference, ContentReference, Boolean, AccessLevel)

Copies the specified content to the destination.

Declaration
public override ContentReference Copy(ContentReference contentLink, ContentReference destinationLink, bool publishOnDestination, AccessLevel requiredSourceAccess)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The content link of the content to copy.

EPiServer.Core.ContentReference destinationLink

The destination link.

System.Boolean publishOnDestination

if set to true the content will be published at destination.

EPiServer.Security.AccessLevel requiredSourceAccess

The required source access.

Returns
Type Description
EPiServer.Core.ContentReference

CopyPrices(EntryContentBase, EntryContentBase)

Copies the prices. This method will be called after content has been copied.

Declaration
protected virtual void CopyPrices(EntryContentBase source, EntryContentBase target)
Parameters
Type Name Description
EntryContentBase source

The content to copy prices from.

EntryContentBase target

The content which just has been created.

CopyWarehouseInventories(EntryContentBase, EntryContentBase)

Copies the warehouse inventories. This method will be called after content has been copied.

Declaration
protected virtual void CopyWarehouseInventories(EntryContentBase source, EntryContentBase target)
Parameters
Type Name Description
EntryContentBase source

The content to copy prices from.

EntryContentBase target

The content which just has been created.

Delete(ContentReference, Boolean)

Delete a content.

Declaration
public override void Delete(ContentReference contentLink, bool forceDelete)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

A link to the content that should be deleted.

System.Boolean forceDelete

Set to true if you want to delete this even if other items reference it.

GetCatalogItemAssetDataTable(String)

Declaration
protected virtual CatalogRelationDto.CatalogItemAssetDataTable GetCatalogItemAssetDataTable(string mediaDataAssetKey)
Parameters
Type Name Description
System.String mediaDataAssetKey
Returns
Type Description
CatalogRelationDto.CatalogItemAssetDataTable

GetPagesWithPropertyDefinition(PropertyDefinition, Boolean, Boolean)

Gets the catalog contents with instance of property definition.

Declaration
public override IList<ContentUsage> GetPagesWithPropertyDefinition(PropertyDefinition propertyDefinition, bool onlyNoneMasterLanguage, bool onlyPublished)
Parameters
Type Name Description
EPiServer.DataAbstraction.PropertyDefinition propertyDefinition

The definition.

System.Boolean onlyNoneMasterLanguage

if set to true only none master language are taken into account.

System.Boolean onlyPublished

if set to true only published versions are taken into account.

Returns
Type Description
System.Collections.Generic.IList<EPiServer.DataAbstraction.ContentUsage>

GetReferencesToContentItems(IEnumerable<ContentReference>)

Gets all references to the specified product content, for example, any entry that uses these content links. Override method to get all references to the given items.

Declaration
public override IList<ReferenceInformation> GetReferencesToContentItems(IEnumerable<ContentReference> contentLinks)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<EPiServer.Core.ContentReference> contentLinks

The content links to check references for.

Returns
Type Description
System.Collections.Generic.IList<EPiServer.DataAbstraction.ReferenceInformation>

A list of items that hold some kind of reference to the specified content.

IsContentTypeUsed(ContentType)

Performs a check if specified EPiServer.DataAbstraction.ContentType is used.

Declaration
public override bool IsContentTypeUsed(ContentType contentType)
Parameters
Type Name Description
EPiServer.DataAbstraction.ContentType contentType

The contentType to return references for.

Returns
Type Description
System.Boolean

true if content type is used; otherwise, false.

IsPropertyDefinitionUsed(PropertyDefinition)

Determines whether there is data store on specified propertyDefinition.

Declaration
public override bool IsPropertyDefinitionUsed(PropertyDefinition propertyDefinition)
Parameters
Type Name Description
EPiServer.DataAbstraction.PropertyDefinition propertyDefinition

The property definition.

Returns
Type Description
System.Boolean

true if property definition is used; otherwise, false.

ListContentOfContentType(ContentType)

Gets a list of references to catalog content of specified EPiServer.DataAbstraction.ContentType.

Declaration
public override IList<ContentUsage> ListContentOfContentType(ContentType contentType)
Parameters
Type Name Description
EPiServer.DataAbstraction.ContentType contentType

The contentType to return references for.

Returns
Type Description
System.Collections.Generic.IList<EPiServer.DataAbstraction.ContentUsage>

ListDelayedPublish()

Lists the content versions that are scheduled for publish.

Declaration
public override IEnumerable<IContent> ListDelayedPublish()
Returns
Type Description
System.Collections.Generic.IEnumerable<EPiServer.Core.IContent>

ListMatchingSegments(ContentReference, String)

Lists references to all children content items that have matching routing/url segments.

Declaration
protected override IList<MatchingSegmentResult> ListMatchingSegments(ContentReference parentLink, string urlSegment)
Parameters
Type Name Description
EPiServer.Core.ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

Returns
Type Description
System.Collections.Generic.IList<EPiServer.Core.MatchingSegmentResult>

LoadChildrenReferencesAndTypes(ContentReference, String, out Boolean)

Loads the children references and types.

Declaration
protected override IList<GetChildrenReferenceResult> LoadChildrenReferencesAndTypes(ContentReference contentLink, string languageID, out bool languageSpecific)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The content link to the parent.

System.String languageID

The language ID.

System.Boolean languageSpecific

Output parameter which will be assigned false because catalog child listings are the same for all languages.

Returns
Type Description
System.Collections.Generic.IList<EPiServer.Core.GetChildrenReferenceResult>

LoadContent(ContentReference, ILanguageSelector)

Load content for given contentlink.

Declaration
protected override IContent LoadContent(ContentReference contentLink, ILanguageSelector languageSelector)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The content link.

EPiServer.Core.ILanguageSelector languageSelector

The language selector.

Returns
Type Description
EPiServer.Core.IContent

An instance of CatalogContent

LoadContents(IList<ContentReference>, ILanguageSelector)

Loads multiple catalog content instances from their references.

Declaration
protected override IEnumerable<IContent> LoadContents(IList<ContentReference> contentReferences, ILanguageSelector selector)
Parameters
Type Name Description
System.Collections.Generic.IList<EPiServer.Core.ContentReference> contentReferences

The content references.

EPiServer.Core.ILanguageSelector selector

The language selector.

Returns
Type Description
System.Collections.Generic.IEnumerable<EPiServer.Core.IContent>

Move(ContentReference, ContentReference)

Moves the specified content to the destination.

Declaration
public override void Move(ContentReference contentLink, ContentReference destinationLink)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The content link of the content to move.

EPiServer.Core.ContentReference destinationLink

The destination link.

Exceptions
Type Condition
System.InvalidOperationException

Only catalog entries and nodes can be moved.

ResolveContent(ContentReference)

Tries to resolve a Content from a EPiServer.Core.ContentReference.

Declaration
protected override ContentResolveResult ResolveContent(ContentReference contentLink)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentLink

The content link.

Returns
Type Description
EPiServer.Web.ContentResolveResult

A EPiServer.Web.ContentResolveResult with the identifiers for the content or null if no content was matched.

Remarks

The ContentUri relies on correct routing for the content, if no matching routes are registered, it will return a Uri to the root.

ResolveContent(Guid)

Tries to resolve a Content from a System.Guid.

Declaration
protected override ContentResolveResult ResolveContent(Guid contentGuid)
Parameters
Type Name Description
System.Guid contentGuid

The content link.

Returns
Type Description
EPiServer.Web.ContentResolveResult

A EPiServer.Web.ContentResolveResult with the identifiers for the content or null if no content was matched.

Remarks

The ContentUri relies on correct routing for the content, if no matching routes are registered, it will return a Uri to the root.

Save(IContent, SaveAction)

Save catalog content to storage with specified action.

Declaration
public override ContentReference Save(IContent content, SaveAction action)
Parameters
Type Name Description
EPiServer.Core.IContent content

The content.

EPiServer.DataAccess.SaveAction action

The action.

Returns
Type Description
EPiServer.Core.ContentReference

SetCacheSettings(ContentReference, IEnumerable<GetChildrenReferenceResult>, CacheSettings)

Adds dependencies to keys from MasterCacheKeys to react to item adds/removes and changed relations

Declaration
protected override void SetCacheSettings(ContentReference contentReference, IEnumerable<GetChildrenReferenceResult> children, CacheSettings cacheSettings)
Parameters
Type Name Description
EPiServer.Core.ContentReference contentReference
System.Collections.Generic.IEnumerable<EPiServer.Core.GetChildrenReferenceResult> children
EPiServer.Core.CacheSettings cacheSettings

SetCacheSettings(ContentReference, String, IEnumerable<MatchingSegmentResult>, CacheSettings)

Adds dependencies to keys from MasterCacheKeys to react to item adds/removes and changed relations

Declaration
protected override void SetCacheSettings(ContentReference parentLink, string urlSegment, IEnumerable<MatchingSegmentResult> childrenMatches, CacheSettings cacheSettings)
Parameters
Type Name Description
EPiServer.Core.ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

System.Collections.Generic.IEnumerable<EPiServer.Core.MatchingSegmentResult> childrenMatches

The children matches.

EPiServer.Core.CacheSettings cacheSettings

The cache settings.

SetCacheSettings(IContent, CacheSettings)

Adds dependencies to keys from MasterCacheKeys to react to changes in the entry (with relations) / node / catalog the content is based on

Declaration
protected override void SetCacheSettings(IContent content, CacheSettings cacheSettings)
Parameters
Type Name Description
EPiServer.Core.IContent content

The content that is about to be added to cache.

EPiServer.Core.CacheSettings cacheSettings

The cache settings.

ValidateForPublishing(IContent)

Validate content before publishing.

Declaration
protected override IEnumerable<ValidationError> ValidateForPublishing(IContent content)
Parameters
Type Name Description
EPiServer.Core.IContent content

The content.

Returns
Type Description
System.Collections.Generic.IEnumerable<EPiServer.Validation.ValidationError>

An enumerable with EPiServer.Validation.ValidationError