configSource
You can use the configSource property of a ConfigurationSection to specify a separate file where the configuration of that section is stored.
Ex: All Connection strings are stored in a separate file "ConnectionStrings.config"
Content of ConnectionStrings.config
connectionString="Data Source=(local);Initial Catalog=Sample;Integrated Security=True;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
connectionString="metadata=res://*/MatsModel.csdl|res://*/SampleModel.ssdl|res://*/SampleModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=(local);Initial Catalog=Sample;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework""
providerName="System.Data.EntityClient" />
Benefits
- Using include files can result in a more logical and modular structure for configuration files.
- File-access security and permissions can be used to restrict access to sections of configuration settings.
- Settings in an include file that are not used during application initialization can be modified and reloaded without requiring an application restart.
No comments:
Post a Comment