November Happy Hour will be moved to Thursday December 5th.

Class SiteDefinitionResolver

Resolves which SiteDefinition to use.

Inheritance
System.Object
SiteDefinitionResolver
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
[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 true then site matched with wildcard (if any) is returned

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 true then site matched with wildcard (if any) is returned

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 true and if content link is not under any site, use SiteDefinition mapped with Wildcard.

System.Boolean fallbackToEmpty

if set to true and if content link is not under any site, and not fallback to Wildcard use system default (StartPage and SiteUrl is not defined).

Returns
Type Description
SiteDefinition

A SiteDefinition instance for the site that contentLink belongs to.

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

Extension Methods