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

Class ContentFactory

Helper class for creating content data instances such as PageData, Shared blocks and IContent according to the ContentType.

Inheritance
System.Object
ContentFactory
Implements
Namespace: EPiServer.Construction.Internal
Assembly: EPiServer.dll
Version: 12.0.3
Syntax
public class ContentFactory : Object, IContentFactory
Remarks

This classes encapsulates various factories and builders used to create and build up various content instances depending on the ContentType.

Constructors

ContentFactory(ISharedBlockFactory, IContentDataFactory<IContent>, IContentDataFactory<PageData>, IContentDataBuilder, IPropertyDataFactory, IObjectInstanceCache, IContentCacheKeyCreator, IContentTypeBaseResolver)

Initializes a new instance of the ContentFactory class.

Declaration
public ContentFactory(ISharedBlockFactory sharedblockFactory, IContentDataFactory<IContent> contentFactory, IContentDataFactory<PageData> pageDataFactory, IContentDataBuilder contentDataBuilder, IPropertyDataFactory propertyDataFactory, IObjectInstanceCache cache, IContentCacheKeyCreator contentCacheKeyCreator, IContentTypeBaseResolver contentTypeBaseResolver)
Parameters
Type Name Description
ISharedBlockFactory sharedblockFactory

The block host factory used to create shared block instances.

IContentDataFactory<IContent> contentFactory

The content factory used to create IContent instances that are not pages or hosted blocks.

IContentDataFactory<PageData> pageDataFactory

The page factory used to create PageData instances.

IContentDataBuilder contentDataBuilder

The content data builder used to build up IContent that are not PageData instances.

IPropertyDataFactory propertyDataFactory

The property data factory used by contentDataBuilder

IObjectInstanceCache cache

The cache used

IContentCacheKeyCreator contentCacheKeyCreator

The creator of cache keys

IContentTypeBaseResolver contentTypeBaseResolver

The content type base resolver

Properties

ContentDataBuilder

Gets the content data builder used to add PropertyData instances to a IContent instances.

Declaration
protected IContentDataBuilder ContentDataBuilder { get; }
Property Value
Type Description
IContentDataBuilder

IContentFactory

Gets the content factory used to create IContent instances.

Declaration
protected IContentDataFactory<IContent> IContentFactory { get; }
Property Value
Type Description
IContentDataFactory<IContent>

PageDataFactory

Gets the PageData factory used to create PageData instances.

Declaration
protected IContentDataFactory<PageData> PageDataFactory { get; }
Property Value
Type Description
IContentDataFactory<PageData>

PropertyDataFactory

Gets the property data factory used to create PropertyData instances.

Declaration
protected IPropertyDataFactory PropertyDataFactory { get; }
Property Value
Type Description
IPropertyDataFactory

The property data factory.

SharedBlockFactory

Gets the block host factory used to create shared BlockData instances.

Declaration
protected ISharedBlockFactory SharedBlockFactory { get; }
Property Value
Type Description
ISharedBlockFactory

Methods

CreateContent(ContentType)

Creates an instance of IContent and populates the instance with properties according to the passed in ContentType.

Declaration
public virtual IContent CreateContent(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

Type of the content.

Returns
Type Description
IContent
Remarks

The implemetation will call overload with a BuildingContext set so no property values are set.

CreateContent(ContentType, BuildingContext)

Creates an instance of IContent and populates the instance with properties according to the passed in ContentType.

Declaration
public virtual IContent CreateContent(ContentType contentType, BuildingContext buildingContext)
Parameters
Type Name Description
ContentType contentType

Type of the content.

BuildingContext buildingContext

The building context.

Returns
Type Description
IContent
Remarks

Depending on type of contentType (e.g. PageType, BlockType) the suitable encapsulated factory and builder instance will be used to create and build up an IContent instance.

Depending on buildingContext default values and inherited values will be set.

Implements

Extension Methods