Class NovaRazorValue
Represents a single NovaValue
Implements
Inherited Members
Namespace: Noxum.Nova.Razor.Model
Assembly: Noxum.Nova.Razor.Model.dll
Syntax
public sealed class NovaRazorValue : IReadOnlyList<NovaRazorValue>, IReadOnlyCollection<NovaRazorValue>, IEnumerable<NovaRazorValue>, IEnumerable
Properties
Attribute
Get the attribute as a NovaRazorObject
Declaration
public NovaRazorAttribute Attribute { get; }
Property Value
| Type | Description |
|---|---|
| NovaRazorAttribute |
Count
Get the number of values
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Index
Get the index of the value if this is a single value in a list of values
Declaration
public int? Index { get; }
Property Value
| Type | Description |
|---|---|
| int? |
IsMultiple
Return true if this is a multiple value, false otherwise
Declaration
public bool IsMultiple { get; }
Property Value
| Type | Description |
|---|---|
| bool |
this[int]
Gets the value at the specified position if this is a list of values. Return the value itself if this is a single value and index = 0.
Declaration
public NovaRazorValue this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the element to get. |
Property Value
| Type | Description |
|---|---|
| NovaRazorValue | The value at the specified index with an Index property set. |
Exceptions
| Type | Condition |
|---|---|
| IndexOutOfRangeException | If the index is out of range |
Key
The scoped attribute key of this value
Declaration
public ScopedAttributeKey Key { get; }
Property Value
| Type | Description |
|---|---|
| ScopedAttributeKey |
Language
Get the language as a NovaRazorObject
Declaration
public NovaRazorLanguage Language { get; }
Property Value
| Type | Description |
|---|---|
| NovaRazorLanguage | The language object or null, if the attribute is not language dependent |
Object
The object this value belongs to
Declaration
public NovaRazorObject Object { get; }
Property Value
| Type | Description |
|---|---|
| NovaRazorObject |
Type
The data type
Declaration
public NovaDataType Type { get; }
Property Value
| Type | Description |
|---|---|
| NovaDataType |
UnitOfMeasure
Get the unit of this scalar value.
Declaration
public NovaRazorUnit UnitOfMeasure { get; }
Property Value
| Type | Description |
|---|---|
| NovaRazorUnit | The per value unit or null, if the attribute has no unit defined, or if this is not a scalar value (Count != 1). |
Value
The wrapped value if this is a single value, null otherwise
Declaration
public object Value { get; }
Property Value
| Type | Description |
|---|---|
| object |
Variant
Get the variant as a NovaRazorObject
Declaration
public NovaRazorObject Variant { get; }
Property Value
| Type | Description |
|---|---|
| NovaRazorObject | The variant object or null, if the attribute is not variant dependent |
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetBinaryAsync()
Get the binary value in case of type Noxum.Nova.Data.NovaDataType.BinRef
Declaration
public Task<ReadOnlyMemory<byte>> GetBinaryAsync()
Returns
| Type | Description |
|---|---|
| Task<ReadOnlyMemory<byte>> | The binary data or null, if this value is not of type Noxum.Nova.Data.NovaDataType.BinRef |
GetBinaryMediaTypeAsync()
Get the media type in case of type Noxum.Nova.Data.NovaDataType.BinRef
Declaration
public Task<string> GetBinaryMediaTypeAsync()
Returns
| Type | Description |
|---|---|
| Task<string> | The media type or "application/octet-stream", if the media type cannot be detected or null, if this value is not of type Noxum.Nova.Data.NovaDataType.BinRef |
GetBinaryUrlAsync()
Get the binary URL
Declaration
public Task<string> GetBinaryUrlAsync()
Returns
| Type | Description |
|---|---|
| Task<string> | An Uri for the binary or null if this is not a binary value |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<NovaRazorValue> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<NovaRazorValue> | An enumerator that can be used to iterate through the collection. |
GetFormattedXmlAsync(string)
Get the formatted XML value in case of type Noxum.Nova.Data.NovaDataType.XmlRef
Declaration
public Task<string> GetFormattedXmlAsync(string indentChars = " ")
Parameters
| Type | Name | Description |
|---|---|---|
| string | indentChars | The characters used for indentation (default: two spaces) |
Returns
| Type | Description |
|---|---|
| Task<string> | The XML as a string or null, if this value is not of type Noxum.Nova.Data.NovaDataType.XmlRef |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
Overrides
GetHtmlAsync()
Get a value of type Simple HTML or Visual Document pre-rendered for the required output format.
Declaration
public Task<IHtmlContent> GetHtmlAsync()
Returns
| Type | Description |
|---|---|
| Task<IHtmlContent> | The HTML content or null, if this value is not of type "XmlRef.SimpleHtml" or "XmlRef.VisualDocument" |
GetHtmlAsync(string)
Get a value of type Simple HTML or Visual Document pre-rendered for the required output format.
Declaration
public Task<IHtmlContent> GetHtmlAsync(string mediaType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | mediaType | The media type of the required output format, e.g., "text/html" or "application/vnd.noxum.ipub" |
Returns
| Type | Description |
|---|---|
| Task<IHtmlContent> | The HTML content or null, if this value is not of type "XmlRef.SimpleHtml" or "XmlRef.VisualDocument" |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the media type is null. |
| ArgumentException | Thrown when the media type is not supported. |
GetObjectAsync()
Get the object in case of type Noxum.Nova.Data.NovaDataType.ObjRef
Declaration
public Task<NovaRazorObject> GetObjectAsync()
Returns
| Type | Description |
|---|---|
| Task<NovaRazorObject> | The referenced object or null, if this value is not of type Noxum.Nova.Data.NovaDataType.ObjRef |
GetObjectsAsync()
Get all objects in case of type Noxum.Nova.Data.NovaDataType.ObjRef
Declaration
public Task<IReadOnlyList<NovaRazorObject>> GetObjectsAsync()
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<NovaRazorObject>> | A list of referenced objects or null, if this value is not of type Noxum.Nova.Data.NovaDataType.ObjRef |
GetTextAsync()
Get the text value in case of type Noxum.Nova.Data.NovaDataType.TextRef
Declaration
public Task<string> GetTextAsync()
Returns
| Type | Description |
|---|---|
| Task<string> | The text as a string or null, if this value is not of type Noxum.Nova.Data.NovaDataType.TextRef |
GetUnitSymbol(string, ObjId)
Get the unit symbol of this scalar value
Declaration
public string GetUnitSymbol(string separator = null, ObjId langId = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | separator | The separator rendered as a prefix of the unit (default: null) |
| ObjId | langId | The language ID. If Zero (0) use the language of the value scope if any, or the current output language. |
Returns
| Type | Description |
|---|---|
| string | The unit as a string or null, if the attribute has no unit defined, or if this is not a scalar value (Count != 1). |
GetXmlAsync()
Get the XML value in case of type Noxum.Nova.Data.NovaDataType.XmlRef
Declaration
public Task<string> GetXmlAsync()
Returns
| Type | Description |
|---|---|
| Task<string> | The XML as a string or null, if this value is not of type Noxum.Nova.Data.NovaDataType.XmlRef |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string that represents the current object. |
Overrides
ToString(string, ObjId)
Format the value using a formatting string and a language
Declaration
public string ToString(string format = null, ObjId langId = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | format | The format string. If null, use the format setting of the attribute if any, or a default formatting. |
| ObjId | langId | The language ID. If Zero (0) use the language of the value scope if any, or the current output language. |
Returns
| Type | Description |
|---|---|
| string | A string representation if the value |
Operators
operator ==(NovaRazorValue, object)
Overload '==' to simplify comparison with primitive data types
Declaration
public static bool operator ==(NovaRazorValue v1, object v2)
Parameters
| Type | Name | Description |
|---|---|---|
| NovaRazorValue | v1 | |
| object | v2 |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(NovaRazorValue, object)
Overload '!=' to simplify comparison with primitive data types
Declaration
public static bool operator !=(NovaRazorValue v1, object v2)
Parameters
| Type | Name | Description |
|---|---|---|
| NovaRazorValue | v1 | |
| object | v2 |
Returns
| Type | Description |
|---|---|
| bool |