Class SiteDomainMapper
Provides utilities to handle site domains.
Inheritance
Namespace: Umbraco.Cms.Core.Routing
Assembly: Umbraco.Core.dll
Syntax
public class SiteDomainMapper : ISiteDomainMapper
Methods
View SourceAddSite(string, IEnumerable<string>)
Adds a site.
Declaration
public void AddSite(string key, IEnumerable<string> domains)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | A key uniquely identifying the site. |
| IEnumerable<string> | domains | The site domains. |
Remarks
At the moment there is no public way to remove a site. Clear and reconfigure.
AddSite(string, params string[])
Adds a site.
Declaration
public void AddSite(string key, params string[] domains)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | A key uniquely identifying the site. |
| string[] | domains | The site domains. |
Remarks
At the moment there is no public way to remove a site. Clear and reconfigure.
BindSites(params string[])
Binds some sites.
Declaration
public void BindSites(params string[] keys)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | keys | The keys uniquely identifying the sites to bind. |
Remarks
At the moment there is no public way to unbind sites. Clear and reconfigure.
If site1 is bound to site2 and site2 is bound to site3 then site1 is bound to site3.
Clear()
Clears the entire configuration.
Declaration
public void Clear()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
MapDomain(IReadOnlyCollection<DomainAndUri>, Uri, string?, string?)
Filters a list of DomainAndUri to pick one that best matches the current request.
Declaration
public virtual DomainAndUri? MapDomain(IReadOnlyCollection<DomainAndUri> domainAndUris, Uri current, string? culture, string? defaultCulture)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<DomainAndUri> | domainAndUris | The list of |
| Uri | current | The Uri of the current request. |
| string | culture | A culture. |
| string | defaultCulture | The default culture. |
Returns
| Type | Description |
|---|---|
| DomainAndUri | The selected |
Remarks
If the filter is invoked then domainAndUris is _not_ empty and
current is _not_ null, and current could not be
matched with anything in domainAndUris.
The culture may be null, but when non-null, it can be used
to help pick the best matches.
The filter _must_ return something else an exception will be thrown.
MapDomains(IReadOnlyCollection<DomainAndUri>, Uri, bool, string?, string?)
Filters a list of DomainAndUri to pick those that best matches the current request.
Declaration
public virtual IEnumerable<DomainAndUri> MapDomains(IReadOnlyCollection<DomainAndUri> domainAndUris, Uri current, bool excludeDefault, string? culture, string? defaultCulture)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<DomainAndUri> | domainAndUris | The list of |
| Uri | current | The Uri of the current request. |
| bool | excludeDefault | A value indicating whether to exclude the current/default domain. |
| string | culture | A culture. |
| string | defaultCulture | The default culture. |
Returns
| Type | Description |
|---|---|
| IEnumerable<DomainAndUri> | The selected |
Remarks
The filter must return something, even empty, else an exception will be thrown.
The culture may be null, but when non-null, it can be used
to help pick the best matches.