June 2006 - Posts

It’s fast

 

I honestly couldn’t tell you how fast... after pushing the button to check in my EntepriseLibraryExtensions project, I glanced through my email and by the time I looked back (expecting a progress bar) it was checked in. :)

Before starting the development of a general purpose configuration management environment, I wanted to take my experiment with WCF a little further…

 

I not only wanted to proof myself able to manage big configuration schemas in EnLib’s configuration console, I wanted to have similar configuration support I had developed in my EnterpriseLibraryExtensions.

 

This time around the configuration-schema of choise was: system.web

 

I do not not have a release ready quite yet, but here’s to wet your appetite:


(Validating System.Web configuration)


(encrypting parts of a web.config file)



(managing configuration-differences in deployment scenarios)

In order to realize my ambitions and create a configuration management environment for .NET 2.0 it would be crucial to:

1)      Be able to manage big configuration schema’s
2)      Have a generic mechanism to add configuration support for configuration settings, with minimal effort.

To meet the first requirement I needed a big schema to get my hands dirty on: Windows Communication Foundation.

The second requirement was a matter of implementation…

Using EntLib’s Configuration Console as a host for the configuration editor gave me a true kick start, but also bound me to an API in which every ‘configuration node’ was defined in more than 100 lines of code, just for the graphical representation.

In EntLib’s Configuration Console a ‘configuration node’ is shown in a treeview and represents a part of the configuration schema you are editing. The ConfigurationNode defines “Configuration properties”, “Validation rules” and allows for registered commands to perform tasks on it.

With around 50 configuration nodes within Wcf configuration schema parts I wanted to support, typing 5000 lines of code just to draw a graphical representation wasn't going to cut it in the 5 days I was able to spend on this demo.

Please keep in mind that this never was a requirements for developing Enterprise Library, I am basically ‘misusing’ a tool that was developed to manage Enterprise Library’s configuration schema.

Writing a generic baseclass for all configuration nodes took about a day’s work. And was defined as follows (slightly simplified)

[TypeDescriptionProvider(typeof(DelegatedTypeDescriptorProvider))]
public abstract class GenericConfigurationNode<TData> : ConfigurationNodeWithAutoName, IDelegatedTypeDesciptorAccessable,
ISitedConfigurationNodeSink
{
TData _data;

public GenericConfigurationNode(TData data, string
nameProperty)
{
    _data = data;
    //...
}

public TData TheData
{
    get { return
_data; }
}

public Dictionary<string, List<Attribute>> AttributesByPropertyName
{
    get{return
GetAttributesByPropertyName();}
}

protected abstract Dictionary<string, List<Attribute>> GetAttributesByPropertyName();

}

Please note:
1) The type argument allows for a type to be passed that defines the properties that should be edited in the configuration tool (typically a derivement of ConfigurationElement or ConfigurationSection).

2) The virtual method GetAttributesByPropertyName allows a derivement of the generic node to add information to the properties shown in the grid.

3) Deriving from the baseclass was all i needed to create a graphical representation for a configurationnode and now took ~5 lines of code (instead of ~100)

Writing configuration support for Windows Communication Foundation took me an additonal 4 days of work (including some wizards, validation, pretty icons and other nice-to-demo-ables).



<<binaries attached>>

After having my share of success with developing the “Enterprise Library Extensions”, I started thinking about how to take this further.... and conquer the complete .net configuration schema!
 

In the past months I silently developed 2 ‘proof of concepts’ applications to prove this point:

 

From feedback on my blog (and from working on the above), I learned a great deal about what is valuable in terms of configuration management and how to build a tool that allows developers to have a similar experience managing configuration across the complete .Net framework 2.0.

This should well be possible given that the new System.Configuration namespace in .NET 2.0 makes ConfigurationSections self-describing in terms of schema and validation. 

.NET Configuration Manager

My current ambition level is developing a tool that allows a developer to manage configuration stored in an arbitrary ConfigurationSection build in .NET 2.0 (yup, that includes a ConfigurationSection developed by yourself).


To reflect this new ambition, I am rebranding this pet-project “.NET Configuration Manager”(or “CoMan” for intimae).

 

Kudos to the CodePlex team for setting me up with a workspace at which I will continue development and will be the place for collaboration, new releases, documentation and feedback. The workspace also contains a newsfeed aggregated from this weblog.


Feel free to take a first look at: codeplex.com/Wiki/View.aspx?ProjectName=CoMan

Stay tuned for more!