Class SiteDefinition
Holds settings for a site specific definitions like roots for files, blocks etc.
Inheritance
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 12.0.3Syntax
[EPiServerDataTable(TableName = "tblSystemBigTable")]
[EPiServerDataStore(AutomaticallyRemapStore = true)]
public class SiteDefinition : Object, IReadOnly<SiteDefinition>, IReadOnly
Constructors
SiteDefinition()
Declaration
public SiteDefinition()
Fields
SiteAssetsName
Get the name for the site specific assets folder
Declaration
public const string SiteAssetsName = "SysSiteAssets"
Field Value
Type | Description |
---|---|
System.String |
WildcardHostName
The wild card host name that is used to map unmapped hosts.
Declaration
public const string WildcardHostName = "*"
Field Value
Type | Description |
---|---|
System.String |
Properties
ContentAssetsRoot
Gets the reference for the root that holds content related assets.
Declaration
public virtual ContentReference ContentAssetsRoot { get; }
Property Value
Type | Description |
---|---|
ContentReference |
Current
The instance of SiteDefinition that matches the request. When no site is matched from request or wildcard mapping an empty instance is returned where System can be used to access settings that are not site specific.
Declaration
public static SiteDefinition Current { get; set; }
Property Value
Type | Description |
---|---|
SiteDefinition |
Remarks
During runtime it will get ISiteDefinitionResolver from IOC container and load settings for current site. If repository is not found in container (for example when executed in unit tests) the value will be an SiteDefinition instance with all roots set to EmptyReference
Empty
Gets an empty definition which can be used to access System settings.
Declaration
public static SiteDefinition Empty { get; }
Property Value
Type | Description |
---|---|
SiteDefinition |
Remarks
This is a singleton instance which can be compared against using object comparison.
GlobalAssetsRoot
Gets the reference for the global assets root.
Declaration
public virtual ContentReference GlobalAssetsRoot { get; }
Property Value
Type | Description |
---|---|
ContentReference |
Hosts
Gets or sets a list of hosts associated with this site.
Declaration
public virtual IList<HostDefinition> Hosts { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<HostDefinition> |
Id
Gets or sets a unique identifier of this site.
Declaration
public virtual Guid Id { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
IsReadOnly
Gets a value indicating whether this instance is read only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Item[String]
Gets or sets the setting of type System.Object that was registered with the specified key.
Declaration
public virtual object this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Property Value
Type | Description |
---|---|
System.Object | The custom settings object registered with the provided key. |
Remarks
Any custom settings should be set during initialization.
Name
Identity of site settings instance
Declaration
public virtual string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
RootPage
Gets the reference for the root page.
Declaration
public virtual ContentReference RootPage { get; }
Property Value
Type | Description |
---|---|
ContentReference |
Saved
Gets the date and time when this site instance was last saved.
Declaration
public virtual Nullable<DateTime> Saved { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
SavedBy
Gets the username of the user that most recently changed this site instance.
Declaration
public virtual string SavedBy { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
For instance, if a Windows account was used to create the instance, expect a string being returned looking like 'DOMAIN\User Name'.
SiteAssetsRoot
Gets or sets the assets root used by this site.
Declaration
public virtual ContentReference SiteAssetsRoot { get; set; }
Property Value
Type | Description |
---|---|
ContentReference |
Remarks
Setting the value to null means the site does not have a specific asset root meaning global asset root is used.
SiteUrl
Gets or sets the primary site URL.
Declaration
public virtual Uri SiteUrl { get; set; }
Property Value
Type | Description |
---|---|
System.Uri |
Remarks
The scheme, port and application path will also be used for all added hosts if not set explicitly.
StartPage
Gets or sets the start page of this site.
Declaration
public virtual ContentReference StartPage { get; set; }
Property Value
Type | Description |
---|---|
ContentReference |
WasteBasket
Gets the reference for the waste basket.
Declaration
public virtual ContentReference WasteBasket { get; }
Property Value
Type | Description |
---|---|
ContentReference |
Methods
CreateWritableClone()
Creates the writable clone.
Declaration
public virtual SiteDefinition CreateWritableClone()
Returns
Type | Description |
---|---|
SiteDefinition |
GetHost(String, Boolean)
Gets the HostDefinition from the Hosts property that matches the provided host name.
Declaration
public virtual HostDefinition GetHost(string hostName, bool fallbackToWildcard)
Parameters
Type | Name | Description |
---|---|---|
System.String | hostName | Name of the host to find. |
System.Boolean | fallbackToWildcard | if set to |
Returns
Type | Description |
---|---|
HostDefinition | The matching host if found; otherwise null. |
GetHosts(CultureInfo, Boolean)
Gets all hosts from the Hosts property that are mapped to the provided language.
Declaration
public virtual IEnumerable<HostDefinition> GetHosts(CultureInfo language, bool fallbackToUnmapped)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | language | The language to return hosts for |
System.Boolean | fallbackToUnmapped | if set to |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<HostDefinition> | All hosts mapped to the provided language |
GetPrimaryHost(CultureInfo)
Gets the primary host for the provided language.
Declaration
public virtual HostDefinition GetPrimaryHost(CultureInfo language)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | language | The language. |
Returns
Type | Description |
---|---|
HostDefinition | The definition for the host acting as the primary host for the provided language; or if non is found null |
Remarks
If no host has been explicitly defined, the first definition found for the provided language is returned. If no host has been defined for the provided language, null will be returned.
MakeReadOnly()
Makes the read only.
Declaration
public void MakeReadOnly()
ThrowIfReadOnly()
Throws an exception if the current instance is read-only.
Declaration
protected virtual void ThrowIfReadOnly()
Explicit Interface Implementations
IReadOnly.CreateWritableClone()
Creates the writable clone.
Declaration
object IReadOnly.CreateWritableClone()
Returns
Type | Description |
---|---|
System.Object |