Show / Hide Table of Contents

Class ConfigSectionNode

Represents configuration section node. This class is thread safe

Inheritance
System.Object
ConfigNode
ConfigSectionNode
Implements
IConfigSectionNode
IConfigNode
INamed
Inherited Members
ConfigNode.m_Configuration
ConfigNode.m_Modified
ConfigNode.Configuration
ConfigNode.Exists
ConfigNode.Name
ConfigNode.VerbatimValue
ConfigNode.EvaluatedValue
ConfigNode.Value
ConfigNode.Parent
ConfigNode.IConfigNode.Parent
ConfigNode.IConfigNode.RootPath
ConfigNode.RootPath
ConfigNode.ValueAsString(String, Boolean)
ConfigNode.ValueAsByteArray(Byte[], Boolean)
ConfigNode.ValueAsIntArray(Int32[], Boolean)
ConfigNode.ValueAsLongArray(Int64[], Boolean)
ConfigNode.ValueAsFloatArray(Single[], Boolean)
ConfigNode.ValueAsDoubleArray(Double[], Boolean)
ConfigNode.ValueAsDecimalArray(Decimal[], Boolean)
ConfigNode.ValueAsShort(Int16, Boolean)
ConfigNode.ValueAsNullableShort(Nullable<Int16>, Boolean)
ConfigNode.ValueAsUShort(UInt16, Boolean)
ConfigNode.ValueAsNullableUShort(Nullable<UInt16>, Boolean)
ConfigNode.ValueAsByte(Byte, Boolean)
ConfigNode.ValueAsNullableByte(Nullable<Byte>, Boolean)
ConfigNode.ValueAsSByte(SByte, Boolean)
ConfigNode.ValueAsNullableSByte(Nullable<SByte>, Boolean)
ConfigNode.ValueAsInt(Int32, Boolean)
ConfigNode.ValueAsNullableInt(Nullable<Int32>, Boolean)
ConfigNode.ValueAsUInt(UInt32, Boolean)
ConfigNode.ValueAsNullableUInt(Nullable<UInt32>, Boolean)
ConfigNode.ValueAsLong(Int64, Boolean)
ConfigNode.ValueAsNullableLong(Nullable<Int64>, Boolean)
ConfigNode.ValueAsULong(UInt64, Boolean)
ConfigNode.ValueAsNullableULong(Nullable<UInt64>, Boolean)
ConfigNode.ValueAsDouble(Double, Boolean)
ConfigNode.ValueAsNullableDouble(Nullable<Double>, Boolean)
ConfigNode.ValueAsFloat(Single, Boolean)
ConfigNode.ValueAsNullableFloat(Nullable<Single>, Boolean)
ConfigNode.ValueAsDecimal(Decimal, Boolean)
ConfigNode.ValueAsNullableDecimal(Nullable<Decimal>, Boolean)
ConfigNode.ValueAsBool(Boolean, Boolean)
ConfigNode.ValueAsNullableBool(Nullable<Boolean>, Boolean)
ConfigNode.ValueAsGUID(Guid, Boolean)
ConfigNode.ValueAsNullableGUID(Nullable<Guid>, Boolean)
ConfigNode.ValueAsGDID(GDID, Boolean)
ConfigNode.ValueAsNullableGDID(Nullable<GDID>, Boolean)
ConfigNode.ValueAsDateTime(DateTime, Boolean)
ConfigNode.ValueAsNullableDateTime(Nullable<DateTime>, Boolean)
ConfigNode.ValueAsTimeSpan(TimeSpan, Boolean)
ConfigNode.ValueAsNullableTimeSpan(Nullable<TimeSpan>, Boolean)
ConfigNode.ValueAsEnum<TEnum>(TEnum, Boolean)
ConfigNode.ValueAsNullableEnum<TEnum>(Nullable<TEnum>, Boolean)
ConfigNode.ValueAsType(Type, Boolean, Boolean)
ConfigNode.IsSameName(IConfigNode)
ConfigNode.IsSameName(String)
ConfigNode.ToString()
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)
Namespace: NFX.Environment
Assembly: NFX.dll
Syntax
[Serializable]
public sealed class ConfigSectionNode : ConfigNode, IConfigSectionNode, IConfigNode, INamed

Properties

AttrCount

Returns number of child attribute nodes

Declaration
public int AttrCount { get; }
Property Value
Type Description
System.Int32

Attributes

Enumerates all attribute nodes

Declaration
public IEnumerable<ConfigAttrNode> Attributes { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ConfigAttrNode>

ChildCount

Returns number of child section nodes

Declaration
public int ChildCount { get; }
Property Value
Type Description
System.Int32

Children

Enumerates all child nodes

Declaration
public IEnumerable<ConfigSectionNode> Children { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ConfigSectionNode>

HasAttributes

Indicates whether this node has any associated attributes

Declaration
public bool HasAttributes { get; }
Property Value
Type Description
System.Boolean

HasChildren

Indicates whether this node has any child section nodes

Declaration
public bool HasChildren { get; }
Property Value
Type Description
System.Boolean

Item[Int32]

Retrieves section node by index or empty node instance if section node with such index could not be found

Declaration
public ConfigSectionNode this[int idx] { get; }
Parameters
Type Name Description
System.Int32 idx
Property Value
Type Description
ConfigSectionNode

Item[String[]]

Retrieves section node by names, from left to right until existing node is found. If no existing node could be found then empty node instance is returned

Declaration
public ConfigSectionNode this[params string[] names] { get; }
Parameters
Type Name Description
System.String[] names
Property Value
Type Description
ConfigSectionNode

Modified

Indicates whether this or any child nodes or attributes were modified

Declaration
public override bool Modified { get; }
Property Value
Type Description
System.Boolean
Overrides
ConfigNode.Modified

Methods

AddAttributeNode(String)

Declaration
public ConfigAttrNode AddAttributeNode(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
ConfigAttrNode

AddAttributeNode(String, Object)

Declaration
public ConfigAttrNode AddAttributeNode(string name, object value)
Parameters
Type Name Description
System.String name
System.Object value
Returns
Type Description
ConfigAttrNode

AddAttributeNode(String, String)

Declaration
public ConfigAttrNode AddAttributeNode(string name, string value)
Parameters
Type Name Description
System.String name
System.String value
Returns
Type Description
ConfigAttrNode

AddChildNode(IConfigSectionNode)

Adds a new child node into this one deeply cloning nodes data from some other node which may belong to a different conf instance

Declaration
public ConfigSectionNode AddChildNode(IConfigSectionNode clone)
Parameters
Type Name Description
IConfigSectionNode clone
Returns
Type Description
ConfigSectionNode

AddChildNode(String)

Declaration
public ConfigSectionNode AddChildNode(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
ConfigSectionNode

AddChildNode(String, Object)

Declaration
public ConfigSectionNode AddChildNode(string name, object value)
Parameters
Type Name Description
System.String name
System.Object value
Returns
Type Description
ConfigSectionNode

AddChildNode(String, String)

Adds a new child section node to this node

Declaration
public ConfigSectionNode AddChildNode(string name, string value)
Parameters
Type Name Description
System.String name
System.String value
Returns
Type Description
ConfigSectionNode

AddChildNodeFromMerge(IConfigSectionNode, IConfigSectionNode, NodeOverrideRules)

Adds a new section node to this configuration which is an ordered merge result of two other nodes - base and override.

Declaration
public ConfigSectionNode AddChildNodeFromMerge(IConfigSectionNode baseNode, IConfigSectionNode overrideNode, NodeOverrideRules rules = null)
Parameters
Type Name Description
IConfigSectionNode baseNode

A base node that data is defaulted from

IConfigSectionNode overrideNode

A node that contains overrides/additions of/to data from base node

NodeOverrideRules rules

Rules to use for this merge. Default rules will be used if null is passed

Returns
Type Description
ConfigSectionNode

AttrByIndex(Int32)

Returns attribute node by its index or empty attribute if real attribute with such index does not exist

Declaration
public ConfigAttrNode AttrByIndex(int idx)
Parameters
Type Name Description
System.Int32 idx
Returns
Type Description
ConfigAttrNode

AttrByName(String, Boolean)

Declaration
public ConfigAttrNode AttrByName(string name, bool autoCreate = false)
Parameters
Type Name Description
System.String name
System.Boolean autoCreate
Returns
Type Description
ConfigAttrNode

AttrsToStringMap(Boolean)

Returns attribute values as string map

Declaration
public StringMap AttrsToStringMap(bool verbatim = false)
Parameters
Type Name Description
System.Boolean verbatim
Returns
Type Description
StringMap

Delete()

Deletes this section from its parent

Declaration
public override void Delete()
Overrides
ConfigNode.Delete()

DeleteAllAttributes()

Deletes all attribute nodes from this node

Declaration
public void DeleteAllAttributes()

DeleteAllChildren()

Deletes all child section nodes from this node

Declaration
public void DeleteAllChildren()

EvaluateValueVariables(String)

Evaluates a value string expanding all variables with var-paths relative to this node. Evaluates configuration variables such as "$(varname)" or &quot;$(@varname)&quot;. Varnames are paths to other config nodes from the same configuration or variable names when prefixed with "~". If varname starts with &quot;@" then it gets combined with input as path string. "~" is used to qualify environment vars that get resolved through Configuration.EnvironmentVarResolver Example: ....add key=&quot;Schema.$(/A/B/C/$attr)&quot; value=&quot;$(@~HOME)bin\Transforms\&quot;...

Declaration
public string EvaluateValueVariables(string value)
Parameters
Type Name Description
System.String value
Returns
Type Description
System.String

IsSameNameAttr(IConfigSectionNode)

Returns true when another node has the attribute called 'name' and its value is the same as in this one per case-insensitive culture-neutral comparison

Declaration
public bool IsSameNameAttr(IConfigSectionNode other)
Parameters
Type Name Description
IConfigSectionNode other
Returns
Type Description
System.Boolean

IsSameNameAttr(String)

Returns true when another name is the same as this section "name" attribute per case-insensitive culture-neutral comparison

Declaration
public bool IsSameNameAttr(string other)
Parameters
Type Name Description
System.String other
Returns
Type Description
System.Boolean

MergeAttributes(IConfigSectionNode, NodeOverrideRules)

Merges attributes from another node into this one. Another node may belong to a different configuration instance

Declaration
public void MergeAttributes(IConfigSectionNode other, NodeOverrideRules rules = null)
Parameters
Type Name Description
IConfigSectionNode other
NodeOverrideRules rules

MergeSections(IConfigSectionNode, NodeOverrideRules)

Merges child sections from another node into this one. Another node may belong to a different configuration instance. This method ignores override flags and merges nodes regardless

Declaration
public void MergeSections(IConfigSectionNode other, NodeOverrideRules rules = null)
Parameters
Type Name Description
IConfigSectionNode other
NodeOverrideRules rules

Navigate(String)

Navigates the path and return the appropriate node. Example: '!/nfx/logger/destination/$file-name'

Declaration
public ConfigNode Navigate(string path)
Parameters
Type Name Description
System.String path

If path starts from '!' then exception will be thrown if such a node does not exist; Use '/' as leading char for root, '..' for step up, '$' for attribute name, [int] for access to subsection or attribute by index, section[value] for access using value comparison of named section, section[attr=value] for access using value of sections named attr Multiple paths may be coalesced using '|' or ';'

Returns
Type Description
ConfigNode
Remarks

/table[patient] - get first section named "table" with value "patient" /[3] - get 4th child section from the root /table/$[2] - get 3rd attribute of first section named "table" /table[short-name=pat] - get first section named "table" having attribute named "short-name" equal "pat"

Examples

Navigate("/vars/[3]"); Navigate("/tables/table[resident]"); Navigate("/vars/var1/$[2]"); Navigate("/tables/table[name=patient]");

NavigateSection(String)

Navigates the path and return the appropriate section node. Example '!/nfx/logger/destination'

Declaration
public ConfigSectionNode NavigateSection(string path)
Parameters
Type Name Description
System.String path

If path starts from '!' then exception will be thrown if such a section node does not exist; Use '/' as leading char for root, '..' for step up. Multiple paths may be coalesced using '|' or ';'

Returns
Type Description
ConfigSectionNode

OverrideBy(IConfigSectionNode, NodeOverrideRules)

Merges another node data by overriding this node's value/attributes/sub nodes according to rules.

Declaration
public bool OverrideBy(IConfigSectionNode other, NodeOverrideRules rules = null)
Parameters
Type Name Description
IConfigSectionNode other
NodeOverrideRules rules
Returns
Type Description
System.Boolean

True when merge match was made

ProcessIncludePragmas(Boolean, String)

Replaces all include pragmas - sections with specified names ('_include' by default), with pointed to configuration file content as obtained via the call to file system specified in every pragma. If no FS specified then LocalFileSystem is used. If no file name specified when try to allocate config node provider. Returns true if include pragmas were found. Note: this method does not process new include pragmas that may have fetched during this call. Caution: the file system used in the operation may rely on the App container that may need to be set-up for the call to succeed, therefore calling this method before app has activated may fail, in such cases a temp app container may be set to get the config file with processed includes, then the result may be passed to the primary app container ctor. This call is not logically thread-safe, it must be called from the main thread in the app

Declaration
public bool ProcessIncludePragmas(bool recurse, string includePragma = null)
Parameters
Type Name Description
System.Boolean recurse

True to process inner nodes

System.String includePragma

Pragma section name, '_include' by default

Returns
Type Description
System.Boolean

True if pragmas were found

Examples

nfx { sectionA{ a=2 b=3} _include { name=secret // '_include' will be replaced by 'secret' with sub-nodes from referenced file file="/etc/cluster/mysecret.laconf" //would come from local FS required=false //if file is not found then nothing will be included instead of '_include' which will be just removed } _include { // '_include' will be replaced by whatever root section content in the referenced file fs {type="NFX.Web.IO.FileSystem.SVNFileSystem, NFX.Web"} session { server-url="https://myhost.com/mySvnRepo/trunk/configs"; user-name="user1" user-password="******"} } }

ReplaceBy(IConfigSectionNode)

Completely replaces this node's attributes, value and children with data from another node

Declaration
public void ReplaceBy(IConfigSectionNode other)
Parameters
Type Name Description
IConfigSectionNode other

ResetModified()

Resets modification of this an all child nodes

Declaration
public override void ResetModified()
Overrides
ConfigNode.ResetModified()

ToConfigurationJSONDataMap()

Returns this config node as JSON data map suitable for making JSONConfiguration. Contrast with ToJSONDataMap

Declaration
public JSONDataMap ToConfigurationJSONDataMap()
Returns
Type Description
JSONDataMap

ToJSONDataMap()

Converts this ConfigSectionNode to JSONDataMap. Contrast with ToConfigurationJSONDataMap Be carefull: that this operation can "lose" data from ConfigSectionNode. In other words some ConfigSectionNode information can not be reflected in corresponding JSONDataMap, for example this method overwrites duplicate key names and does not support section values

Declaration
public JSONDataMap ToJSONDataMap()
Returns
Type Description
JSONDataMap

ToJSONString(JSONWritingOptions)

Serializes configuration tree rooted at this node into JSON configuration format and returns it as a string

Declaration
public string ToJSONString(JSONWritingOptions options = null)
Parameters
Type Name Description
JSONWritingOptions options
Returns
Type Description
System.String

ToLaconicString(LaconfigWritingOptions)

Serializes configuration tree rooted at this node into Laconic format and returns it as a string

Declaration
public string ToLaconicString(LaconfigWritingOptions options = null)
Parameters
Type Name Description
LaconfigWritingOptions options
Returns
Type Description
System.String

Explicit Interface Implementations

IConfigSectionNode.AttrByIndex(Int32)

Declaration
IConfigAttrNode IConfigSectionNode.AttrByIndex(int idx)
Parameters
Type Name Description
System.Int32 idx
Returns
Type Description
IConfigAttrNode

IConfigSectionNode.AttrByName(String, Boolean)

Declaration
IConfigAttrNode IConfigSectionNode.AttrByName(string name, bool autoCreate)
Parameters
Type Name Description
System.String name
System.Boolean autoCreate
Returns
Type Description
IConfigAttrNode

IConfigSectionNode.Attributes

Declaration
IEnumerable<IConfigAttrNode> IConfigSectionNode.Attributes { get; }
Returns
Type Description
System.Collections.Generic.IEnumerable<IConfigAttrNode>

IConfigSectionNode.Children

Declaration
IEnumerable<IConfigSectionNode> IConfigSectionNode.Children { get; }
Returns
Type Description
System.Collections.Generic.IEnumerable<IConfigSectionNode>

IConfigSectionNode.Item[Int32]

Declaration
IConfigSectionNode IConfigSectionNode.this[int idx] { get; }
Parameters
Type Name Description
System.Int32 idx
Returns
Type Description
IConfigSectionNode

IConfigSectionNode.Item[String[]]

Declaration
IConfigSectionNode IConfigSectionNode.this[params string[] names] { get; }
Parameters
Type Name Description
System.String[] names
Returns
Type Description
IConfigSectionNode

IConfigSectionNode.Navigate(String)

Declaration
IConfigNode IConfigSectionNode.Navigate(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
IConfigNode

IConfigSectionNode.NavigateSection(String)

Declaration
IConfigSectionNode IConfigSectionNode.NavigateSection(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
IConfigSectionNode

Implements

IConfigSectionNode
IConfigNode
INamed

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ManifestUtils.HasTheSameContent(IConfigSectionNode, IConfigSectionNode, Boolean)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX