Class ContentFactory
Helper class for creating content data instances such as PageData, Shared blocks and IContent according to the ContentType.
Inheritance
Inherited Members
Namespace: EPiServer.Construction
Assembly: EPiServer.dll
Version: 8.11.0Syntax
public class ContentFactory
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>, IPageDataBuilder, IContentDataBuilder, IPropertyDataFactory)
Initializes a new instance of the ContentFactory class.
Declaration
public ContentFactory(ISharedBlockFactory sharedblockFactory, IContentDataFactory<IContent> contentFactory, IContentDataFactory<PageData> pageDataFactory, IPageDataBuilder pageDataBuilder, IContentDataBuilder contentDataBuilder, IPropertyDataFactory propertyDataFactory)
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. |
IPageDataBuilder | pageDataBuilder | The page data builder used to build up 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 |
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> |
PageDataBuilder
Gets the page data builder used to add PropertyData instances to a PageData instances.
Declaration
protected IPageDataBuilder PageDataBuilder { get; }
Property Value
Type | Description |
---|---|
IPageDataBuilder |
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.