Class ContentTypeService
Represents the ContentType Service, which is an easy access to operations involving IContentType
Inheritance
System.Object
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public class ContentTypeService : ContentTypeServiceBase, IContentTypeService, IService
Constructors
ContentTypeService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IContentService, IMediaService)
Declaration
public ContentTypeService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IContentService contentService, IMediaService mediaService)
Parameters
Methods
Copy(IContentType, String, String, Int32)
Copies a content type as a child under the specified parent if specified (otherwise to the root)
Declaration
public IContentType Copy(IContentType original, string alias, string name, int parentId = -1)
Parameters
Type |
Name |
Description |
IContentType |
original |
The content type to copy
|
System.String |
alias |
The new alias of the content type
|
System.String |
name |
The new name of the content type
|
System.Int32 |
parentId |
The parent to copy the content type to, default is -1 (root)
|
Returns
Copy(IContentType, String, String, IContentType)
Copies a content type as a child under the specified parent if specified (otherwise to the root)
Declaration
public IContentType Copy(IContentType original, string alias, string name, IContentType parent)
Parameters
Type |
Name |
Description |
IContentType |
original |
The content type to copy
|
System.String |
alias |
The new alias of the content type
|
System.String |
name |
The new name of the content type
|
IContentType |
parent |
The parent to copy the content type to, default is null (root)
|
Returns
CopyContentType(IContentType, Int32)
Declaration
public Attempt<OperationStatus<IContentType, MoveOperationStatusType>> CopyContentType(IContentType toCopy, int containerId)
Parameters
Type |
Name |
Description |
IContentType |
toCopy |
|
System.Int32 |
containerId |
|
Returns
CopyMediaType(IMediaType, Int32)
Declaration
public Attempt<OperationStatus<IMediaType, MoveOperationStatusType>> CopyMediaType(IMediaType toCopy, int containerId)
Parameters
Type |
Name |
Description |
IMediaType |
toCopy |
|
System.Int32 |
containerId |
|
Returns
CountContentTypes()
Declaration
public int CountContentTypes()
Returns
Type |
Description |
System.Int32 |
|
CountMediaTypes()
Declaration
public int CountMediaTypes()
Returns
Type |
Description |
System.Int32 |
|
CreateContentTypeContainer(Int32, String, Int32)
Declaration
public Attempt<OperationStatus<EntityContainer, OperationStatusType>> CreateContentTypeContainer(int parentId, string name, int userId = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
parentId |
|
System.String |
name |
|
System.Int32 |
userId |
|
Returns
CreateMediaTypeContainer(Int32, String, Int32)
Declaration
public Attempt<OperationStatus<EntityContainer, OperationStatusType>> CreateMediaTypeContainer(int parentId, string name, int userId = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
parentId |
|
System.String |
name |
|
System.Int32 |
userId |
|
Returns
Delete(IEnumerable<IContentType>, Int32)
Declaration
public void Delete(IEnumerable<IContentType> contentTypes, int userId = 0)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<IContentType> |
contentTypes |
Collection of IContentType to delete
|
System.Int32 |
userId |
Optional id of the user issueing the delete
|
Delete(IEnumerable<IMediaType>, Int32)
Declaration
public void Delete(IEnumerable<IMediaType> mediaTypes, int userId = 0)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<IMediaType> |
mediaTypes |
Collection of IMediaType to delete
|
System.Int32 |
userId |
|
Delete(IContentType, Int32)
Declaration
public void Delete(IContentType contentType, int userId = 0)
Parameters
Type |
Name |
Description |
IContentType |
contentType |
IContentType to delete
|
System.Int32 |
userId |
Optional id of the user issueing the delete
|
Delete(IMediaType, Int32)
Declaration
public void Delete(IMediaType mediaType, int userId = 0)
Parameters
Type |
Name |
Description |
IMediaType |
mediaType |
IMediaType to delete
|
System.Int32 |
userId |
Optional Id of the user deleting the MediaType
|
DeleteContentTypeContainer(Int32, Int32)
Declaration
public Attempt<OperationStatus> DeleteContentTypeContainer(int containerId, int userId = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
containerId |
|
System.Int32 |
userId |
|
Returns
DeleteMediaTypeContainer(Int32, Int32)
Declaration
public Attempt<OperationStatus> DeleteMediaTypeContainer(int containerId, int userId = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
containerId |
|
System.Int32 |
userId |
|
Returns
GetAllContentTypeAliases(Guid[])
Gets all content type aliases
Declaration
public IEnumerable<string> GetAllContentTypeAliases(params Guid[] objectTypes)
Parameters
Type |
Name |
Description |
System.Guid[] |
objectTypes |
If this list is empty, it will return all content type aliases for media, members and content, otherwise
it will only return content type aliases for the object types specified
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
GetAllContentTypeIds(String[])
Declaration
public IEnumerable<int> GetAllContentTypeIds(string[] aliases)
Parameters
Type |
Name |
Description |
System.String[] |
aliases |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
|
GetAllContentTypes(IEnumerable<Guid>)
Declaration
public IEnumerable<IContentType> GetAllContentTypes(IEnumerable<Guid> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Guid> |
ids |
Optional list of ids
|
Returns
GetAllContentTypes(Int32[])
Declaration
public IEnumerable<IContentType> GetAllContentTypes(params int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
Optional list of ids
|
Returns
GetAllMediaTypes(IEnumerable<Guid>)
Declaration
public IEnumerable<IMediaType> GetAllMediaTypes(IEnumerable<Guid> ids)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Guid> |
ids |
Optional list of ids
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IMediaType> |
An Enumerable list of IMediaType objects
|
GetAllMediaTypes(Int32[])
Declaration
public IEnumerable<IMediaType> GetAllMediaTypes(params int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
Optional list of ids
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IMediaType> |
An Enumerable list of IMediaType objects
|
GetAllPropertyTypeAliases()
Gets all property type aliases.
Declaration
public IEnumerable<string> GetAllPropertyTypeAliases()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
GetContentType(Guid)
Declaration
public IContentType GetContentType(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
Alias of the IContentType to retrieve
|
Returns
GetContentType(Int32)
Declaration
public IContentType GetContentType(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Id of the IContentType to retrieve
|
Returns
GetContentType(String)
Declaration
public IContentType GetContentType(string alias)
Parameters
Type |
Name |
Description |
System.String |
alias |
Alias of the IContentType to retrieve
|
Returns
GetContentTypeChildren(Guid)
Declaration
public IEnumerable<IContentType> GetContentTypeChildren(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
Id of the Parent
|
Returns
GetContentTypeChildren(Int32)
Declaration
public IEnumerable<IContentType> GetContentTypeChildren(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Id of the Parent
|
Returns
GetContentTypeContainer(Guid)
Declaration
public EntityContainer GetContentTypeContainer(Guid containerId)
Parameters
Type |
Name |
Description |
System.Guid |
containerId |
|
Returns
GetContentTypeContainer(Int32)
Declaration
public EntityContainer GetContentTypeContainer(int containerId)
Parameters
Type |
Name |
Description |
System.Int32 |
containerId |
|
Returns
GetContentTypeContainers(Int32[])
Declaration
public IEnumerable<EntityContainer> GetContentTypeContainers(int[] containerIds)
Parameters
Type |
Name |
Description |
System.Int32[] |
containerIds |
|
Returns
GetContentTypeContainers(String, Int32)
Declaration
public IEnumerable<EntityContainer> GetContentTypeContainers(string name, int level)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
level |
|
Returns
GetContentTypeContainers(IContentType)
Declaration
public IEnumerable<EntityContainer> GetContentTypeContainers(IContentType contentType)
Parameters
Returns
GetContentTypesDtd()
Generates the complete XML DTD without the root.
Declaration
public string GetContentTypesDtd()
Returns
Type |
Description |
System.String |
The DTD as a string
|
GetDescendants(IContentType)
Declaration
public IEnumerable<IContentType> GetDescendants(IContentType contentType)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IContentType> |
|
GetDescendants(IContentTypeBase)
Declaration
public override IEnumerable<IContentTypeBase> GetDescendants(IContentTypeBase contentType)
Parameters
Returns
GetDescendants(IMediaType)
Declaration
public IEnumerable<IMediaType> GetDescendants(IMediaType contentType)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IMediaType> |
|
GetDtd()
Generates the complete (simplified) XML DTD.
Declaration
Returns
Type |
Description |
System.String |
The DTD as a string
|
GetMediaType(Guid)
Declaration
public IMediaType GetMediaType(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
Id of the IMediaType to retrieve
|
Returns
GetMediaType(Int32)
Declaration
public IMediaType GetMediaType(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Id of the IMediaType to retrieve
|
Returns
GetMediaType(String)
Declaration
public IMediaType GetMediaType(string alias)
Parameters
Type |
Name |
Description |
System.String |
alias |
Alias of the IMediaType to retrieve
|
Returns
GetMediaTypeChildren(Guid)
Declaration
public IEnumerable<IMediaType> GetMediaTypeChildren(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
Id of the Parent
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IMediaType> |
An Enumerable list of IMediaType objects
|
GetMediaTypeChildren(Int32)
Declaration
public IEnumerable<IMediaType> GetMediaTypeChildren(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Id of the Parent
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IMediaType> |
An Enumerable list of IMediaType objects
|
GetMediaTypeContainer(Guid)
Declaration
public EntityContainer GetMediaTypeContainer(Guid containerId)
Parameters
Type |
Name |
Description |
System.Guid |
containerId |
|
Returns
GetMediaTypeContainer(Int32)
Declaration
public EntityContainer GetMediaTypeContainer(int containerId)
Parameters
Type |
Name |
Description |
System.Int32 |
containerId |
|
Returns
GetMediaTypeContainers(Int32[])
Declaration
public IEnumerable<EntityContainer> GetMediaTypeContainers(int[] containerIds)
Parameters
Type |
Name |
Description |
System.Int32[] |
containerIds |
|
Returns
GetMediaTypeContainers(String, Int32)
Declaration
public IEnumerable<EntityContainer> GetMediaTypeContainers(string name, int level)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
level |
|
Returns
GetMediaTypeContainers(IMediaType)
Declaration
public IEnumerable<EntityContainer> GetMediaTypeContainers(IMediaType mediaType)
Parameters
Returns
HasChildren(Guid)
Declaration
public bool HasChildren(Guid id)
Parameters
Returns
Type |
Description |
System.Boolean |
True if the content type has any children otherwise False
|
HasChildren(Int32)
Declaration
public bool HasChildren(int id)
Parameters
Returns
Type |
Description |
System.Boolean |
True if the content type has any children otherwise False
|
MediaTypeHasChildren(Guid)
Declaration
public bool MediaTypeHasChildren(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
Id of the IMediaType
|
Returns
Type |
Description |
System.Boolean |
True if the media type has any children otherwise False
|
MediaTypeHasChildren(Int32)
Declaration
public bool MediaTypeHasChildren(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Id of the IMediaType
|
Returns
Type |
Description |
System.Boolean |
True if the media type has any children otherwise False
|
MoveContentType(IContentType, Int32)
Declaration
public Attempt<OperationStatus<MoveOperationStatusType>> MoveContentType(IContentType toMove, int containerId)
Parameters
Type |
Name |
Description |
IContentType |
toMove |
|
System.Int32 |
containerId |
|
Returns
MoveMediaType(IMediaType, Int32)
Declaration
public Attempt<OperationStatus<MoveOperationStatusType>> MoveMediaType(IMediaType toMove, int containerId)
Parameters
Type |
Name |
Description |
IMediaType |
toMove |
|
System.Int32 |
containerId |
|
Returns
RenameContentTypeContainer(Int32, String, Int32)
Declaration
public Attempt<OperationStatus<EntityContainer, OperationStatusType>> RenameContentTypeContainer(int id, string name, int userId = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.String |
name |
|
System.Int32 |
userId |
|
Returns
RenameDataTypeContainer(Int32, String, Int32)
Declaration
public Attempt<OperationStatus<EntityContainer, OperationStatusType>> RenameDataTypeContainer(int id, string name, int userId = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.String |
name |
|
System.Int32 |
userId |
|
Returns
RenameMediaTypeContainer(Int32, String, Int32)
Declaration
public Attempt<OperationStatus<EntityContainer, OperationStatusType>> RenameMediaTypeContainer(int id, string name, int userId = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.String |
name |
|
System.Int32 |
userId |
|
Returns
Save(IEnumerable<IContentType>, Int32)
Declaration
public void Save(IEnumerable<IContentType> contentTypes, int userId = 0)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<IContentType> |
contentTypes |
Collection of IContentType to save
|
System.Int32 |
userId |
Optional id of the user saving the ContentType
|
Save(IEnumerable<IMediaType>, Int32)
Declaration
public void Save(IEnumerable<IMediaType> mediaTypes, int userId = 0)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<IMediaType> |
mediaTypes |
Collection of IMediaType to save
|
System.Int32 |
userId |
Optional Id of the user savging the MediaTypes
|
Save(IContentType, Int32)
Declaration
public void Save(IContentType contentType, int userId = 0)
Parameters
Type |
Name |
Description |
IContentType |
contentType |
IContentType to save
|
System.Int32 |
userId |
Optional id of the user saving the ContentType
|
Save(IMediaType, Int32)
Declaration
public void Save(IMediaType mediaType, int userId = 0)
Parameters
Type |
Name |
Description |
IMediaType |
mediaType |
IMediaType to save
|
System.Int32 |
userId |
Optional Id of the user saving the MediaType
|
SaveContentTypeContainer(EntityContainer, Int32)
Declaration
public Attempt<OperationStatus> SaveContentTypeContainer(EntityContainer container, int userId = 0)
Parameters
Returns
SaveMediaTypeContainer(EntityContainer, Int32)
Declaration
public Attempt<OperationStatus> SaveMediaTypeContainer(EntityContainer container, int userId = 0)
Parameters
Returns
ValidateComposition(IContentTypeComposition)
Validates the composition, if its invalid a list of property type aliases that were duplicated is returned
Declaration
public Attempt<string[]> ValidateComposition(IContentTypeComposition compo)
Parameters
Returns
Type |
Description |
Attempt<System.String[]> |
|
ValidateLocked(IContentTypeComposition)
Declaration
protected void ValidateLocked(IContentTypeComposition compositionContentType)
Parameters
Events
DeletedContentType
Declaration
public static event TypedEventHandler<IContentTypeService, DeleteEventArgs<IContentType>> DeletedContentType
Event Type
DeletedContentTypeContainer
Declaration
public static event TypedEventHandler<IContentTypeService, DeleteEventArgs<EntityContainer>> DeletedContentTypeContainer
Event Type
DeletedMediaType
Declaration
public static event TypedEventHandler<IContentTypeService, DeleteEventArgs<IMediaType>> DeletedMediaType
Event Type
DeletedMediaTypeContainer
Declaration
public static event TypedEventHandler<IContentTypeService, DeleteEventArgs<EntityContainer>> DeletedMediaTypeContainer
Event Type
DeletingContentType
Declaration
public static event TypedEventHandler<IContentTypeService, DeleteEventArgs<IContentType>> DeletingContentType
Event Type
DeletingContentTypeContainer
Declaration
public static event TypedEventHandler<IContentTypeService, DeleteEventArgs<EntityContainer>> DeletingContentTypeContainer
Event Type
DeletingMediaType
Declaration
public static event TypedEventHandler<IContentTypeService, DeleteEventArgs<IMediaType>> DeletingMediaType
Event Type
DeletingMediaTypeContainer
Declaration
public static event TypedEventHandler<IContentTypeService, DeleteEventArgs<EntityContainer>> DeletingMediaTypeContainer
Event Type
MovedContentType
Declaration
public static event TypedEventHandler<IContentTypeService, MoveEventArgs<IContentType>> MovedContentType
Event Type
MovedMediaType
Declaration
public static event TypedEventHandler<IContentTypeService, MoveEventArgs<IMediaType>> MovedMediaType
Event Type
MovingContentType
Declaration
public static event TypedEventHandler<IContentTypeService, MoveEventArgs<IContentType>> MovingContentType
Event Type
MovingMediaType
Declaration
public static event TypedEventHandler<IContentTypeService, MoveEventArgs<IMediaType>> MovingMediaType
Event Type
SavedContentType
Declaration
public static event TypedEventHandler<IContentTypeService, SaveEventArgs<IContentType>> SavedContentType
Event Type
SavedContentTypeContainer
Declaration
public static event TypedEventHandler<IContentTypeService, SaveEventArgs<EntityContainer>> SavedContentTypeContainer
Event Type
SavedMediaType
Declaration
public static event TypedEventHandler<IContentTypeService, SaveEventArgs<IMediaType>> SavedMediaType
Event Type
SavedMediaTypeContainer
Declaration
public static event TypedEventHandler<IContentTypeService, SaveEventArgs<EntityContainer>> SavedMediaTypeContainer
Event Type
SavingContentType
Declaration
public static event TypedEventHandler<IContentTypeService, SaveEventArgs<IContentType>> SavingContentType
Event Type
SavingContentTypeContainer
Declaration
public static event TypedEventHandler<IContentTypeService, SaveEventArgs<EntityContainer>> SavingContentTypeContainer
Event Type
SavingMediaType
Declaration
public static event TypedEventHandler<IContentTypeService, SaveEventArgs<IMediaType>> SavingMediaType
Event Type
SavingMediaTypeContainer
Declaration
public static event TypedEventHandler<IContentTypeService, SaveEventArgs<EntityContainer>> SavingMediaTypeContainer
Event Type