Vostok.Configuration
HomeQuickstartConcepts and basicsBasic scenarios
  • Home
  • Quickstart
  • Concepts and basics
    • Settings nodes
      • Value nodes
      • Array nodes
      • Object nodes
    • Settings nodes merging
    • Settings nodes scoping
    • Binding nodes to models
    • Configuration sources
    • Configuration provider
    • Caching and performance
    • Error handling
  • Modules
    • Abstractions
    • Configuration
    • Sources
    • Sources.CC
    • Sources.Json
    • Sources.Yaml
    • Sources.Xml
    • Sources.Vault
    • Logging
    • Microsoft
  • Sources
    • Constant sources
    • Object source
    • XML sources
    • YAML sources
    • JSON sources
    • Vault source
    • ClusterConfig source
    • Command line source
    • Environment variables source
  • Binders
    • Primitives
    • Collections
    • Classes and structs
    • Constructor injection
  • Basic scenarios
    • Assign sources to types
    • Obtain settings from provider
    • Observe settings via provider
    • Print settings
    • Log settings updates
    • Log errors
    • Combine sources
    • Scope sources
    • Make settings secret
    • Make settings required
  • Advanced scenarios
    • Use name aliases
    • Use dynamic interfaces
    • Use shared provider instance
    • Use value substitutions
    • Nest sources
    • Freeze sources
    • Transform sources
    • Create custom sources
    • Apply custom validators
    • Apply custom binders
    • Apply source data to existing object
    • Print contents of a source
Powered by GitBook
On this page
  • Key points
  • Why is it necessary to learn about settings nodes?
  • When is there a need to use settings nodes directly?
  • Node types
  • Node interface
  • Representation
  • Related pages

Was this helpful?

Export as PDF
  1. Concepts and basics

Settings nodes

PreviousConcepts and basicsNextValue nodes

Last updated 5 years ago

Was this helpful?

Settings nodes are the intermediate representation of configuration data and one of the core concepts of the library. Their main purpose is to abstract away various configuration formats (JSON, XML, etc.) so that can be implemented once without regard to the nature of being used.

Key points

  • A settings node is a tree with string keys and string values in its leaf nodes.

  • produce settings nodes as their primary artifacts.

  • is the process of converting a settings node to an arbitrary .NET object.

  • Settings nodes are implemented in the .

  • Settings nodes are immutable objects.

Why is it necessary to learn about settings nodes?

Despite being a somewhat internal API used directly only in a handful of advanced scenarios, settings nodes are crucial for a solid understanding of how configuration data to objects in C# code via different node types and .

When is there a need to use settings nodes directly?

  • Implementation of a ;

  • Implementation of a ;

  • of configuration sources

Node types

There are three types of nodes:

Users are not expected to implement custom node types.

Null node instances represent absence of settings (e.g. a configuration file that does not exist).

Node interface

Property

Type

Description

Name

string

Node name. Case-insensitive.

Value

string

Children

IEnumerable<ISettingsNode>

this[name]

ISettingsNode

Representation

{
   "A": "1",
   "B": "2"
}

This representation is extensively used on the rest of the pages.

Related pages

, used to hold data;

, used to represent sequences;

, used to represent objects with named properties.

All node types implement the interface and have following properties:

Node value. Only present in .

Sequence of child nodes in containers: and .

Name-based indexer used to navigate (see ).

All nodes also implement a operation.

All node types implement a JSON-like ToString() method. Its result may look like this for a sample with two nested :

binding to model classes
configuration sources
Configuration sources
Binding
abstractions module
translates
scoping
custom configuration source
custom model binder
Transformation
Value nodes
Array nodes
Object nodes
ISettingsNode
merge
object node
value nodes
Value nodes
Array nodes
Object nodes
Settings nodes merging
Settings nodes scoping
Configuration sources
Binding nodes to models
value nodes
arrays
objects
objects
scoping