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

Class SiteDefinitionResolverExtensions

Extends ISiteDefinitionResolver with convenient methods

Inheritance
System.Object
SiteDefinitionResolverExtensions
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 12.0.3
Syntax
public static class SiteDefinitionResolverExtensions : Object

Methods

GetByContent(ISiteDefinitionResolver, ContentReference, Boolean, Boolean)

Gets the SiteDefinition for a content reference.

Declaration
public static SiteDefinition GetByContent(this ISiteDefinitionResolver siteDefinitionResolver, ContentReference contentLink, bool fallbackToWildcard, bool fallbackToEmpty)
Parameters
Type Name Description
ISiteDefinitionResolver siteDefinitionResolver

The site definition resolver that is being extended

ContentReference contentLink

The content link.

System.Boolean fallbackToWildcard

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 fallbackToWildcard 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.

GetByHostname(ISiteDefinitionResolver, String, Boolean)

Gets the SiteDefinition that has a host that matches specified hostname.

Declaration
public static SiteDefinition GetByHostname(this ISiteDefinitionResolver siteDefinitionResolver, string hostname, bool fallbackToWildcard)
Parameters
Type Name Description
ISiteDefinitionResolver siteDefinitionResolver

The site definition resolver that is being extended

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