I like to store my application's configuration in app.config or web.config (depending on the project type) which is pretty standard for .NET applications. Therefore, I'm not a big fan of ActiveRecord's XmlConfigurationSource.
That said, the InPlaceConfigurationSource is somewhat difficult to puzzle out. After reading the source code, I was able to bend it to my will.
In particular, I like this syntax well enough:
InPlaceConfigurationSource configuration =
It lets me setup my connection string and database type and default most everything else.
The "problem" is that I can't then do something clean and simple like this:
Instead I have to do this:
Castle.Core.Configuration.MutableConfiguration oneMutableConfiguration =
Which works, but it's not the friendliest API to program against.
Be careful, the "Add" method on InPlaceConfigurationSource is not really "Add". It is really "Replace".
The other main alternative for using InPlaceConfigurationSource is something like this, which is useful for when I can't just use the defaults:
IDictionary<string, string> properties =
new System.Collections.Generic.Dictionary<string, string>();
InPlaceConfigurationSource configuration = new InPlaceConfigurationSource();
configuration.Add(typeof(ActiveRecordBase), (IDictionary<string, string>)properties);
This was written and tested against "ActiveRecord 2.0 - August 1st, 2009".