AppConfiguration Class

This class provides a base class for code-first, strongly typed configuration settings in .NET. It supports storing of configuration data in .NET .config files, plain XML files, strings and SQL Server databases and custom providers.

Using this class is easy: Create a subclass of AppConfiguration and then simply add properties to the class. Then instantiate the class, call Initialize(), then simply access the class properties to read configuration values.

The default implementation uses standard .NET configuration files and a custom section within that file to hold configuration values. Other providers can be used to store data to different stores and you can create your own custom providers to store configuration data in yet other stores. Managing Configuration Settings with AppConfiguration

System.Object
   Westwind.Utilities.Configuration.AppConfiguration

Class Members

MemberDescription
Constructor Default constructor of this class SHOULD ALWAYS be implemented in every subclass to allow serialization instantiation and setting of initial property values.
Initialize This method initializes the configuration object with a provider and performs an initial read from the config store.
public abstract void Initialize(IConfigurationProvider provider, string sectionName, object configData)
OnCreateDefaultProvider Override this method to use a specialized configuration provider for your config class when no explicit provider is passed to the Initialize() method.
public abstract IConfigurationProvider OnCreateDefaultProvider(string sectionName, object configData)
OnInitialize Override this method to handle custom initialization tasks. This method should: create a provider and call it's Read() method to populate the current instance of the configuration object. If all you…
public abstract void OnInitialize(IConfigurationProvider provider, string sectionName, object configData)
Read Reads configuration data from a string and populates the current instance with the values. Data should be serialized in XML Searlization format created with
public abstract T Read()
Write Writes the current configuration information data to the provider's configuration store.
public abstract bool Write()
WriteAsString Writes the current configuration information to an XML string. String is in .NET XML Serialization format.
public abstract string WriteAsString()
Namespace: Westwind.Utilities.Configuration

Assembly: Westwind.Utilities.dll