Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentTypeService

    Represents the ContentType Service, which is an easy access to operations involving IContentType

    Inheritance
    object
    RepositoryService
    ContentTypeServiceBase
    ContentTypeServiceBase<IContentTypeRepository, IContentType>
    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public class ContentTypeService : ContentTypeServiceBase<IContentTypeRepository, IContentType>, IContentTypeService, IContentTypeBaseService<IContentType>, IContentTypeBaseService, IService

    Constructors

    View Source

    ContentTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IContentService, IContentTypeRepository, IAuditRepository, IDocumentTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)

    Initializes a new instance of the ContentTypeService class.

    Declaration
    [Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
    public ContentTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IContentService contentService, IContentTypeRepository repository, IAuditRepository auditRepository, IDocumentTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider.

    ILoggerFactory loggerFactory

    The logger factory.

    IEventMessagesFactory eventMessagesFactory

    The event messages factory.

    IContentService contentService

    The content service.

    IContentTypeRepository repository

    The content type repository.

    IAuditRepository auditRepository

    The audit repository (obsolete).

    IDocumentTypeContainerRepository entityContainerRepository

    The document type container repository.

    IEntityRepository entityRepository

    The entity repository.

    IEventAggregator eventAggregator

    The event aggregator.

    IUserIdKeyResolver userIdKeyResolver

    The user ID key resolver.

    ContentTypeFilterCollection contentTypeFilters

    The content type filter collection.

    View Source

    ContentTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IContentService, IContentTypeRepository, IAuditRepository, IAuditService, IDocumentTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)

    Initializes a new instance of the ContentTypeService class.

    Declaration
    [Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
    public ContentTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IContentService contentService, IContentTypeRepository repository, IAuditRepository auditRepository, IAuditService auditService, IDocumentTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider.

    ILoggerFactory loggerFactory

    The logger factory.

    IEventMessagesFactory eventMessagesFactory

    The event messages factory.

    IContentService contentService

    The content service.

    IContentTypeRepository repository

    The content type repository.

    IAuditRepository auditRepository

    The audit repository (obsolete).

    IAuditService auditService

    The audit service.

    IDocumentTypeContainerRepository entityContainerRepository

    The document type container repository.

    IEntityRepository entityRepository

    The entity repository.

    IEventAggregator eventAggregator

    The event aggregator.

    IUserIdKeyResolver userIdKeyResolver

    The user ID key resolver.

    ContentTypeFilterCollection contentTypeFilters

    The content type filter collection.

    View Source

    ContentTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IContentService, IContentTypeRepository, IAuditRepository, IAuditService, IDocumentTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection, ITemplateService)

    Initializes a new instance of the ContentTypeService class.

    Declaration
    [Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
    public ContentTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IContentService contentService, IContentTypeRepository repository, IAuditRepository auditRepository, IAuditService auditService, IDocumentTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters, ITemplateService templateService)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider.

    ILoggerFactory loggerFactory

    The logger factory.

    IEventMessagesFactory eventMessagesFactory

    The event messages factory.

    IContentService contentService

    The content service.

    IContentTypeRepository repository

    The content type repository.

    IAuditRepository auditRepository

    The audit repository (obsolete).

    IAuditService auditService

    The audit service.

    IDocumentTypeContainerRepository entityContainerRepository

    The document type container repository.

    IEntityRepository entityRepository

    The entity repository.

    IEventAggregator eventAggregator

    The event aggregator.

    IUserIdKeyResolver userIdKeyResolver

    The user ID key resolver.

    ContentTypeFilterCollection contentTypeFilters

    The content type filter collection.

    ITemplateService templateService

    The template service.

    View Source

    ContentTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IContentService, IContentTypeRepository, IAuditService, IDocumentTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection)

    Initializes a new instance of the ContentTypeService class.

    Declaration
    [Obsolete("Use the non-obsolete constructor. Scheduled for removal in Umbraco 19.")]
    public ContentTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IContentService contentService, IContentTypeRepository repository, IAuditService auditService, IDocumentTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider.

    ILoggerFactory loggerFactory

    The logger factory.

    IEventMessagesFactory eventMessagesFactory

    The event messages factory.

    IContentService contentService

    The content service.

    IContentTypeRepository repository

    The content type repository.

    IAuditService auditService

    The audit service.

    IDocumentTypeContainerRepository entityContainerRepository

    The document type container repository.

    IEntityRepository entityRepository

    The entity repository.

    IEventAggregator eventAggregator

    The event aggregator.

    IUserIdKeyResolver userIdKeyResolver

    The user ID key resolver.

    ContentTypeFilterCollection contentTypeFilters

    The content type filter collection.

    View Source

    ContentTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IContentService, IContentTypeRepository, IAuditService, IDocumentTypeContainerRepository, IEntityRepository, IEventAggregator, IUserIdKeyResolver, ContentTypeFilterCollection, ITemplateService)

    Initializes a new instance of the ContentTypeService class.

    Declaration
    public ContentTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IContentService contentService, IContentTypeRepository repository, IAuditService auditService, IDocumentTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository, IEventAggregator eventAggregator, IUserIdKeyResolver userIdKeyResolver, ContentTypeFilterCollection contentTypeFilters, ITemplateService templateService)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider.

    ILoggerFactory loggerFactory

    The logger factory.

    IEventMessagesFactory eventMessagesFactory

    The event messages factory.

    IContentService contentService

    The content service.

    IContentTypeRepository repository

    The content type repository.

    IAuditService auditService

    The audit service.

    IDocumentTypeContainerRepository entityContainerRepository

    The document type container repository.

    IEntityRepository entityRepository

    The entity repository.

    IEventAggregator eventAggregator

    The event aggregator.

    IUserIdKeyResolver userIdKeyResolver

    The user ID key resolver.

    ContentTypeFilterCollection contentTypeFilters

    The content type filter collection.

    ITemplateService templateService

    The template service.

    Properties

    View Source

    ContainedObjectType

    Gets the object type GUID for content types contained by this service.

    Declaration
    protected override Guid ContainedObjectType { get; }
    Property Value
    Type Description
    Guid
    View Source

    ReadLockIds

    Gets the read lock IDs for this content type.

    Declaration
    protected override int[] ReadLockIds { get; }
    Property Value
    Type Description
    int[]
    View Source

    WriteLockIds

    Gets the write lock IDs for this content type.

    Declaration
    protected override int[] WriteLockIds { get; }
    Property Value
    Type Description
    int[]

    Methods

    View Source

    CreateTemplateAsync(Guid, string, string, bool, Guid)

    Creates a template for the given content type.

    Declaration
    public Task<Attempt<Guid?, ContentTypeOperationStatus>> CreateTemplateAsync(Guid contentTypeKey, string templateName, string templateAlias, bool isDefaultTemplate, Guid userKey)
    Parameters
    Type Name Description
    Guid contentTypeKey

    The content type key.

    string templateName

    The name of the template to create.

    string templateAlias

    The alias of the template to create.

    bool isDefaultTemplate

    Whether to set the template as the default template for the content type.

    Guid userKey

    The key of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<Guid?, ContentTypeOperationStatus>>

    An attempt containing the template's key if successful, or an error status if not.

    View Source

    DeleteItemsOfTypes(IEnumerable<int>)

    Deletes content items of the specified types.

    Declaration
    protected override void DeleteItemsOfTypes(IEnumerable<int> typeIds)
    Parameters
    Type Name Description
    IEnumerable<int> typeIds

    The type IDs whose content should be deleted.

    View Source

    GetAllContentTypeAliases(params Guid[])

    Gets all content type aliases across content, media and member types.

    Declaration
    public IEnumerable<string> GetAllContentTypeAliases(params Guid[] guids)
    Parameters
    Type Name Description
    Guid[] guids

    Optional object types guid to restrict to content, and/or media, and/or member types.

    Returns
    Type Description
    IEnumerable<string>

    All content type aliases.

    Remarks

    Beware! Works across content, media and member types.

    View Source

    GetAllContentTypeIds(string[])

    Gets all content type id for aliases across content, media and member types.

    Declaration
    public IEnumerable<int> GetAllContentTypeIds(string[] aliases)
    Parameters
    Type Name Description
    string[] aliases

    Aliases to look for.

    Returns
    Type Description
    IEnumerable<int>

    All content type ids.

    Remarks

    Beware! Works across content, media and member types.

    View Source

    GetAllPropertyTypeAliases()

    Gets all property type aliases across content, media and member types.

    Declaration
    public IEnumerable<string> GetAllPropertyTypeAliases()
    Returns
    Type Description
    IEnumerable<string>

    All property type aliases.

    Remarks

    Beware! Works across content, media and member types.

    View Source

    GetByQueryAsync(IQuery<IContentType>, CancellationToken)

    Gets content types by query.

    Declaration
    public Task<IEnumerable<IContentType>> GetByQueryAsync(IQuery<IContentType> query, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IQuery<IContentType> query

    The query to filter content types.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<IEnumerable<IContentType>>

    A collection of content types matching the query.

    View Source

    GetContentTypeChangedNotification(IEnumerable<ContentTypeChange<IContentType>>, EventMessages)

    Gets a content type changed notification.

    Declaration
    protected override ContentTypeChangeNotification<IContentType> GetContentTypeChangedNotification(IEnumerable<ContentTypeChange<IContentType>> changes, EventMessages eventMessages)
    Parameters
    Type Name Description
    IEnumerable<ContentTypeChange<IContentType>> changes

    The collection of content type changes.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    ContentTypeChangeNotification<IContentType>

    The content type changed notification.

    View Source

    GetContentTypeRefreshedNotification(IEnumerable<ContentTypeChange<IContentType>>, EventMessages)

    Gets a content type refreshed notification that is published within the transaction.

    Declaration
    protected override ContentTypeRefreshNotification<IContentType> GetContentTypeRefreshedNotification(IEnumerable<ContentTypeChange<IContentType>> changes, EventMessages eventMessages)
    Parameters
    Type Name Description
    IEnumerable<ContentTypeChange<IContentType>> changes

    The collection of content type changes.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    ContentTypeRefreshNotification<IContentType>

    The content type refreshed notification.

    Remarks

    This notification is identical to GetContentTypeChangedNotification, however it needs to be a different notification type because it's published within the transaction. The purpose of this notification being published within the transaction is so that listeners can perform database operations from within the same transaction and guarantee data consistency so that if anything goes wrong the entire transaction can be rolled back. This is used by Nucache.

    View Source

    GetDeletedNotification(IEnumerable<IContentType>, EventMessages)

    Gets a deleted notification for multiple content type items.

    Declaration
    protected override DeletedNotification<IContentType> GetDeletedNotification(IEnumerable<IContentType> items, EventMessages eventMessages)
    Parameters
    Type Name Description
    IEnumerable<IContentType> items

    The content type items that were deleted.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    DeletedNotification<IContentType>

    The deleted notification.

    View Source

    GetDeletingNotification(IEnumerable<IContentType>, EventMessages)

    Gets a deleting notification for multiple content type items.

    Declaration
    protected override DeletingNotification<IContentType> GetDeletingNotification(IEnumerable<IContentType> items, EventMessages eventMessages)
    Parameters
    Type Name Description
    IEnumerable<IContentType> items

    The content type items being deleted.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    DeletingNotification<IContentType>

    The deleting notification.

    View Source

    GetDeletingNotification(IContentType, EventMessages)

    Gets a deleting notification for a single content type item.

    Declaration
    protected override DeletingNotification<IContentType> GetDeletingNotification(IContentType item, EventMessages eventMessages)
    Parameters
    Type Name Description
    IContentType item

    The content type item being deleted.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    DeletingNotification<IContentType>

    The deleting notification.

    View Source

    GetMovedNotification(IEnumerable<MoveEventInfo<IContentType>>, EventMessages)

    Gets a moved notification for multiple content type items.

    Declaration
    protected override MovedNotification<IContentType> GetMovedNotification(IEnumerable<MoveEventInfo<IContentType>> moveInfo, EventMessages eventMessages)
    Parameters
    Type Name Description
    IEnumerable<MoveEventInfo<IContentType>> moveInfo

    The collection of move event information.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    MovedNotification<IContentType>

    The moved notification.

    View Source

    GetMovingNotification(MoveEventInfo<IContentType>, EventMessages)

    Gets a moving notification for a content type item.

    Declaration
    protected override MovingNotification<IContentType> GetMovingNotification(MoveEventInfo<IContentType> moveInfo, EventMessages eventMessages)
    Parameters
    Type Name Description
    MoveEventInfo<IContentType> moveInfo

    The move event information.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    MovingNotification<IContentType>

    The moving notification.

    View Source

    GetSavedNotification(IEnumerable<IContentType>, EventMessages)

    Gets a saved notification for multiple content type items.

    Declaration
    protected override SavedNotification<IContentType> GetSavedNotification(IEnumerable<IContentType> items, EventMessages eventMessages)
    Parameters
    Type Name Description
    IEnumerable<IContentType> items

    The content type items that were saved.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    SavedNotification<IContentType>

    The saved notification.

    View Source

    GetSavedNotification(IContentType, EventMessages)

    Gets a saved notification for a single content type item.

    Declaration
    protected override SavedNotification<IContentType> GetSavedNotification(IContentType item, EventMessages eventMessages)
    Parameters
    Type Name Description
    IContentType item

    The content type item that was saved.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    SavedNotification<IContentType>

    The saved notification.

    View Source

    GetSavingNotification(IEnumerable<IContentType>, EventMessages)

    Gets a saving notification for multiple content type items.

    Declaration
    protected override SavingNotification<IContentType> GetSavingNotification(IEnumerable<IContentType> items, EventMessages eventMessages)
    Parameters
    Type Name Description
    IEnumerable<IContentType> items

    The content type items being saved.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    SavingNotification<IContentType>

    The saving notification.

    View Source

    GetSavingNotification(IContentType, EventMessages)

    Gets a saving notification for a single content type item.

    Declaration
    protected override SavingNotification<IContentType> GetSavingNotification(IContentType item, EventMessages eventMessages)
    Parameters
    Type Name Description
    IContentType item

    The content type item being saved.

    EventMessages eventMessages

    The event messages.

    Returns
    Type Description
    SavingNotification<IContentType>

    The saving notification.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX