Can we Place Database Connection Strings in .resx file in C# Class library project type??
If so,
What are the advantages and disadvantages?
Can we Place Database Connection Strings in .resx file in C# Class library project
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can put anything you want into a resx file and read it back, there should not be any problem with that. As far as advantages go, you do not get any advantage from it compared to putting it into your application config file. On the contrary, accessing the string becomes more cumbersome, and you cannot alter them at runtime.
Generally speaking, I see little difference between putting the connection string into resx and compiling it into your code with a compile-time constant.
It goes without saying that strings with passwords in them should never go into config or resx files as plain text.