Class ContentDataFactory<TContentData>
Creates an instance of IContentData instances of specified ContentType.
Inheritance
Implements
Namespace: EPiServer.Construction.Internal
Assembly: EPiServer.dll
Version: 12.0.3Syntax
[ServiceConfiguration]
public class ContentDataFactory<TContentData> : Object, IContentDataFactory<TContentData> where TContentData : IContentDataType Parameters
| Name | Description | 
|---|---|
| TContentData | The type of the IContentData to create. | 
Constructors
ContentDataFactory(IContentDataActivator, IServiceProvider, IContentTypeBaseResolver)
Initializes a new instance of the ContentDataFactory<TContentData> class.
Declaration
public ContentDataFactory(IContentDataActivator contentDataActivator, IServiceProvider serviceProvider, IContentTypeBaseResolver contentTypeBaseResolver)Parameters
| Type | Name | Description | 
|---|---|---|
| IContentDataActivator | contentDataActivator | The activator instance used to instanciate content data objects. | 
| System.IServiceProvider | serviceProvider | The service provider used as a secondary means of creating content data. | 
| IContentTypeBaseResolver | contentTypeBaseResolver | The content type base resolver | 
Methods
CreateInstance(ContentType)
Creates a new TContentData instance of the specified content type.
Declaration
public virtual TContentData CreateInstance(ContentType contentType)Parameters
| Type | Name | Description | 
|---|---|---|
| ContentType | contentType | Type indicating what type of content to create. | 
Returns
| Type | Description | 
|---|---|
| TContentData | A new  | 
Exceptions
| Type | Condition | 
|---|---|
| TypeMismatchException | Thrown if the data type defined by the provided content type does not match the return value type. | 
CreateInstance(Type)
Creates a new instance of the specified model type.
Declaration
protected virtual TContentData CreateInstance(Type modelType)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | modelType | Type of the model to create. | 
Returns
| Type | Description | 
|---|---|
| TContentData | A new instance of the given type. | 
CreateInstance<TTypedData>()
Creates a new TContentData instance of the type specified by TTypedData.
Declaration
public virtual TTypedData CreateInstance<TTypedData>()
    where TTypedData : TContentDataReturns
| Type | Description | 
|---|---|
| TTypedData | A new  | 
Type Parameters
| Name | Description | 
|---|---|
| TTypedData | Type indicating what type of content to create. | 
ResolveContentDataType(String)
Resolves the System.Type of ContentData from the given type and assembly name specified.
Declaration
protected virtual Type ResolveContentDataType(string modelTypeString)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | modelTypeString | The model type string. | 
Returns
| Type | Description | 
|---|---|
| System.Type | The System.Type that matches the provided type and assembly string. | 
Remarks
Will return the type of TContentData if the specified type cannot be found.
Override this if you want to change this fallback behavior.
