Class DomainService
Provides services for managing domains (hostnames and culture assignments for content).
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public class DomainService : RepositoryService, IDomainService, IService
Constructors
View SourceDomainService(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 SourceExists(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 |
|
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. |
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. |
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 |
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 |
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. |