Skip to content

MutatorsContext

Anton Chaplygin edited this page Sep 19, 2019 · 4 revisions

MutatorsContext is a type of the context parameter of the Configure method in the ConverterCollection class and in the DataConfiguratorCollection class It is used to customize a conversion/validation ruleset.

By passing diferent contexts to the GetConverter method of the ConverterCollection class or to the GetMutatorsTree method of the DataConfiguratorCollection class you can get different conversion/validation functions. If you don't use the context parameter in the Configure method, you can simply pass the MutatorsContext.Empty instance to the GetConverter/GetMutatorsTree methods.

If you intend to customize conversion/validation rules, you should create a class deriving from the MutatorsContext class and implement the abstract GetKey method, which should return different strings for different context values. You can see usages of the TestConverterContext as an example of this feature.