November Happy Hour will be moved to Thursday December 5th.

Class ContentTypeModelRepository

A Repository for ContentTypeModel that corresponds to registered ContentType.

Inheritance
System.Object
ContentTypeModelRepository
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.DataAbstraction
Assembly: EPiServer.dll
Version: 10.10.4
Syntax
[ServiceConfiguration(typeof(ContentTypeModelRepository), Lifecycle = ServiceInstanceScope.Singleton)]
public class ContentTypeModelRepository

Constructors

ContentTypeModelRepository()

Declaration
public ContentTypeModelRepository()

Methods

GetContentTypeModel(Type)

Gets the content type model that corresponds to a model type that is defined on ModelType.

Declaration
public virtual ContentTypeModel GetContentTypeModel(Type modelType)
Parameters
Type Name Description
System.Type modelType

Type of the model.

Returns
Type Description
ContentTypeModel

GetPropertyModel(Int32, PropertyDefinition)

Gets the property model that corresponds to a PropertyDefinition on the ContentType with given id.

Declaration
public virtual PropertyDefinitionModel GetPropertyModel(int contentTypeId, PropertyDefinition propertyDefinition)
Parameters
Type Name Description
System.Int32 contentTypeId

The content type id.

PropertyDefinition propertyDefinition

The property definition.

Returns
Type Description
PropertyDefinitionModel

List()

Lists all registered ContentTypeModel

Declaration
public virtual IEnumerable<ContentTypeModel> List()
Returns
Type Description
System.Collections.Generic.IEnumerable<ContentTypeModel>

OnModelChanged(ContentType)

Method to raise ModelChanged event.

Declaration
protected virtual void OnModelChanged(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

Type of the content.

Register(Type, ContentTypeModel)

Registers model that corresponds to modelType.

Declaration
public virtual void Register(Type modelType, ContentTypeModel model)
Parameters
Type Name Description
System.Type modelType

Type of the model.

ContentTypeModel model

The model.

RegisterContentType(ContentType)

Registers the ModelType for a ContentType if it is not null.

Declaration
public virtual void RegisterContentType(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

Type of the content.

Events

ModelChanged

Occurs when the repository has a change in a model instance.

Declaration
public event EventHandler<ModelRepositoryEventArgs> ModelChanged
Event Type
Type Description
System.EventHandler<ModelRepositoryEventArgs>

Extension Methods