RIA 服务本地化,资源文件放置在哪里
我有以下解决方案:
- SomeProject.Ria(非Silverlight代码)
- SomeProject.Ria.Silverlight(Silverlight轻代码,命名空间仍然是SomeProject.Ria)
- SomeProject.Ria.MyServices(RIA服务域服务)
- SomeProject.Ria.MyServices.Proxies( RIA 服务 Silverlight 生成的代码)
- SomeProject.Shell(Silverlight 应用程序)
- SomeProject.Web(Web 应用程序)
我想将资源文件用于 SomeProject.Ria.MyServices 中元数据类的注释。
其格式似乎是:
[Required(AllowEmptyStrings=false,ErrorMessageResourceName="ThisFieldIsRequired", ErrorMessageResourceType(MyResource))]
MyResource 属于哪个项目? (假设有一天我需要支持其他文化文件)。
此外,这里使用的字符串似乎确实会产生错误的空间,是否有可能做这样的事情并仍然实现本地化,或者这只是被编译到元数据中?如果不是,我怎样才能绕过资源名称作为字符串?
[Required(AllowEmptyStrings=false,ErrorMessage=MyResources.RequiredMessage)]
I have the following Solution:
- SomeProject.Ria (non Silverlight code)
- SomeProject.Ria.Silverlight (Silverlight light code, namespace is still SomeProject.Ria)
- SomeProject.Ria.MyServices (RIA Services Domain Service)
- SomeProject.Ria.MyServices.Proxies (RIA Services Silverlight Generated Code)
- SomeProject.Shell (Silverlight Applicaiton)
- SomeProject.Web (Web Application)
I would like to use Resource Files for my Annotations on the meta data class in SomeProject.Ria.MyServices.
The format for that appears to be:
[Required(AllowEmptyStrings=false,ErrorMessageResourceName="ThisFieldIsRequired", ErrorMessageResourceType(MyResource))]
Which project does MyResource belong in? (Assuming that someday I need to support other culture files).
Also the use of the string in here really seems to breed room for error, is it possible to do something like this and still achieve localization, or does this just get compiled into the meta data? If not, how can I get round the resource name being a string?
[Required(AllowEmptyStrings=false,ErrorMessage=MyResources.RequiredMessage)]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我被引导到 Brad Abrams 最近发表的一篇文章,其中概述了我需要了解的内容:
http://blogs.msdn.com/brada/archive/2010/03/22/silverlight-4-ria-services -ready-for-business-localizing-business-application.aspx
I was directed to a very recent post from Brad Abrams that outlines what I needed to know:
http://blogs.msdn.com/brada/archive/2010/03/22/silverlight-4-ria-services-ready-for-business-localizing-business-application.aspx