Thursday, August 11, 2005 9:39 PM Olaf Conijn

Managing enterprise library configuration over multiple environments

As promised in an earlier post I would have a look into a way to manage configuration from within the EntLib Configuration Console over multiple environments. Just recently I had to deal with this very same problem on the project I worked at and found a solution I think works pretty decently. The solution is implemented as an ‘application block’ and uses my very favorite PropertyGrid to throw some extra Extenders and TypeDescriptors at the configuration nodes in the console.

 

The ‘application block’ can be added to any project within the configuration console. To declare a new environment[1] (places where you might want to have alternative configuration), you simply add a configuration node to the “Environment overrides”.

All configuration nodes are then extended with new properties for that apply on that specific environment[2]. Properties are automatically kept in sync with the enterprise library property when the ‘Override on Xxxx environment’ property is left as “Don’t override properties” [3].

 

After saving your configuration to disk a subdirectory will be created for each environment, containing a complete configuration setup for that specific environment. Commonly a buildserver should be responsible for distributing the configuration files from the subdirectories to the different physical environments.

The application block is only tested with the June version of EntLib and not tested with any custom application blocks. Please backup your configuration, as I would hate to see anyone losing their work because of flaws in the plugin.

The plugin can be deployed by recompiling the sources against your EntLib binaries and then copying the “EnvironmentalOverrides.dll” to EntLib’s bin directory.

The source of this EntLib plugin can be found here.

# Enterprise Library Configuration and Multiple Environments

Thursday, August 11, 2005 2:08 PM by TSHAK

Olaf is at it again. This time he's created an extension to the Enterprise Library Configuration Block...

# re: Managing enterprise library configuration over multiple environments

Friday, August 12, 2005 12:09 AM by TeunD

Very cool! This is really a great extension to the EntLib config. Your solution looks a lot like the ExtenderProviders from the WinForms designer environment (right?). Am I understanding your code right when I conclude that you add override entries for all properties that are not called "Name"? Would it be smart to have a CanExtend() method in the interface to have the extender select which nodes it wants to extend? Or am I missing the point?

# re: Managing enterprise library configuration over multiple environments

Friday, August 12, 2005 1:26 AM by Olaf Conijn

TeunD,

Yes it uses the same mechanisms as Visual Studio does in its winforms design environment.

The plugin works by implementing the IExtenderProvider interface, which has an CanExtend() method.

The method is currently implemented to Extend every configuration node, except for the application node and its own nodes.

The property added by the plugin is called "Overrides", the layout for the return type is defined dynamicly by a CustomTypeDescriptor.

The CustomTypeDescriptor copies properties from the node that gets extended, except for "Name", readonly properties or properties that have child properties (shown with a '+' in the PropertyGrid).

If there are properties that should not be configured 'per environment', please let me know. I'll check for for them in my code.

Did that answer your question? Or am I missing the point? ;-)

# 3 scenarios where your EntLib configuration might differ from one environment to another

Saturday, August 13, 2005 9:20 AM by ^(?:[^$]*)$ --Matches everything, captures nothing

In addition to my last post where I introduced an EntLib ConfigurationConsole plugin called ‘EnvironmentalOverrides’,...

# More Enterprise Library 1.x Posts and Series

Sunday, August 14, 2005 6:41 PM by Being Scott Densmore


Via TSHAK : two new cool posts.  One is going to be a series on 1.x.

Managing enterprise...

# re: Managing enterprise library configuration over multiple environments

Monday, August 15, 2005 12:15 AM by TeunD

I guess my point was that when you have three environments (say: dev, test and prod), your config editor would clutter up incredibly by all of the overrides, especially if you use nodes with more the just a Value property. Would it be possible to always have 1 overrides property per node. This would then be of type Collection and the collection elements would have a value, a property selector and an environment selector. That way, nodes without overrides (which is propably most common), would only have one extra property: "overrides: None".

# re: Managing enterprise library configuration over multiple environments

Monday, August 15, 2005 1:25 AM by Harry Maes

This is a nice and usefull extension to Entlib.
I have a few comments:

1. Why do you write the environmentalconfig.config in every subfolder? Or is this something you can't avoid with the architecture of EntLib?
2. If a property can't be overriden (like Name) is it possible to hide the Overrides?

Tx, Harry

# re: Managing enterprise library configuration over multiple environments

Monday, August 15, 2005 7:36 AM by Olaf Conijn

Hi Harry,

1.) I too would rather have EntLib store every environments configuration in the same file (and map the physical environments to the logical environments in the console) though have not found a way to do this in the Configuration Console.

2.) Properties that cannot be overriden are *not* shown in the 'Overrides' section.

good luck!

# Supporting multiple configuration environments using the EntLib config tool

Tuesday, August 16, 2005 5:53 PM by Tom Hollander's blog

One of the more frequent questions I have heard about Enterprise Library is how to efficiently manage...

# re: Managing enterprise library configuration over multiple environments

Wednesday, August 17, 2005 8:16 AM by erraggy

Olaf,

Awesome solution! I remember when you posted this project back on your MSN Spaces blog. I have followed your blog ever since, and have not been disappointed with your guidance in all things .NET. You seem to enjoy finding solutions to things that most give up on.

I was beginning to think you gave up on this multi-environment extension though ;-)

# re: Managing enterprise library configuration over multiple environments

Monday, August 22, 2005 12:58 AM by ACHPostma

My solution to this problem was a bit different.

I added a key to the web.config:
<appSettings>
<add key="Environment" value="LOCAL" />
</appSettings>

This then refers to the required settings given in the Data Access Application Block using the following code to access the database:

Database fmtDatabase = DatabaseFactory.CreateDatabase(System.Configuration.ConfigurationSettings.AppSettings["Environment"]);

I have 4 database setups in the Data Access Application Block (Local, Development, Test and Production).

# Environment-specific configuration for EntLib

Tuesday, August 23, 2005 3:46 PM by jeromyc's WebLog

I have a number of customers that are using EntLib, but with a common concern: how to manage environment-specific...

# re: Managing enterprise library configuration over multiple environments

Thursday, August 25, 2005 11:07 PM by Alexander

Cool! Thanks a lot!

Best regards,
Alex.

# re: Managing enterprise library configuration over multiple environments

Thursday, September 01, 2005 3:54 PM by Ron Jacobs

Olaf - this is really cool - would you mind if we featured this on a future "Ask p&p webcast" We have one coming up on 9/22. If you like you could even dial in and join us on the air. Let me know- rojacobs@microsoft.com

# Managing enterprise library configuration over multiple environments

Thursday, November 03, 2005 9:28 AM by David Christiansen

Olaf Conijn presents a great little bolt-on for enterprise library that allows for the identification...

# re: Managing enterprise library configuration over multiple environments

Monday, November 07, 2005 6:59 AM by El Bruno

Great Work !!!

I just introduce this component in the current project, so I'll try it and I'll get you some feedback :D

Bye from Spain

# re: Managing enterprise library configuration over multiple environments

Monday, November 07, 2005 8:27 AM by El Bruno

a small question ...

I have a custom component in EntLib that provides some configuration info. This component uses a public NameValueCollecionItem property to expose some data.

When I use your component in my project, and the NameValueCollecionItemEditor is displayed, it always display the top information and after this saves the same informacion for all enviroments. ... any ideas ???

Thanks !!!
You can contact me at the email in my blog if you want ;)

# Configuracion de Enterprise Library sobre multiples ambientes

Sunday, January 08, 2006 5:33 PM by Haaron Gonzalez Weblog

# Enterprise Library 2.0 and ‘Extension pack’

Tuesday, January 17, 2006 3:20 AM by ^(?:[^$]*)$ --Matches everything, captures nothing

Just in case it you didn&amp;rsquo;t know&amp;hellip;.
Enterprise Library 2.0 is scheduled to ship end of this...

# Estensioni per Enterprise Library January 2006

Thursday, February 02, 2006 7:54 AM by mauros@UGIdotNET

# Enterprise Library 2.0 Environment Configuration

Tuesday, February 14, 2006 6:49 PM by C# .Net Tales

Just installed and got running a web application in .net 2.0 using Ent Lib 2.0 Logging. Was trying to...

# Enterprise Library 2.0 Environment Configuration

Tuesday, February 14, 2006 7:25 PM by C# .Net Tales

Just installed and got running a web application in .net 2.0 using Ent Lib 2.0 Logging. Was trying to...

# Enterprise Library 2.0 Environment Configuration

Tuesday, February 14, 2006 7:27 PM by C# .Net Tales

Just installed and got running a web application in .net 2.0 using Ent Lib 2.0 Logging. Was trying to...

# Enterprise Library extensions drop 2: Return of the Environmental Overrides

Wednesday, March 15, 2006 12:19 PM by ^(?:[^$]*)$ --Matches everything, captures nothing

Environmental Overrides
The &amp;lsquo;Environmental Overrides&amp;rsquo; extension is back and works with...

# Enterprise Library extensions drop 2: Return of the Environmental Overrides

Wednesday, March 15, 2006 12:25 PM by ^(?:[^$]*)$ --Matches everything, captures nothing

Environmental Overrides
The &amp;lsquo;Environmental Overrides&amp;rsquo; extension is back and works with...

# Enterprise Library extensions drop 2: Return of the Environmental Overrides

Wednesday, March 29, 2006 3:50 AM by ^(?:[^$]*)$ --Matches everything, captures nothing

Environmental Overrides
The &amp;lsquo;Environmental Overrides&amp;rsquo; extension is back and works with...

# .NET Resources

Saturday, May 06, 2006 11:49 PM by mattonsoftware.com

The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...

# .NET Resources

Sunday, May 07, 2006 4:52 PM by mattonsoftware.com

The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...

# .NET Resources

Tuesday, May 16, 2006 6:00 AM by mattonsoftware.com

The following links to .NET resources have been collated over time with the assistance of

colleagues.&amp;nbsp;...

# .NET Resources

Tuesday, May 16, 2006 6:05 AM by mattonsoftware.com

The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...

# .NET Resources

Wednesday, May 17, 2006 4:33 PM by mattonsoftware.com

The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...

# .NET Resources

Saturday, May 20, 2006 1:18 AM by mattonsoftware.com

The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...

# .NET Resources

Saturday, May 27, 2006 3:46 AM by mattonsoftware.com

The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...

# re: Managing enterprise library configuration over multiple environments

Monday, July 17, 2006 7:04 AM by NEWS

very good site I am surprised call at see on my site I have not worse my site available here is on this reference: http://wertex.info

# re: Managing enterprise library configuration over multiple environments

Monday, July 17, 2006 3:13 PM by NEWS

very good site I am surprised call at see on my site I have not worse my site available here is on this reference: http://wertex.info

# re: Managing enterprise library configuration over multiple environments

Tuesday, July 18, 2006 4:32 AM by NEWS

very good site I am surprised call at see on my site I have not worse my site available here is on this reference: http://wertex.info