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 SourceDelete(IDomain)
Deletes a domain.
Declaration
[Obsolete("Please use UpdateDomainsAsync. Scheduled for removal in Umbraco 18.")]
Attempt<OperationResult?> Delete(IDomain domain)
Parameters
| Type | Name | Description |
|---|---|---|
| IDomain | domain | The domain to delete. |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult> | An attempt containing the operation result. |
Exists(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 |
|
GetAll(bool)
Gets all domains.
Declaration
[Obsolete("Please use GetAllAsync. Scheduled for removal in Umbraco 18.")]
IEnumerable<IDomain> GetAll(bool includeWildcards)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | includeWildcards | Whether to include wildcard domains. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDomain> | A collection of domains. |
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. |
GetAssignedDomains(int, bool)
Gets all domains assigned to a content item.
Declaration
[Obsolete("Please use GetAssignedDomainsAsync. Scheduled for removal in Umbraco 18.")]
IEnumerable<IDomain> GetAssignedDomains(int contentId, bool includeWildcards)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contentId | The content item identifier. |
| bool | includeWildcards | Whether to include wildcard domains. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDomain> | A collection of domains assigned to the content item. |
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 |
Save(IDomain)
Saves a domain.
Declaration
[Obsolete("Please use UpdateDomainsAsync. Scheduled for removal in Umbraco 18.")]
Attempt<OperationResult?> Save(IDomain domainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| IDomain | domainEntity | The domain to save. |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult> | An attempt containing the operation result. |
Sort(IEnumerable<IDomain>)
Sorts a collection of domains.
Declaration
[Obsolete("Please use UpdateDomainsAsync. Scheduled for removal in Umbraco 18.")]
Attempt<OperationResult?> Sort(IEnumerable<IDomain> items)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IDomain> | items | The domains to sort. |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult> | An attempt containing the operation result. |
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. |