2

I have a big solution (~50 projects) consisting many web projects and web service projects grouped to modules (solution folders). The reason why I have many WebApi projects is that I assume, in the future, they will be deployed on different domains.

As I mentioned, a module can have many web api projects and class library projects and one test project. At the moment I have 5 modules, so that I have 5 test projects - I call them ModuleTestProject - and each one need the same shared configuration data.

In general, how to do it in a good way?

I have tried to put the configuration in a separated TestSetup class library project having app.config and every ModuleTestProject referencing it. I have read an article here how to do it, but I do not feel this way is the pretty way.

My another idea is also a separated project where classes contains the configuration data. This way I do not have to deal with publishing the app.config file, etc.

But, before I do anything I think good to ask the more experienced people than I am.

I appreciate your help in advance!

AndrasCsanyi
  • 3,943
  • 8
  • 45
  • 77

3 Answers3

0

windows registry is an another option for reading configuration. You can add your configuration values to registry and then you can reach these values from every programs/modules which is running on the same machine. For More information: Read Write Delete From Registry

fealin
  • 443
  • 1
  • 4
  • 13
0

In case all projects need to share configuration data, I would create a new project with custom ConfigurationProvider class. Then I would reference this project from all other projects.

In the future, when you deploy your projects to different domains, you could modify ConfigurationProvider class and add an option to retrieve and cache settings from some common location (e.g. XML file that is accessible via HTTP).

SoftwareFactor
  • 8,430
  • 3
  • 30
  • 34
  • Thanks for your answer! The first part of it sounds like my idea, and the more I'm thinking about the higher the chance I will do it this way. – AndrasCsanyi Feb 27 '14 at 10:05
  • Glad to help. Alternative approach would be to link the same config between projects (using Add > Add Existing Item > Add as Link from Solution Explorer). Though, I am not sure if it would work for you. – SoftwareFactor Feb 27 '14 at 12:43
0

After a few hours searching, thinking and reading I decided to follow the way where external configuration files can be included by appSetting's file attribute. Links:

At the moment I have only one external configuration file, but I'm planning to re-organize my files in order to they will be more manageable.

Community
  • 1
  • 1
AndrasCsanyi
  • 3,943
  • 8
  • 45
  • 77