Is it advisable to use a .resx file to store common string references in a business layer class library? I typically only ever see these been used in the presentation layer.
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.
One option to be to have a separate project in your solution, which has all the resx files for your whole solution. You can then add it as a reference to your business layer. In the Resources Project, you can write a wrapper around .net ResourceManager class, to return the resource value for your key. Something on the lines of:
Then you can use it from you business layer as:
I did not have time to test the code, I have written on the fly, but it should give you the general idea. IMO, there is nothing wrong in having the resx files in a separate project.
Another way of approaching it, is to have .resx file in places where they are used. I find the separate project idea better, because that way, you can create separate folder for each type of language, and store locale specific .resx files in it.