Class DynamicBlockFactory
Factory to create DynamicBlocks which makes it possible to add a block property to a content instance that is not part of the ContentType.
Inheritance
Namespace: EPiServer.Construction.Internal
Assembly: EPiServer.dll
Version: 12.0.3Syntax
[ServiceConfiguration]
public class DynamicBlockFactory : Object
Constructors
DynamicBlockFactory(IPropertyDataFactory, IContentTypeRepository, IPropertyDefinitionTypeRepository, IContentDataBuilder, IContentDataFactory<BlockData>)
Initializes a new instance of the DynamicBlockFactory class.
Declaration
public DynamicBlockFactory(IPropertyDataFactory propertyDataFactory, IContentTypeRepository contentTypeRepository, IPropertyDefinitionTypeRepository propertyDefinitionTypeRepository, IContentDataBuilder contentDataBuilder, IContentDataFactory<BlockData> blockDataFactory)
Parameters
Type | Name | Description |
---|---|---|
IPropertyDataFactory | propertyDataFactory | The property data factory. |
IContentTypeRepository | contentTypeRepository | The block type repository. |
IPropertyDefinitionTypeRepository | propertyDefinitionTypeRepository | The property definition type repository. |
IContentDataBuilder | contentDataBuilder | The content data builder. |
IContentDataFactory<BlockData> | blockDataFactory | The block data factory. |
Methods
CreateDynamicBlock(BlockPropertyDefinitionType, String)
Creates a dynamic block using a specific definition.
Declaration
public virtual IPropertyBlock CreateDynamicBlock(BlockPropertyDefinitionType blockPropertyDefinitionType, string dynamicBlockName)
Parameters
Type | Name | Description |
---|---|---|
BlockPropertyDefinitionType | blockPropertyDefinitionType | Type of the block property definition. |
System.String | dynamicBlockName | Name of the dynamic block. |
Returns
Type | Description |
---|---|
IPropertyBlock | The dynamic block created. |
Remarks
A dynamic block is a block property that is not defined on any PageType.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown if the |
CreateDynamicBlock<T>(String)
Creates a typed dynamic block.
Declaration
public virtual IPropertyBlock<T> CreateDynamicBlock<T>(string dynamicBlockName)
where T : BlockData
Parameters
Type | Name | Description |
---|---|---|
System.String | dynamicBlockName | Name of the dynamic block. |
Returns
Type | Description |
---|---|
IPropertyBlock<T> | The dynamic block created. |
Type Parameters
Name | Description |
---|---|
T | Type inheriting BlockData. |
Remarks
A dynamic block is a block property that is not defined on any PageType.
The dynamicBlockName
cannot contain either '.', ':' or 'D:'.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown if the |