Click here to Skip to main content
15,896,915 members
Articles / Programming Languages / C#

Cinchoo - Simplified Configuration Manager

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
22 Apr 2017CPOL13 min read 36K   419   27  
Easy configuration management in .NET
using Cinchoo.Core;
using Cinchoo.Core.Configuration;
using Cinchoo.Core.Shell;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnyDbConfigSectionSample
{
    ///Create a table in SqlServer databse using the sql script below
    /*
    CREATE TABLE APP_SETTINGS
    (
        [KEY] VARCHAR (50) NOT NULL,
        VALUE VARCHAR (100),
        PRIMARY KEY ([KEY]) 
    )  
    */

    [ChoAnyDbConfigurationSection("appSettings", @"Data Source=.\SqliteTest.db;Version=3;Pooling=True;Max Pool Size=100;", "APP_SETTINGS", "System.Data.SQLite")]
    public class AppSettings : ChoConfigurableObject
    {
        [ChoPropertyInfo("name", DefaultValue = "Mark")]
        public string Name;

        [ChoPropertyInfo("address", DefaultValue = "100, Madison Avenue, New York, NY 10010")]
        public string Address;

        protected override void OnAfterConfigurationObjectLoaded()
        {
            Console.WriteLine(ToString());
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            AppSettings appSettings = new AppSettings();

            ChoConsole.PauseLine();
        }
    }
}

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
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.

Comments and Discussions