Question

I am modifying a project (1) (windows service). I was given a utility project(2) and I am using this is my project. I dont know why but this (2) has an initialization using ConfigurationManager.AppSettings[] I use a custom config reader in my project as I wanted my own XML structure. The utility has no options to initialize using contructors or methods.

I did not want to change this utility much so I just changed this initialization using AppSettings to the config class in (1) (by creating a dependency to (1) from (2)). I know this is not the way to go about it. If I clean my solution it would be mess.

I could think of some ways. But not sure which will be the correct approach?

  1. Have another config file
  2. Continue with cyclic dependency
  3. Pass on parameters and change the utility
  4. (there are too many parameters) should I pass all values as string and write logic in utility to convert them back?

Project 1

using utility;

ns pr1;

CustomConfigReader{ }

Project 2

using pr1;

ns utility;
UtilityClass{

  //Initialization of a lot variables
  pr1.CustomConfigReader .......

}
Was it helpful?

Solution

Put the custom configuration code in its own DLL & have (1) & (2) both reference it. Then modify (2) so it uses the custom configuration code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top