Apply custom binders
Requires: abstractions module.
This extension point covers scenarios where existing binders are not sufficient to handle required types.
Custom binders should be used as a last resort when constructor injection and parsing conventions are not powerful enough.
Creating a binder for a type is just a matter of implementing an interface:
class MyComplexTypeBinder : ISettingsBinder<MyComplexType>
{
public MyComplexType Bind([CanBeNull] ISettingsNode node)
{
...
}
}
Custom binders can be applied to specific fields and properties or whole types:
class MySettings
{
[BindBy(typeof(MyComplexTypeBinder))]
public MyComplexType ComplexProperty { get; }
}
[BindBy(typeof(MyComplexTypeBinder))]
class MyComplexType
{
}
Related pages
Binding nodes to modelsBindersLast updated
Was this helpful?