views:

34

answers:

2

I want to divide business layer (BLL) of an asp.net application into multiple components. Each component is a .NET class library which is compiled as a standalone DLL. These components should have their own configuration files. For example "MyNameSpace.Users.dll" contains classes about users of the website and there's a password policy to check if password length is at least x characters. When webmaster edits the config file of this DLL and set x to y then component (DLL) should use new value (y) in the future and enforce passwords to be at least y characters. I want each component as a single project and compile them separaely (and not to put all projects in a solution in Visual Studio), and put the DLLs of these libraries into the "Bin" folder of my ASP.NET application.

Is it possible ? Where should I put these config files ?

A: 

imho It's possible but not out of the box.

ASP.NET uses by defautl only the one web.config in the web root (and pproriate machine .config files higher up in the hierarchy). But you can create custom settings providers for each of your dlls that read values from separate .config files. see http://msdn.microsoft.com/en-us/library/ms228060.aspx This way you create different SettingsManager providing settings to parts of the App and reading the info from files.

Plus you can use FilesystemWatcher to reload values when the additional .configs are edited.

Elementenfresser
Would you please give me a sample and let me know if if support for reload of configurations on changing the editing the configuration file (something like FileSystemWatcher)
Xaqron
A: 

Managed Extensibility Framework (MEF) released in .NET 4.0

http://mef.codeplex.com

Xaqron