Replacing configuration structures, finding alternatives

I have been using the following source configurations to manage the configuration of my projects for several years:

  • The first one imitates Java files .properties(a bunch of lines supergroup.subgroup.property=valuewith support for collections) and works great for many situations (I think this is best for small applications). This is useful for a very simple configuration.

  • The second is based on DataContractSerializer(and optionally XmlSerializer), which allows all the functions of the first with all the advantages of XML and less plumbing, to make it work. It's nice, but impractical and cumbersome to manage without an explicit user interface on top of it, to alleviate the headaches for teaching end users to change XML.

Both existing frameworks also marshal from POCOs without problems to allow access to configuration values ​​through properties / fields (via manual / automatic serialization, respectively), so they are very easy to work with the developer.

Now, when I look at their options for including a database and good configuration, I'm looking for an alternative (preferably open source). I have no problem processing all my existing projects if I can reduce unnecessary code duplication and allow them access to the database and good configuration (in addition to their existing capabilities).

Any suggestions or should I redo my own to get the features I need?

, Nini, 2 , ( ). - ?

, :

  • XML
  • INI/Java- properties
  • ( , MS SQL SQLite, MySQL , )
  • ( )
  • - API , .
  • / , /.

, , , , , , .


UPDATE

System.Configuration , , , , . ( ), , XML: , .

- , , ( ). - , .

, 24 ( > 125 ), , , , , . , - .

+5
3

- . - , . System.Configuration, , . , .

, .

+2

, Cinchoo Configuration Framework, , .

Cinchoo

namespace HelloWorld
{
    #region NameSpaces

    using System;
    using Cinchoo.Core.Configuration;

    #endregion NameSpaces

    [ChoConfigurationSection("sample")]
    public class SampleConfigSection : ChoConfigurableObject
    {
        [ChoPropertyInfo("name", DefaultValue="Mark")]
        public string Name;

        [ChoPropertyInfo("message", DefaultValue="Hello World!")]
        public string Message;
    }

    static void Main(string[] args)
    {
        SampleConfigSection sampleConfigSection = new SampleConfigSection();
        Console.WriteLine(sampleConfigSection.ToString());
    }

}

, , Cinchoo , . , .

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="sample" type="Cinchoo.Core.Configuration.ChoNameValueSectionHandler, Cinchoo.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b7dacd80ff3e33de" />
  </configSections>
  <sample>
    <add key="name" value="Mark" />
    <add key="message" value="Hello World!" />
  </sample>
</configuration>
+2

, , Spring Framework.NET, PropertyPlaceholderConfigurer.

, xml. , , (, , ), , ${sql.server}, ${sql.password}, ​​ .

. , , , Windows ( , , ).

, Spring, Spring.Core, Spring Injection Dependency.

http://www.springframework.net/doc-latest/reference/html/objects.html#objects-factory-placeholderconfigurer

0
source

All Articles