I am wondering what would be considered best practice when setting up reusable components / libraries in .net. I have a webservice that utilizes a library that contains a few database connection for interacting with databases. I am wondering how I should set my library up when it comes to specifying the connection strings.
I need to be able to alter to which database the reusable component connects to as I am deploying to dev/uat/prod environments. Also there is a certain need to being able to trace who is doing database calls -- I might want to see who is the user of the reusable component so if webservices A and B are each using it I might want ws_A_usr to be used in the connection string and likewise for B.
I see a few ways this could be done but I as I am refactoring some legacy all three implementations are being used.
Should I read connectionstrings from config (MyLib.Properties.Settings.Default.abcConnectionString)
Should I accept connectionstrings as parameters in my api?
Should I accept IDbConnection as parameters in my api?
Are there other more suitable ways to do this - what would be the best one?