RIA 服务本地化,资源文件放置在哪里

发布于 2024-08-27 04:47:27 字数 823 浏览 10 评论 0原文

我有以下解决方案:

  1. SomeProject.Ria(非Silverlight代码)
  2. SomeProject.Ria.Silverlight(Silverlight轻代码,命名空间仍然是SomeProject.Ria)
  3. SomeProject.Ria.MyServices(RIA服务域服务)
  4. SomeProject.Ria.MyServices.Proxies( RIA 服务 Silverlight 生成的代码)
  5. SomeProject.Shell(Silverlight 应用程序)
  6. 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:

  1. SomeProject.Ria (non Silverlight code)
  2. SomeProject.Ria.Silverlight (Silverlight light code, namespace is still SomeProject.Ria)
  3. SomeProject.Ria.MyServices (RIA Services Domain Service)
  4. SomeProject.Ria.MyServices.Proxies (RIA Services Silverlight Generated Code)
  5. SomeProject.Shell (Silverlight Applicaiton)
  6. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

山人契 2024-09-03 04:47:27

我被引导到 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文