Try our conversational search powered by Generative AI!

Class ContentDataFactory<TContentData>

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Creates an instance of IContentData instances of specified ContentType.

Inheritance
System.Object
ContentDataFactory<TContentData>
Implements
IContentDataFactory<TContentData>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Construction.Internal
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
[ServiceConfiguration(typeof(IContentDataFactory<>))]
public class ContentDataFactory<TContentData> : IContentDataFactory<TContentData> where TContentData : IContentData
Type Parameters
Name Description
TContentData

The type of the IContentData to create.

Constructors

ContentDataFactory(IContentDataActivator, IServiceLocator, IContentTypeBaseResolver)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes a new instance of the ContentDataFactory<TContentData> class.

Declaration
public ContentDataFactory(IContentDataActivator contentDataActivator, IServiceLocator serviceLocator, IContentTypeBaseResolver contentTypeBaseResolver)
Parameters
Type Name Description
IContentDataActivator contentDataActivator

The activator instance used to instanciate content data objects.

IServiceLocator serviceLocator

The service locator used as a secondary means of creating content data.

IContentTypeBaseResolver contentTypeBaseResolver

The content type base resolver

Methods

CreateInstance(ContentType)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. 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 TContentData instance.

Exceptions
Type Condition
TypeMismatchException

Thrown if the data type defined by the provided content type does not match the return value type.

CreateInstance(Type)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. 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>()

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Creates a new TContentData instance of the type specified by TTypedData.

Declaration
public virtual TTypedData CreateInstance<TTypedData>()
    where TTypedData : TContentData
Returns
Type Description
TTypedData

A new TTypedData instance.

Type Parameters
Name Description
TTypedData

Type indicating what type of content to create.

ResolveContentDataType(String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. 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.

Implements

Extension Methods