RIA 服务库和元属性中的资源字符串
我已将域服务拆分为单独的 WCF RIA 服务类库项目。然而,现在在客户端库中使用资源字符串似乎存在问题。
例如,
客户端项目库生成了如下代码:
[DataMember()]
[Display(Description="FullNameDescription", Name="FullNameLabel", Order=-1, ResourceType=typeof(MetadataStrings))]
[StringLength(255, ErrorMessageResourceName="BadFullNameLength", ErrorMessageResourceType=typeof(MetadataStrings))]
public string FullName
{
// ...
}
其中MetadataStrings 是类库中的资源文件。然后该类库被 silverlight 项目引用。
但是使用 ResourceType 的元属性会导致设计器在打开视图时引发异常,并在运行时导致 MissingManifestResourceException。
如果我注释掉属性并重建它,一切都会正常。那么我猜资源在另一个程序集中有什么问题吗?
编辑:没关系终于得到了这个工作,问题是我重命名了我的类库项目并且资源文件的命名空间是错误的。浪费了3天时间。
I've split out my domain services into a separate WCF RIA Services Class Library project. However there now seems to be a problem with using the resource strings in the client side library.
e.g.
The client project library has generated code like this:
[DataMember()]
[Display(Description="FullNameDescription", Name="FullNameLabel", Order=-1, ResourceType=typeof(MetadataStrings))]
[StringLength(255, ErrorMessageResourceName="BadFullNameLength", ErrorMessageResourceType=typeof(MetadataStrings))]
public string FullName
{
// ...
}
where MetadataStrings is a resource file in the class library. This class library is then referenced by the silverlight project.
But the meta attributes that use ResourceType cause the designer to throw an exception when opening a view and at runtime cause a MissingManifestResourceException.
If I comment out the attributes and rebuild it all works fine. So something is not right with the resources being in another assembly i'm guessing?
Edit: Nevermind finally got this working, problem was that i renamed my class library projects and the namespace of the resource file was wrong. 3 days wasted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论