We have a number of applications all of which need to read the same simple pieces of data from a database and that database has a single ID created for this purpose.
I have been wanting to move the code for this data retrieval into a class library, so that I do not have to have multiple copies of the same code and so that if the connection string needs changing then I do not need to change it in many places.
I have found many posts where this question was asked, but there seems to be one common answer, which is no answer at all;
'Oh no!' they say, 'you cannot have a configuration file for a class library, that is simply not the proper way to do things, oh properly, properly, properly' they drone.
'What you MUST do is have a configuration file for each application, and in each you store the encrypted connection string. Each application decrypts it, each application passes it on, this information useless to the application itself'
And frothing at the mouth, 'Oh properly, properly, properly, the class library must be spoon fed or just plain hardcoded!'
'Do not question and I shall not explain, for so it shall be, on Earth as it is in Microsoft, forever, Amen' they conclude.
Seems any attempt at use of an app.config for a class library results in it overriding to the configuration of the application instead. Furthermore When an application is published and references a class library, it will copy the DLL will not copy any file marked as 'Content' within the class library project.
Please correct me, this whining fool, enlighten me as to how.. or to why such a simple thing meets with the obstruction due a heinous crime.
I have been wanting to move the code for this data retrieval into a class library, so that I do not have to have multiple copies of the same code and so that if the connection string needs changing then I do not need to change it in many places.
I have found many posts where this question was asked, but there seems to be one common answer, which is no answer at all;
'Oh no!' they say, 'you cannot have a configuration file for a class library, that is simply not the proper way to do things, oh properly, properly, properly' they drone.
'What you MUST do is have a configuration file for each application, and in each you store the encrypted connection string. Each application decrypts it, each application passes it on, this information useless to the application itself'
And frothing at the mouth, 'Oh properly, properly, properly, the class library must be spoon fed or just plain hardcoded!'
'Do not question and I shall not explain, for so it shall be, on Earth as it is in Microsoft, forever, Amen' they conclude.
Seems any attempt at use of an app.config for a class library results in it overriding to the configuration of the application instead. Furthermore When an application is published and references a class library, it will copy the DLL will not copy any file marked as 'Content' within the class library project.
Please correct me, this whining fool, enlighten me as to how.. or to why such a simple thing meets with the obstruction due a heinous crime.