November Happy Hour will be moved to Thursday December 5th.

Class CatalogContentScannerExtension

Injects code specific to the catalog into the content type scanning mechanism. Responsible for handling synchronization between content types and the meta data plus layer.

Inheritance
System.Object
CatalogContentScannerExtension
Namespace: EPiServer.Commerce.Catalog.Provider.Construction
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0
Syntax
public class CatalogContentScannerExtension : ContentScannerExtension

Constructors

CatalogContentScannerExtension(MetaDataTypeResolver, MetaDataPropertyResolver, IPropertyDefinitionTypeRepository, IContentTypeModelAssigner, MetaDataChangeEventHandler)

Initializes a new instance of the CatalogContentScannerExtension class.

Declaration
public CatalogContentScannerExtension(MetaDataTypeResolver metaDataTypeResolver, MetaDataPropertyResolver metaDataPropertyResolver, IPropertyDefinitionTypeRepository propertyDefinitionTypeRepository, IContentTypeModelAssigner contentTypeModelAssigner, MetaDataChangeEventHandler metaDataChangeEventHandler)
Parameters
Type Name Description
MetaDataTypeResolver metaDataTypeResolver

The meta data type resolver.

MetaDataPropertyResolver metaDataPropertyResolver

The meta data property resolver.

EPiServer.DataAbstraction.IPropertyDefinitionTypeRepository propertyDefinitionTypeRepository

The property definition type repository.

EPiServer.DataAbstraction.RuntimeModel.IContentTypeModelAssigner contentTypeModelAssigner

The content type model assigner.

MetaDataChangeEventHandler metaDataChangeEventHandler

The metadata change event handler.

CatalogContentScannerExtension(MetaDataTypeResolver, MetaDataPropertyResolver, IPropertyDefinitionTypeRepository, IContentTypeModelAssigner, MetaDataChangeEventHandler, HostType)

Initializes a new instance of the CatalogContentScannerExtension class.

Declaration
[Obsolete("This constructor is no longer used. Use the overload without HostType instead. Will remain at least until March 2020.")]
public CatalogContentScannerExtension(MetaDataTypeResolver metaDataTypeResolver, MetaDataPropertyResolver metaDataPropertyResolver, IPropertyDefinitionTypeRepository propertyDefinitionTypeRepository, IContentTypeModelAssigner contentTypeModelAssigner, MetaDataChangeEventHandler metaDataChangeEventHandler, HostType hostType)
Parameters
Type Name Description
MetaDataTypeResolver metaDataTypeResolver

The meta data type resolver.

MetaDataPropertyResolver metaDataPropertyResolver

The meta data property resolver.

EPiServer.DataAbstraction.IPropertyDefinitionTypeRepository propertyDefinitionTypeRepository

The property definition type repository.

EPiServer.DataAbstraction.RuntimeModel.IContentTypeModelAssigner contentTypeModelAssigner

The content type model assigner.

MetaDataChangeEventHandler metaDataChangeEventHandler

The metadata change event handler.

EPiServer.Framework.Initialization.HostType hostType

The host type.

Properties

ContentTypeModelScanners

The registred content type model scanners

Declaration
public virtual IEnumerable<IContentTypeModelScanner> ContentTypeModelScanners { get; set; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<EPiServer.DataAbstraction.RuntimeModel.IContentTypeModelScanner>

MetaDataContext

Context used when loading and creating MetaClass.

Declaration
public virtual MetaDataContext MetaDataContext { get; set; }
Property Value
Type Description
MetaDataContext

Methods

AssignValuesToModel(ContentTypeModel)

Syncs a content type to a meta class.

Declaration
public override void AssignValuesToModel(ContentTypeModel typeModel)
Parameters
Type Name Description
EPiServer.DataAbstraction.RuntimeModel.ContentTypeModel typeModel

The type model.

AssignValuesToProperties(ContentTypeModel)

Syncs properties to meta fields of a conten type/meta class.

Declaration
public override void AssignValuesToProperties(ContentTypeModel contentTypeModel)
Parameters
Type Name Description
EPiServer.DataAbstraction.RuntimeModel.ContentTypeModel contentTypeModel

The content type model.

CreateMetaField(PropertyDefinitionModel, MetaDataType)

Creates MetaField from propertyDefinitionModel.

Declaration
protected virtual MetaField CreateMetaField(PropertyDefinitionModel propertyDefinitionModel, MetaDataType metaDataType)
Parameters
Type Name Description
EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionModel propertyDefinitionModel

The property definition to create the meta field from.

MetaDataType metaDataType

The type of property.

Returns
Type Description
MetaField

IsValid(MetaDataType, MetaDataType)

Validates if the two types are compatible.

Declaration
protected virtual bool IsValid(MetaDataType typeFromCode, MetaDataType typeFromMetaData)
Parameters
Type Name Description
MetaDataType typeFromCode

The property type created from content data model.

MetaDataType typeFromMetaData

The property type in Meta data plus.

Returns
Type Description
System.Boolean

True if the types are compatible, otherwise false.

SetMetaFieldAttribute<TAttribute>(String, MetaAttributeCollection, PropertyDefinitionModel, Func<TAttribute, Object>)

Sets a meta field attribute to a value specified in action.

Declaration
protected virtual void SetMetaFieldAttribute<TAttribute>(string name, MetaAttributeCollection metaFiledAttributes, PropertyDefinitionModel model, Func<TAttribute, object> action)
    where TAttribute : Attribute
Parameters
Type Name Description
System.String name

The name of the meta field attribute

MetaAttributeCollection metaFiledAttributes

The meta field attributes.

EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionModel model

The property definition model.

System.Func<TAttribute, System.Object> action

The action used to get the value.

Type Parameters
Name Description
TAttribute

The attribute type, used to set the meta field attribute.

SetMetaFieldAttributes(MetaAttributeCollection, PropertyDefinitionModel)

Sets meta field attributes. Override this method to set attributes.

Declaration
protected virtual void SetMetaFieldAttributes(MetaAttributeCollection metaFiledAttributes, PropertyDefinitionModel model)
Parameters
Type Name Description
MetaAttributeCollection metaFiledAttributes

The meta fild attributes that will be populated with data.

EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionModel model

The property definition model, which will be used to set the value on the meta field attribute.

ThrowIfAnyModelAttributeIsUnsupported(MetaDataType, PropertyDefinitionModel)

Throws an System.InvalidOperationException if any model attribute on propertyDefinitionModel is not supported by the metaDataType

Declaration
protected virtual void ThrowIfAnyModelAttributeIsUnsupported(MetaDataType metaDataType, PropertyDefinitionModel propertyDefinitionModel)
Parameters
Type Name Description
MetaDataType metaDataType

The meta data type to validate.

EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionModel propertyDefinitionModel

The property definition model, which contains the model attribute to validate.

Exceptions
Type Condition
System.InvalidOperationException

Will be thrown if any attribute is unsupported.

ThrowIfModelContainsAttribute(PropertyDefinitionModel, Type[])

Throws an System.InvalidOperationException if any model attribute on propertyDefinitionModel is not supported by the types

Declaration
protected virtual void ThrowIfModelContainsAttribute(PropertyDefinitionModel propertyDefinitionModel, params Type[] types)
Parameters
Type Name Description
EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionModel propertyDefinitionModel

The property definition model, which contains the model attribute to validate.

System.Type[] types

The model attributes to validate.

Exceptions
Type Condition
System.InvalidOperationException

Will be thrown if any attribute is unsupported.

UpdateMetaField(PropertyDefinitionModel, MetaField)

Updates the specifed MetaField from the specified EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionModel.

Declaration
protected virtual void UpdateMetaField(PropertyDefinitionModel propertyDefinitionModel, MetaField metaField)
Parameters
Type Name Description
EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionModel propertyDefinitionModel

The property definition to update the meta field from.

MetaField metaField

The meta field that will be updated

Validate(IEnumerable<ContentTypeModel>)

Validate content types so that properties with the same name don't have different attribute values.

Declaration
public override void Validate(IEnumerable<ContentTypeModel> typeModels)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<EPiServer.DataAbstraction.RuntimeModel.ContentTypeModel> typeModels

The type models.