I have 3 separate windows service projects that does exact same thing. The only difference is that each project file has different connection string setting in the app.config.
I am planning to consolidate the service project to make it more manageable. What is the best approach?
Current Scenario:
3 win services > executes every 6 minutes > hits 3 different databases >
collects data > generates XML > sends the XML to the FTP.
Expected Result:
1 win service > executes every 6 minutes > hits 3 different databases >
collects data > generates XML > sends the XML to the FTP.
So they all do the same thing baring the have different connection strings – “easy”.
Within your config create a new app setting in the config for “schemas” or something the same and have the values separated with a comma eg:
Then in your ensure you have a key for each one of the connections in the schema app setting key
In your OnStart do something as follows – baring in mind a sleep or thread itteration is needed to be put in but you get the idea: