Best practice for ASP.NET MVC resource files

后端 未结 3 1610
时光说笑
时光说笑 2020-11-30 01:31

What are the best usage of the following resource files.

  1. Properties → Resources (Phil used this resource for localization in DataAnnotation)
  2. App_Glo
3条回答
  •  北海茫月
    2020-11-30 01:44

    You should avoid App_GlobalResources and App_LocalResources. Like Craig mentioned, there are problems with App_GlobalResources/App_LocalResources because you can't access them outside of the ASP.NET runtime. A good example of how this would be problematic is when you're unit testing your app.

    K. Scott Allen blogged about this a while ago. He does a good job of explaining the problem with App_GlobalResources in ASP.NET MVC here.

提交回复
热议问题