Search Results for

    Show / Hide Table of Contents
    View Source

    Class DomainService

    Provides services for managing domains (hostnames and culture assignments for content).

    Inheritance
    object
    RepositoryService
    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public class DomainService : RepositoryService, IDomainService, IService

    Constructors

    View Source

    DomainService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IDomainRepository, ILanguageService, IContentService)

    Initializes a new instance of the DomainService class.

    Declaration
    public DomainService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IDomainRepository domainRepository, ILanguageService languageService, IContentService contentService)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The core scope provider.

    ILoggerFactory loggerFactory

    The logger factory.

    IEventMessagesFactory eventMessagesFactory

    The event messages factory.

    IDomainRepository domainRepository

    The domain repository.

    ILanguageService languageService

    The language service.

    IContentService contentService

    The content service.

    Methods

    View Source

    Delete(IDomain)

    Deletes a domain.

    Declaration
    [Obsolete("Please use UpdateDomainsAsync. Scheduled for removal in Umbraco 18.")]
    public Attempt<OperationResult?> Delete(IDomain domain)
    Parameters
    Type Name Description
    IDomain domain

    The domain to delete.

    Returns
    Type Description
    Attempt<OperationResult>

    An attempt result indicating the success or failure of the operation.

    View Source

    Exists(string)

    Checks if a domain with the specified name exists.

    Declaration
    public bool Exists(string domainName)
    Parameters
    Type Name Description
    string domainName

    The domain name to check.

    Returns
    Type Description
    bool

    true if the domain exists; otherwise, false.

    View Source

    GetAll(bool)

    Gets all domains.

    Declaration
    [Obsolete("Please use GetAllAsync. Scheduled for removal in Umbraco 18.")]
    public IEnumerable<IDomain> GetAll(bool includeWildcards)
    Parameters
    Type Name Description
    bool includeWildcards

    A value indicating whether to include wildcard domains.

    Returns
    Type Description
    IEnumerable<IDomain>

    A collection of all domains.

    View Source

    GetAllAsync(bool)

    Gets all assigned domains.

    Declaration
    public Task<IEnumerable<IDomain>> GetAllAsync(bool includeWildcards)
    Parameters
    Type Name Description
    bool includeWildcards

    Whether to include wildcard domains.

    Returns
    Type Description
    Task<IEnumerable<IDomain>>

    A collection of all domains.

    View Source

    GetAssignedDomains(int, bool)

    Gets the domains assigned to a specific content item.

    Declaration
    [Obsolete("Please use GetAssignedDomainsAsync. Scheduled for removal in Umbraco 18.")]
    public IEnumerable<IDomain> GetAssignedDomains(int contentId, bool includeWildcards)
    Parameters
    Type Name Description
    int contentId

    The identifier of the content item.

    bool includeWildcards

    A value indicating whether to include wildcard domains.

    Returns
    Type Description
    IEnumerable<IDomain>

    A collection of domains assigned to the content item.

    View Source

    GetAssignedDomainsAsync(Guid, bool)

    Gets all assigned domains for a content item.

    Declaration
    public Task<IEnumerable<IDomain>> GetAssignedDomainsAsync(Guid contentKey, bool includeWildcards)
    Parameters
    Type Name Description
    Guid contentKey

    The unique identifier of the content item.

    bool includeWildcards

    Whether to include wildcard domains.

    Returns
    Type Description
    Task<IEnumerable<IDomain>>

    A collection of domains assigned to the content item.

    View Source

    GetById(int)

    Gets a domain by its identifier.

    Declaration
    public IDomain? GetById(int id)
    Parameters
    Type Name Description
    int id

    The domain identifier.

    Returns
    Type Description
    IDomain

    The domain, or null if not found.

    View Source

    GetByName(string)

    Gets a domain by its name.

    Declaration
    public IDomain? GetByName(string name)
    Parameters
    Type Name Description
    string name

    The domain name.

    Returns
    Type Description
    IDomain

    The domain, or null if not found.

    View Source

    Save(IDomain)

    Saves a domain.

    Declaration
    [Obsolete("Please use UpdateDomainsAsync. Scheduled for removal in Umbraco 18.")]
    public Attempt<OperationResult?> Save(IDomain domainEntity)
    Parameters
    Type Name Description
    IDomain domainEntity

    The domain entity to save.

    Returns
    Type Description
    Attempt<OperationResult>

    An attempt result indicating the success or failure of the operation.

    View Source

    Sort(IEnumerable<IDomain>)

    Sorts domains.

    Declaration
    [Obsolete("Please use UpdateDomainsAsync. Scheduled for removal in Umbraco 18.")]
    public Attempt<OperationResult?> Sort(IEnumerable<IDomain> items)
    Parameters
    Type Name Description
    IEnumerable<IDomain> items

    The domains to sort.

    Returns
    Type Description
    Attempt<OperationResult>

    An attempt result indicating the success or failure of the operation.

    View Source

    UpdateDomainsAsync(Guid, DomainsUpdateModel)

    Updates the domain assignments for a content item.

    Declaration
    public Task<Attempt<DomainUpdateResult, DomainOperationStatus>> UpdateDomainsAsync(Guid contentKey, DomainsUpdateModel updateModel)
    Parameters
    Type Name Description
    Guid contentKey

    The unique identifier of the content item.

    DomainsUpdateModel updateModel

    The domain assignments to apply.

    Returns
    Type Description
    Task<Attempt<DomainUpdateResult, DomainOperationStatus>>

    An attempt containing the update result or an error status.

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