One option is to have a separate project in your solution that has all the resx files for your entire solution. You can then add it as a link to your business layer. In the Resources project, you can write a wrapper around the .net ResourceManager class to return the resource value for your key. Something in the lines:
public class ResourceService : IResourceService { public ResourceService() {} public GetResourceValue(string resourceFileName, string resourceKey) { var resourceManager = new ResourceManager("Myresources", Assembly.Load("MyResourcesProjectName")); return resourceManager.GetString(resourceKey); } }
Then you can use it from your business layer like:
var resourceService = new ResourceService(); var resourceValue = resourceService.GetResourceValue("MyResources", "ResourceKeyName");
I did not have time to check the code, I wrote "on the fly", but it should give you a general idea. IMO, there is nothing wrong with resx files in a separate project. Another way to approach it is to have the .resx file in the places where they are used. I find a separate project idea better, because in this way you can create a separate folder for each type of language and store local .resx files in it.
source share