I am using c# but the question was more towards software engineering principals so I am asking the question here.
There are so many questions here but mostly they say :"How to use global variables in c#?" and "Are global variables are bad?". But my question is about "How" to avoid global variables in my scenario.
I've written a class that works as data access layer. I've 2 objects of this class. One pointing to main database and second pointing to reports database. The connection string are not constants rather a form is displayed at application startup and user enters the server name, login name and password. Now all other classes need to use these objects to work with database.
I have a strong feeling that these 2 objects should be global but I want to avoid if somehow this is possible?