Interface IDomainService
Provides services for managing domains (hostnames) assigned to content items.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IDomainService : IService
Remarks
Domains are used to configure multi-site setups where different hostnames route to different content nodes in the content tree.
Methods
View SourceExists(string)
Checks if a domain with the specified name exists.
Declaration
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
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
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
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
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
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. |