How to handle local and global resources outside of the web project with ASP.NET MVC
I am currently in a couple of minds about how to organize local and global resources inside an ASP.NET MVC project. My current thinking is to have a global reso开发者_StackOverflow中文版urce file and to separate local resource files by the controller.
I have chosen the controller so that I can group any resources I need for any of the views which use the said controller. If I abstract these resources into a separate assembly I can use these resources in the following ways:
- Normal inside the markup
- With client side code using a handler
- Inside validation attributes
I have read arguments that managing multiple files can lead to duplication of the resources, but I have also seen the same resources being named differently inside the same resource file.
ALso, however number of resource files there are, they will be compiled down into their own dll for that said assembly based on the culture.
I am looking for advice on whether it is a good idea to use many resource files over one global and whether or not grouping these said resources by controller is a good idea.
TIA
Andrew
I would go with separate files. Resx are hard to merge, because they are xml. If you have this one global resx merging will be a pain.
Yes you will have duplicate resx-entries. But that will be a problem either way.
Not shure about separating by controller. I separate by View, but I guess thats because I am used to separate by aspx in old school ASP.NET.
精彩评论