Click here to Skip to main content
15,896,118 members
Articles / Web Development / ASP.NET

Simple and flexible way to access and store configuration settings

Rate me:
Please Sign up or sign in to vote.
4.59/5 (11 votes)
6 Jan 2012CPOL4 min read 30.6K   299   31  
An easy way to manage application configuration with a wide range of options for storage.
using System.Collections.Generic;

namespace i3Quest.Configuration.Core
{
	/// <summary>
	/// Represents an object that allows to store and retrieve configuration settings.
	/// </summary>
    public interface IConfigurationContext
    {
		/// <summary>
		/// Lists all context objects with specified name that are associated with current context.
		/// </summary>
		/// <param name="contextName">Name of the context to get.</param>
		/// <param name="create">Create context if does not exist.</param>
		/// <returns>Enumeration of contexts.</returns>
		IEnumerable<IConfigurationContext> Get(string contextName, bool create);

		/// <summary>
		/// Lists all context objects associated with current context.
		/// </summary>
		/// <returns>Enumeration of contexts.</returns>
        IEnumerable<IConfigurationContext> GetAll();

		/// <summary>
		/// Gets or sets a configuration value for specified name.
		/// </summary>
		/// <param name="name">Name of the setting.</param>
		/// <returns>Setting value.</returns>
        string this[string name] { get; set; }

		/// <summary>
		/// Gets a string that specifies the name of the context.
		/// </summary>
        string Name { get; }

		/// <summary>
		/// Creates new context object with a specified name.
		/// </summary>
		/// <param name="contextName">Name of the context to create.</param>
		/// <returns>Configuration context object.</returns>
        IConfigurationContext Create(string contextName);
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO i3 Quest Inc
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
This is a Organisation (No members)


Comments and Discussions