Class SiteDefinitionResolver
Resolves which SiteDefinition to use.
Inheritance
Inherited Members
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 8.11.0Syntax
[ServiceConfiguration(typeof(SiteDefinitionResolver), Lifecycle = ServiceInstanceScope.Singleton)]
public class SiteDefinitionResolver
Constructors
SiteDefinitionResolver(IContentProviderManager, IObjectInstanceCache, AncestorReferencesLoader, SiteDefinitionRepository)
Initializes a new instance of the SiteDefinitionResolver class.
Declaration
public SiteDefinitionResolver(IContentProviderManager contentProviderManager, IObjectInstanceCache cache, AncestorReferencesLoader ancestorRequestCachedLoader, SiteDefinitionRepository siteDefinitionRepository)
Parameters
Type | Name | Description |
---|---|---|
IContentProviderManager | contentProviderManager | The content provider manager. |
IObjectInstanceCache | cache | The cache. |
AncestorReferencesLoader | ancestorRequestCachedLoader | The ancestor request cached loader. |
SiteDefinitionRepository | siteDefinitionRepository | The site definition repository. |
Methods
Get(HttpRequestBase)
Gets the SiteDefinition that has a host that matches specified request.
Declaration
public virtual SiteDefinition Get(HttpRequestBase request)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | request | The request. |
Returns
Type | Description |
---|---|
SiteDefinition |
GetByHostName(String, Boolean)
Gets the SiteDefinition that has a host that matches specified hostname.
Declaration
public virtual SiteDefinition GetByHostName(string hostName, bool fallbackToWildcard)
Parameters
Type | Name | Description |
---|---|---|
System.String | hostName | Name of the host. |
System.Boolean | fallbackToWildcard | if set to |
Returns
Type | Description |
---|---|
SiteDefinition |
GetByHostName(String, Boolean, out HostDefinition)
Gets the SiteDefinition that has a host that matches specified hostname.
Declaration
public virtual SiteDefinition GetByHostName(string hostName, bool fallbackToWildcard, out HostDefinition matchedHost)
Parameters
Type | Name | Description |
---|---|---|
System.String | hostName | Name of the host. |
System.Boolean | fallbackToWildcard | if set to |
HostDefinition | matchedHost | The HostDefinition on the site definition that matched the provided host name. |
Returns
Type | Description |
---|---|
SiteDefinition |
GetDefinitionForContent(ContentReference, Boolean, Boolean)
Gets the (Enterprise) SiteDefinition for a content.
Declaration
public virtual SiteDefinition GetDefinitionForContent(ContentReference contentLink, bool fallbackToWildcardMapped, bool fallbackToEmpty)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content link. |
System.Boolean | fallbackToWildcardMapped | if set to |
System.Boolean | fallbackToEmpty | if set to |
Returns
Type | Description |
---|---|
SiteDefinition | A SiteDefinition instance for the site that |
Remarks
This is done by traversing the page tree upwards from current link until a Page that matches a StartPage for a registered SiteDefinition.
If the contentLink
is not located beneath a start page, the search will fall back to the SiteDefinition instance
for the site mapped with * as host fallbackToWildcardMapped
is set to True. If the contentLink
is not located beneath a start page,
and if not fallen back to wildcard and fallbackToEmpty
is set to true then the system default setting will be returned which
has for example RootPage set but not site specific settings like StartPage and SiteUrl.
GetHostName(HttpRequestBase)
Gets the name of the host from the request
Declaration
[Obsolete("Use HttpRequestBase extension method HostName instead.")]
public virtual string GetHostName(HttpRequestBase request)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | request | The request. |
Returns
Type | Description |
---|---|
System.String |