Class TagContainer
Base class for classes exposing template tags.
Inheritance
Inherited Members
Namespace: SuperOffice.IO
Assembly: SoCore.dll
Syntax
public abstract class TagContainer
Constructors
TagContainer()
Base class for classes exposing template tags.
Declaration
protected TagContainer()
Fields
_bInitiated
State about the object has been initiated. Data (e.g. AddData(params object[])) can only be added before initiation. Call base.Init() to set this value to true.
Declaration
protected bool _bInitiated
Field Value
| Type | Description |
|---|---|
| bool |
Properties
CurrentUiCulture
Current UI culture, this is currently the language code used in template processing
Declaration
public string CurrentUiCulture { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Data
Retrieve data that can be used when
Declaration
protected object[] Data { get; }
Property Value
| Type | Description |
|---|---|
| object[] |
Methods
AddData(params object[])
Add data to be used when retrieving template variables. Use when you have (possibly unsaved) Entity objects that you wish to pass in.
Declaration
public virtual void AddData(params object[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | data | Data to be used when retrieving template variables. For instance, Entity objects |
Exceptions
| Type | Condition |
|---|---|
| SoIllegalOperationException | Thrown if data is added after it has been used (e.g. through GetValueAsync(string, CancellationToken)). |
ClearData()
Clear cached data
Declaration
public void ClearData()
GetData()
Get cached data objects
Declaration
public virtual object[] GetData()
Returns
| Type | Description |
|---|---|
| object[] | Array with all cached data objects |
GetIdAsync(CancellationToken)
Primary key of the
Declaration
public abstract Task<int> GetIdAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> |
GetTags()
Get list of tags in the current TagContainer.
Declaration
public string[] GetTags()
Returns
| Type | Description |
|---|---|
| string[] |
GetValueAsync(string, CancellationToken)
Get a value for a tag.
Declaration
public virtual Task<string> GetValueAsync(string tag, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tag | Name of the tag. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<string> | Value of the tag. An empty string (e.g. Empty) is returned if there is no valid value. |
InitAsync(CancellationToken)
Set the object in an initaited state. This means that no data can be added (e.g. AddData(params object[])) beyound this point.
Declaration
protected virtual Task InitAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
IsTagInContextAsync(string, CancellationToken)
Is this a valid tag in the given context. If there are no current sale, there are no valid tags for sale.
Declaration
public virtual Task<bool> IsTagInContextAsync(string tag, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tag | theName of the tag. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | True if tag is valid in hte given context. |
IsTagLegalAsync(string, CancellationToken)
Is this a legal tag?
Declaration
public virtual Task<bool> IsTagLegalAsync(string tag, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tag | Name of the tag. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | True is returned if this is a legal tag. |
RemoveCustomValue(string)
Remove an existing custom tag
Declaration
public void RemoveCustomValue(string tag)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tag |
SetValue(string, string)
Add a custom tag/value pair
Declaration
public void SetValue(string tag, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tag | Name of the tag |
| string | value | Value of the tag |