Cinchoo is the application framework for .NET. One of the main functionality it provides to the users is that application configuration management. Application configuration is the information that application reads and/or writes at run-time from the source. Please take a look at 'Cinchoo - Simplified Configuration Manager' jump start article on using configuration framework in your application.
In this article, I'll talk about the available binding modes supported by Cinchoo configuration framework. Binding mode is the direction of data flowing between Configuration object and datasource . Below are the list of binding modes available for us. (these are of ChoConfigurationBindingMode type)
- TwoWay – (Default) The changes are flown both way between configuration section object and data source.
- OneWay – The changes are flown only from data source to configuration section object.
- OneWayToSource – The changes are flown only from configuration section object to data source.
- OneTime – The configuration settings are read and loaded into configuration section object once. Any changes made either in the configuration section object or data source are not propagated between them.
Using the code
There are couple of ways, you can specify binding mode for configuration object
Using ChoConfigurationSectionAttribute, you can specify the binding mode as below
[ChoConfigurationSection("sample", BindingMode = ChoConfigurationBindingMode.TwoWay)]
public class SampleConfigSection : ChoConfigurableObject
[ChoPropertyInfo("name", DefaultValue = "Mark")]
public string Name;
[ChoPropertyInfo("message", DefaultValue = "Hello World!")]
public string Message;
Some cases, you may want to control the binding mode through configuration. This approach will help to prevent the code base being modified for each change. Here is how you can do
- Open Bin/Config/Meta/[AppExeName].meta file
- Locate 'sample' element under 'configuration' node, modify BindingMode attribute.
<sample bindingMode="TwoWay" defaultable="true" silent="true" ignoreCase="true">
Version=184.108.40.206, Culture=neutral, PublicKeyToken=b7dacd80ff3e33de</configStorage>
<logInfo condition="true" directory="Settings"
That's all. Try it. Thanks.