Class Portal
Represents a web portal that controls the mapping of types and themes within the site.
Portals allow to host differently-looking/behaving sites in the same web application
Inheritance
System.Object
Portal
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.Wave.dll
Syntax
public abstract class Portal : ApplicationComponent<PortalHub>, IDisposable, IApplicationComponent, INamed, IInstrumentable, IExternallyParameterized
Constructors
Portal(PortalHub, IConfigSectionNode)
Makes portal from config.
Due to the nature of Portal object there is no need to create other parametrized .ctors
Declaration
protected Portal(PortalHub portalHub, IConfigSectionNode conf)
Parameters
Fields
CONFIG_CONTENT_SECTION
Declaration
public const string CONFIG_CONTENT_SECTION = "content"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_DEFAULT_ATTR
Declaration
public const string CONFIG_DEFAULT_ATTR = "default"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_DESCR_ATTR
Declaration
public const string CONFIG_DESCR_ATTR = "description"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_DISPLAY_NAME_ATTR
Declaration
public const string CONFIG_DISPLAY_NAME_ATTR = "display-name"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_LOCALIZATION_SECTION
Declaration
public const string CONFIG_LOCALIZATION_SECTION = "localization"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_MSG_FILE_ATTR
Declaration
public const string CONFIG_MSG_FILE_ATTR = "msg-file"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_OFFLINE_ATTR
Declaration
public const string CONFIG_OFFLINE_ATTR = "offline"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_PARENT_NAME_ATTR
Declaration
public const string CONFIG_PARENT_NAME_ATTR = "parent-name"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_PRIMARY_ROOT_URI_ATTR
Declaration
public const string CONFIG_PRIMARY_ROOT_URI_ATTR = "primary-root-uri"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_RECORD_MODEL_SECTION
Declaration
public const string CONFIG_RECORD_MODEL_SECTION = "record-model-generator"
Field Value
| Type |
Description |
| System.String |
|
CONFIG_THEME_SECTION
Declaration
public const string CONFIG_THEME_SECTION = "theme"
Field Value
| Type |
Description |
| System.String |
|
LOC_ANY_FIELD_KEY
Declaration
public const string LOC_ANY_FIELD_KEY = "--ANY-FIELD--"
Field Value
| Type |
Description |
| System.String |
|
LOC_ANY_SCHEMA_KEY
Declaration
public const string LOC_ANY_SCHEMA_KEY = "--ANY-SCHEMA--"
Field Value
| Type |
Description |
| System.String |
|
Properties
ComponentLogTopic
Declaration
public override string ComponentLogTopic { get; }
Property Value
| Type |
Description |
| System.String |
|
Overrides
DefauISOCurrency
Returns default currency ISO code for this portal
Declaration
public abstract string DefauISOCurrency { get; }
Property Value
| Type |
Description |
| System.String |
|
Default
If true, matches this portal when no other suites
Declaration
[ExternalParameter(new string[]{"web"})]
public bool Default { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
DefaultISOCountry
Returns default country ISO code for this portal
Declaration
public abstract string DefaultISOCountry { get; }
Property Value
| Type |
Description |
| System.String |
|
DefaultLanguageISOCode
Returns default language ISO code for this portal
Declaration
public abstract string DefaultLanguageISOCode { get; }
Property Value
| Type |
Description |
| System.String |
|
DefaultTheme
Returns the default theme used
Declaration
public Theme DefaultTheme { get; }
Property Value
Description
English/primary language description
Declaration
public string Description { get; }
Property Value
| Type |
Description |
| System.String |
|
DisplayName
Primary site display name in primary language
Declaration
public string DisplayName { get; }
Property Value
| Type |
Description |
| System.String |
|
DumpLocalizationErrors
Set to true to capture the localization errors in log - used for development
Declaration
[Config]
[ExternalParameter(new string[]{"web", "log"})]
public bool DumpLocalizationErrors { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
ExternalParameters
Returns named parameters that can be used to control this component
Declaration
public virtual IEnumerable<KeyValuePair<string, Type>> ExternalParameters { get; }
Property Value
| Type |
Description |
| System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> |
|
InstrumentationEnabled
Implements IInstrumentable
Declaration
[Config(Default = false)]
[ExternalParameter(new string[]{"web", "instrumentation"})]
public bool InstrumentationEnabled { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
Name
Globally-unique portal name/ID
Declaration
public string Name { get; }
Property Value
| Type |
Description |
| System.String |
|
Offline
If true, does not get matched per request
Declaration
[ExternalParameter(new string[]{"web"})]
public bool Offline { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
Parent
Returns parent portal as identified by ParentName or null.
Makes sure that there is no cycle in portal derivation
Declaration
public Portal Parent { get; }
Property Value
ParentName
Points to the parent portal instance where some settings can be cloned (i.e. localization strings)
Declaration
public string ParentName { get; }
Property Value
| Type |
Description |
| System.String |
|
PrimaryRootUri
Primary root URL used to access this portal
Declaration
public Uri PrimaryRootUri { get; }
Property Value
| Type |
Description |
| System.Uri |
|
RecordModelGenerator
Returns record model generator that creates JSON for WV.JS library form server-supplied metadata
Declaration
public RecordModelGenerator RecordModelGenerator { get; }
Property Value
Themes
Themes that this portal supports
Declaration
public IRegistry<Theme> Themes { get; }
Property Value
Methods
Converts financial amount to string per portal
Declaration
public abstract string AmountToString(Amount amount, Portal.MoneyFormat format = Portal.MoneyFormat.WithCurrencySymbol, ISession session = null)
Parameters
Returns
| Type |
Description |
| System.String |
|
Converts financial amount in portals.default currency to string per portal
Declaration
public virtual string AmountToString(decimal amount, Portal.MoneyFormat format = Portal.MoneyFormat.WithCurrencySymbol, ISession session = null)
Parameters
Returns
| Type |
Description |
| System.String |
|
CountryISOCodeToLanguageISOCode(String)
Converts country code into language code per this portal
Declaration
public abstract string CountryISOCodeToLanguageISOCode(string countryISOCode)
Parameters
| Type |
Name |
Description |
| System.String |
countryISOCode |
|
Returns
| Type |
Description |
| System.String |
|
Converts datetime to string per portal
Declaration
public abstract string DateTimeToString(DateTime dt, Portal.DateTimeFormat format = Portal.DateTimeFormat.LongDateTime, ISession session = null)
Parameters
Returns
| Type |
Description |
| System.String |
|
Destructor()
Declaration
protected override void Destructor()
Overrides
DoLocalizeRecordModel(String, String, String, String)
Localizes record model schema:field:value
Declaration
protected virtual string DoLocalizeRecordModel(string schema, string field, string value, string isoLang)
Parameters
| Type |
Name |
Description |
| System.String |
schema |
|
| System.String |
field |
|
| System.String |
value |
|
| System.String |
isoLang |
|
Returns
| Type |
Description |
| System.String |
|
DoLookupLocalizationValue(String, String, String, String, out Boolean)
Declaration
protected virtual string DoLookupLocalizationValue(string isoLang, string schema, string field, string value, out bool exists)
Parameters
| Type |
Name |
Description |
| System.String |
isoLang |
|
| System.String |
schema |
|
| System.String |
field |
|
| System.String |
value |
|
| System.Boolean |
exists |
|
Returns
| Type |
Description |
| System.String |
|
ExternalGetParameter(String, out Object, String[])
Gets external parameter value returning true if parameter was found
Declaration
public virtual bool ExternalGetParameter(string name, out object value, params string[] groups)
Parameters
| Type |
Name |
Description |
| System.String |
name |
|
| System.Object |
value |
|
| System.String[] |
groups |
|
Returns
| Type |
Description |
| System.Boolean |
|
ExternalParametersForGroups(String[])
Returns named parameters that can be used to control this component
Declaration
public virtual IEnumerable<KeyValuePair<string, Type>> ExternalParametersForGroups(params string[] groups)
Parameters
| Type |
Name |
Description |
| System.String[] |
groups |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> |
|
ExternalSetParameter(String, Object, String[])
Sets external parameter value returning true if parameter was found and set
Declaration
public virtual bool ExternalSetParameter(string name, object value, params string[] groups)
Parameters
| Type |
Name |
Description |
| System.String |
name |
|
| System.Object |
value |
|
| System.String[] |
groups |
|
Returns
| Type |
Description |
| System.Boolean |
|
GetCMSContext(IFileSystemVersion)
Retrieves the CMS context that "sees" the particular CMS file system version.
The ICMSContext instance is disposable and should be released after the use
Declaration
public virtual ICMSContext GetCMSContext(IFileSystemVersion version = null)
Parameters
| Type |
Name |
Description |
| IFileSystemVersion |
version |
The version that the context "sees". Pass null for the latest approved version.
See PortalHub.Instance.CMS.Version*
|
Returns
GetLanguageISOCode(WorkContext)
Tries to determine session/work context lang and returns it or DefaultLanguageISOCode
Declaration
public virtual string GetLanguageISOCode(WorkContext work = null)
Parameters
Returns
| Type |
Description |
| System.String |
|
GetLocalizableContent()
Override to add localizable system content blocks.
Each block has a key of the form: 'keyname_isoLang'. I.e. {"mnuStart_deu", "Anfangen"}...
Declaration
protected abstract Dictionary<string, string> GetLocalizableContent()
Returns
| Type |
Description |
| System.Collections.Generic.Dictionary<System.String, System.String> |
|
ToString()
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
TranslateContent(String, String, WorkContext)
Translates the named content into desired language trying to infer language from work context/locality/session.
The search is first done in this portal then in inherited portals.
Returns an empty string if no translation is possible
Declaration
public virtual string TranslateContent(string contentKey, string isoLang = null, WorkContext work = null)
Parameters
| Type |
Name |
Description |
| System.String |
contentKey |
|
| System.String |
isoLang |
|
| WorkContext |
work |
|
Returns
| Type |
Description |
| System.String |
|
Implements
System.IDisposable
Extension Methods