为Asp.net MVC资源文件的最佳实践 [英] Best Practice for Asp.net MVC Resource Files
问题描述
什么是下面的资源文件的最佳使用。
What are the best usage of the following resource files.
- 属性 - >资源(菲尔的利用这一资源在DataAnnotation本地化)
- App_GlobalResources文件夹
- 文件夹App_LocalResources文件
- Properties -> Resources (Phil used this resource for localization in DataAnnotation)
- App_GlobalResources folder
- App_LocalResources folder
我也想知道什么是(1)和(2)在asp.net MVC应用程序之间的差异。
I also would like to know what is the difference between (1) and (2) in asp.net mvc application.
谢谢,结果
梭萌
Thanks,
Soe Moe
推荐答案
您应该避免 App_GlobalResources文件
和 App_LocalResources文件
。
像克雷格提到,有与 App_GlobalResources文件
/ App_LocalResources文件
的问题,因为你不能在ASP.NET外访问它们运行。如何这将是问题的一个很好的例子就是当你单元测试你的应用程序。
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。斯科特·艾伦的博客上讲述这个前一阵子。他确实在ASP.NET MVC与 App_GlobalResources文件
说明问题的一个好工作<一个href=\"http://odeto$c$c.com/Blogs/scott/archive/2009/07/16/resource-files-and-asp-net-mvc-projects.aspx\"相对=nofollow>这里。
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.
这篇关于为Asp.net MVC资源文件的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!