Class ContentDataFactory<TContentData>
Creates an instance of IContent
Inheritance
Implements
Namespace: EPiServer.Construction.Internal
Assembly: EPiServer.dll
Version: 12.0.3Syntax
[ServiceConfiguration]
public class ContentDataFactory<TContentData> : Object, IContentDataFactory<TContentData> where TContentData : IContentData
Type Parameters
Name | Description |
---|---|
TContentData | The type of the IContent |
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 |
---|---|---|
IContent |
contentDataActivator | The activator instance used to instanciate content data objects. |
System. |
serviceProvider | The service provider used as a secondary means of creating content data. |
IContent |
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 |
---|---|---|
Content |
contentType | Type indicating what type of content to create. |
Returns
Type | Description |
---|---|
TContent |
A new |
Exceptions
Type | Condition |
---|---|
Type |
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. |
modelType | Type of the model to create. |
Returns
Type | Description |
---|---|
TContent |
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 : TContentData
Returns
Type | Description |
---|---|
TTyped |
A new |
Type Parameters
Name | Description |
---|---|
TTypedData | Type indicating what type of content to create. |
ResolveContentDataType(String)
Resolves the System.
Declaration
protected virtual Type ResolveContentDataType(string modelTypeString)
Parameters
Type | Name | Description |
---|---|---|
System. |
modelTypeString | The model type string. |
Returns
Type | Description |
---|---|
System. |
The System. |
Remarks
Will return the type of TContentData
if the specified type cannot be found.
Override this if you want to change this fallback behavior.