Binding nodes to models
Last updated
Was this helpful?
Last updated
Was this helpful?
Binding is the process of initializing a model (an instance of almost arbitrary type) with data from a obtained from a :
node {A: 1, B: 2} --> new CustomModel { A = 1, B = 2}
The resulting model is queried by the application code with a to access settings.
Binding is implemented by a set of , each of which knows how to convert a to an object of a specific type.
Binders are composable: if there's a registered binder for Dictionary<T1, T2>
, string
and int
, then it's possible to bind to Dictionary<string, int>
. This is heavily used for .
A typical binding process starts with a and proceeds downward by matching fields and properties with node subtrees by names and invoking appropriate binders:
In case of failure, a complete list of all errors is presented in resulting exception.
See all to learn more about this process.
Binding fails if there's at least one error on any level. Errors may arise from incorrect value formats for , missing values for fields and properties, mismatches of types or missing for requested types.