Class ContentTypeRepository
Repository for the ContentType data structure.
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public abstract class ContentTypeRepository : Object, IContentTypeRepository, IContentTypeRepository<ContentType>Constructors
ContentTypeRepository()
Declaration
protected ContentTypeRepository()Methods
Copy(ContentType)
Creates a copy of the specified content type in the data repository and returns it.
Declaration
public abstract ContentType Copy(ContentType contentType)Parameters
| Type | Name | Description | 
|---|---|---|
| ContentType | contentType | The ContentType to be copied. | 
Returns
| Type | Description | 
|---|---|
| ContentType | The copy of the ContentType that was provided. | 
Copy(Int32)
Creates a copy of the specified content type in the data repository and returns it.
Declaration
public virtual ContentType Copy(int id)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | id | The id of the ContentType to be copied. | 
Returns
| Type | Description | 
|---|---|
| ContentType | The copy of the ContentType that matches the given id. | 
Copy(Type)
Creates a copy of the specified content type in the data repository and returns it.
Declaration
public virtual ContentType Copy(Type modelType)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | modelType | The underlying System.Type of the ContentType. | 
Returns
| Type | Description | 
|---|---|
| ContentType | The copy of the ContentType that matches the given type. | 
Delete(ContentType)
Deletes a ContentType from the data repository.
Declaration
public abstract void Delete(ContentType contentType)Parameters
| Type | Name | Description | 
|---|---|---|
| ContentType | contentType | The content type that is to be deleted. | 
Delete(Int32)
Deletes a ContentType with the given id from the data repository.
Declaration
public virtual void Delete(int id)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | id | The ContentType id. | 
Delete(Type)
Deletes a ContentType with the underlying System.Type from the data repository.
Declaration
public virtual void Delete(Type modelType)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | modelType | The underlying System.Type of the ContentType. | 
List()
Lists all ContentTypes in the data repository.
Declaration
public abstract IEnumerable<ContentType> List()Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<ContentType> | Enumeration of ContentTypes. | 
Load(Guid)
Loads a ContentType with the specified System.Guid from the data repository.
Declaration
public abstract ContentType Load(Guid guid)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Guid | guid | The ContentType GUID. | 
Returns
| Type | Description | 
|---|---|
| ContentType | The ContentType that matches the given System.Guid or null if none could be found. | 
Load(Int32)
Loads a ContentType with the specified id from the data repository.
Declaration
public abstract ContentType Load(int id)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | id | The ContentType id. | 
Returns
| Type | Description | 
|---|---|
| ContentType | The ContentType that matches the given id or null if none could be found. | 
Load(String)
Loads a ContentType with the specified name from the data repository.
Declaration
public abstract ContentType Load(string name)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | name | The ContentType name. | 
Returns
| Type | Description | 
|---|---|
| ContentType | The ContentType that matches the given name or null if none could be found. | 
Load(Type)
Loads a ContentType with the underlying System.Type from the data repository.
Declaration
public abstract ContentType Load(Type modelType)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | modelType | The underlying System.Type of the ContentType. | 
Returns
| Type | Description | 
|---|---|
| ContentType | The ContentType that matches the given System.Type or null if none could be found. | 
OnContentTypeDeleted(ContentType, ContentTypeEventArgs)
Raises the ContentTypeDeleted event.
Declaration
protected virtual void OnContentTypeDeleted(ContentType contentType, ContentTypeEventArgs args)Parameters
| Type | Name | Description | 
|---|---|---|
| ContentType | contentType | Type of the content. | 
| ContentTypeEventArgs | args | The ContentTypeEventArgs instance containing the event data. | 
OnContentTypeSaved(ContentType, ContentTypeEventArgs)
Raises the ContentTypeSaved event.
Declaration
protected virtual void OnContentTypeSaved(ContentType contentType, ContentTypeEventArgs args)Parameters
| Type | Name | Description | 
|---|---|---|
| ContentType | contentType | Type of the content. | 
| ContentTypeEventArgs | args | The ContentTypeEventArgs instance containing the event data. | 
Save(ContentType)
Saves the specified ContentType to the data repository.
Declaration
public abstract void Save(ContentType contentType)Parameters
| Type | Name | Description | 
|---|---|---|
| ContentType | contentType | Type content type to save. | 
Save(IEnumerable<ContentType>, ContentTypeSaveOptions)
NOTE: This is a pre-release API that is UNSTABLE and might not satisfy the compatibility requirements as denoted by its associated normal version. Save list of ContentType with respect to ContentTypeSaveOptions
Declaration
public virtual void Save(IEnumerable<ContentType> contentTypes, ContentTypeSaveOptions options)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<ContentType> | contentTypes | The content types. | 
| ContentTypeSaveOptions | options | The content type save options. | 
Events
ContentTypeDeleted
Occurs when a ContentType has been deleted.
Declaration
public static event EventHandler<ContentTypeEventArgs> ContentTypeDeletedEvent Type
| Type | Description | 
|---|---|
| System.EventHandler<ContentTypeEventArgs> | 
ContentTypeSaved
Occurs when a ContentType has been saved, i.e. created or updated.
Declaration
public static event EventHandler<ContentTypeEventArgs> ContentTypeSavedEvent Type
| Type | Description | 
|---|---|
| System.EventHandler<ContentTypeEventArgs> | 
