Search Results for

    Show / Hide Table of Contents
    View Source

    Class StylesheetService

    Provides services for managing CSS stylesheet files in Umbraco.

    Inheritance
    object
    RepositoryService
    FileServiceBase<IStylesheetRepository, IStylesheet>
    FileServiceOperationBase<IStylesheetRepository, IStylesheet, StylesheetOperationStatus>
    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public class StylesheetService : FileServiceOperationBase<IStylesheetRepository, IStylesheet, StylesheetOperationStatus>, IService, IStylesheetService, IBasicFileService<IStylesheet>
    Remarks

    This service handles CRUD operations for stylesheet files (.css) stored in the file system, including creating, updating, renaming, and deleting stylesheets.

    Constructors

    View Source

    StylesheetService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IStylesheetRepository, ILogger<StylesheetService>, IUserIdKeyResolver, IAuditRepository)

    Initializes a new instance of the StylesheetService class.

    Declaration
    [Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
    public StylesheetService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IStylesheetRepository repository, ILogger<StylesheetService> logger, IUserIdKeyResolver userIdKeyResolver, IAuditRepository auditRepository)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider for managing database transactions.

    ILoggerFactory loggerFactory

    The factory for creating loggers.

    IEventMessagesFactory eventMessagesFactory

    The factory for creating event messages.

    IStylesheetRepository repository

    The repository for stylesheet file operations.

    ILogger<StylesheetService> logger

    The logger instance for logging operations.

    IUserIdKeyResolver userIdKeyResolver

    The resolver for converting user keys to IDs.

    IAuditRepository auditRepository

    The repository for audit logging (obsolete).

    View Source

    StylesheetService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IStylesheetRepository, ILogger<StylesheetService>, IUserIdKeyResolver, IAuditService)

    Initializes a new instance of the StylesheetService class.

    Declaration
    public StylesheetService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IStylesheetRepository repository, ILogger<StylesheetService> logger, IUserIdKeyResolver userIdKeyResolver, IAuditService auditService)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider for managing database transactions.

    ILoggerFactory loggerFactory

    The factory for creating loggers.

    IEventMessagesFactory eventMessagesFactory

    The factory for creating event messages.

    IStylesheetRepository repository

    The repository for stylesheet file operations.

    ILogger<StylesheetService> logger

    The logger instance for logging operations.

    IUserIdKeyResolver userIdKeyResolver

    The resolver for converting user keys to IDs.

    IAuditService auditService

    The service for audit logging.

    View Source

    StylesheetService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IStylesheetRepository, ILogger<StylesheetService>, IUserIdKeyResolver, IAuditService, IAuditRepository)

    Initializes a new instance of the StylesheetService class.

    Declaration
    [Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
    public StylesheetService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IStylesheetRepository repository, ILogger<StylesheetService> logger, IUserIdKeyResolver userIdKeyResolver, IAuditService auditService, IAuditRepository auditRepository)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider for managing database transactions.

    ILoggerFactory loggerFactory

    The factory for creating loggers.

    IEventMessagesFactory eventMessagesFactory

    The factory for creating event messages.

    IStylesheetRepository repository

    The repository for stylesheet file operations.

    ILogger<StylesheetService> logger

    The logger instance for logging operations.

    IUserIdKeyResolver userIdKeyResolver

    The resolver for converting user keys to IDs.

    IAuditService auditService

    The service for audit logging.

    IAuditRepository auditRepository

    The repository for audit logging (obsolete).

    Properties

    View Source

    AllowedFileExtensions

    Gets the allowed file extensions for this file type.

    Declaration
    protected override string[] AllowedFileExtensions { get; }
    Property Value
    Type Description
    string[]
    View Source

    AlreadyExists

    Gets the operation status value representing an entity that already exists.

    Declaration
    protected override StylesheetOperationStatus AlreadyExists { get; }
    Property Value
    Type Description
    StylesheetOperationStatus
    View Source

    CancelledByNotification

    Gets the operation status value representing a cancellation by notification handler.

    Declaration
    protected override StylesheetOperationStatus CancelledByNotification { get; }
    Property Value
    Type Description
    StylesheetOperationStatus
    View Source

    EntityType

    Gets the entity type name used for audit logging.

    Declaration
    protected override string EntityType { get; }
    Property Value
    Type Description
    string
    View Source

    InvalidFileExtension

    Gets the operation status value representing an invalid file extension.

    Declaration
    protected override StylesheetOperationStatus InvalidFileExtension { get; }
    Property Value
    Type Description
    StylesheetOperationStatus
    View Source

    InvalidName

    Gets the operation status value representing an invalid file name.

    Declaration
    protected override StylesheetOperationStatus InvalidName { get; }
    Property Value
    Type Description
    StylesheetOperationStatus
    View Source

    NotFound

    Gets the operation status value representing an entity not found condition.

    Declaration
    protected override StylesheetOperationStatus NotFound { get; }
    Property Value
    Type Description
    StylesheetOperationStatus
    View Source

    ParentNotFound

    Gets the operation status value representing a parent folder not found condition.

    Declaration
    protected override StylesheetOperationStatus ParentNotFound { get; }
    Property Value
    Type Description
    StylesheetOperationStatus
    View Source

    PathTooLong

    Gets the operation status value representing a path that exceeds maximum length.

    Declaration
    protected override StylesheetOperationStatus PathTooLong { get; }
    Property Value
    Type Description
    StylesheetOperationStatus
    View Source

    Success

    Gets the operation status value representing a successful operation.

    Declaration
    protected override StylesheetOperationStatus Success { get; }
    Property Value
    Type Description
    StylesheetOperationStatus

    Methods

    View Source

    CreateAsync(StylesheetCreateModel, Guid)

    Creates a new stylesheet.

    Declaration
    public Task<Attempt<IStylesheet?, StylesheetOperationStatus>> CreateAsync(StylesheetCreateModel createModel, Guid userKey)
    Parameters
    Type Name Description
    StylesheetCreateModel createModel

    StylesheetCreateModel containing the information about the stylesheet being created.

    Guid userKey

    The key of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<IStylesheet, StylesheetOperationStatus>>

    An attempt indicating if the operation was a success as well as a more detailed StylesheetOperationStatus.

    View Source

    CreateEntity(string, string?)

    Creates a new entity instance with the specified path and content.

    Declaration
    protected override IStylesheet CreateEntity(string path, string? content)
    Parameters
    Type Name Description
    string path

    The file path for the entity.

    string content

    The optional content of the file.

    Returns
    Type Description
    IStylesheet

    A new entity instance.

    View Source

    DeleteAsync(string, Guid)

    Deletes a stylesheet.

    Declaration
    public Task<StylesheetOperationStatus> DeleteAsync(string path, Guid userKey)
    Parameters
    Type Name Description
    string path

    The path of the stylesheet to delete.

    Guid userKey

    The key of the user performing the operation.

    Returns
    Type Description
    Task<StylesheetOperationStatus>

    An operation status.

    View Source

    DeletedNotification(IStylesheet, EventMessages)

    Creates a deleted notification for the specified entity.

    Declaration
    protected override StylesheetDeletedNotification DeletedNotification(IStylesheet target, EventMessages messages)
    Parameters
    Type Name Description
    IStylesheet target

    The entity that was deleted.

    EventMessages messages

    The event messages to include.

    Returns
    Type Description
    StylesheetDeletedNotification

    A deleted notification instance.

    View Source

    DeletingNotification(IStylesheet, EventMessages)

    Creates a deleting notification for the specified entity.

    Declaration
    protected override StylesheetDeletingNotification DeletingNotification(IStylesheet target, EventMessages messages)
    Parameters
    Type Name Description
    IStylesheet target

    The entity being deleted.

    EventMessages messages

    The event messages to include.

    Returns
    Type Description
    StylesheetDeletingNotification

    A deleting notification instance.

    View Source

    RenameAsync(string, StylesheetRenameModel, Guid)

    Renames a stylesheet.

    Declaration
    public Task<Attempt<IStylesheet?, StylesheetOperationStatus>> RenameAsync(string path, StylesheetRenameModel renameModel, Guid userKey)
    Parameters
    Type Name Description
    string path

    The path of the stylesheet to rename.

    StylesheetRenameModel renameModel

    A StylesheetRenameModel with the changes.

    Guid userKey

    The key of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<IStylesheet, StylesheetOperationStatus>>

    An attempt indicating if the operation was a success as well as a more detailed StylesheetOperationStatus.

    View Source

    SavedNotification(IStylesheet, EventMessages)

    Creates a saved notification for the specified entity.

    Declaration
    protected override StylesheetSavedNotification SavedNotification(IStylesheet target, EventMessages messages)
    Parameters
    Type Name Description
    IStylesheet target

    The entity that was saved.

    EventMessages messages

    The event messages to include.

    Returns
    Type Description
    StylesheetSavedNotification

    A saved notification instance.

    View Source

    SavingNotification(IStylesheet, EventMessages)

    Creates a saving notification for the specified entity.

    Declaration
    protected override StylesheetSavingNotification SavingNotification(IStylesheet target, EventMessages messages)
    Parameters
    Type Name Description
    IStylesheet target

    The entity being saved.

    EventMessages messages

    The event messages to include.

    Returns
    Type Description
    StylesheetSavingNotification

    A saving notification instance.

    View Source

    UpdateAsync(string, StylesheetUpdateModel, Guid)

    Updates an existing stylesheet.

    Declaration
    public Task<Attempt<IStylesheet?, StylesheetOperationStatus>> UpdateAsync(string path, StylesheetUpdateModel updateModel, Guid userKey)
    Parameters
    Type Name Description
    string path

    The path of the stylesheet to update.

    StylesheetUpdateModel updateModel

    A StylesheetUpdateModel with the changes.

    Guid userKey

    The key of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<IStylesheet, StylesheetOperationStatus>>

    An attempt indicating if the operation was a success as well as a more detailed StylesheetOperationStatus.

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