Silverlight的共享类的RIA服务导致生成错误

编程入门 行业动态 更新时间:2024-10-24 22:30:46
本文介绍了Silverlight的共享类的RIA服务导致生成错误-The型'X'已经包含了'Y'的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在哪里,我利用共享类的Silverlight 4的应用程序。在名.web项目中,我有一个名为X.Shared.cs级。这个类有三个字符串属性。当我构建应用程序,它提供了一个错误说之类的'X'已经包含了'Y'的定义。看来,在Silverlight应用程序生成的代码的性能被视为重复。我试图清理我的解决方案和重建,现在这有助于每一个,然后,但完全不相符。

I have a Silverlight 4 application where I am making use of shared classes. In the .Web project, I have a class called "X.Shared.cs". This class has three string properties. When I build the application, it gives an error saying "The type 'X' already contains a definition for 'Y'". It seems that the properties in the generated code in the Silverlight Application are being seen as duplicates. I have tried cleaning my solution and rebuilding, this helps every now and then but is totally inconsistent.

有没有人有这个问题的经验? ?难道我也许做错了什么。

Has anyone had experience in this issue? Am I perhaps doing something wrong?

有关共享类(X.Shared.cs)的代码如下:

The code for the shared class (X.Shared.cs) is as follows:

public partial class VideoItem { [Key] public String ID { get; set; } public String ImageURL { get; set; } public String URL { get; set; } }

下面是解决方案资源管理器中显示生成的屏幕截图共享文件:

Here is a screenshot of the solution explorer showing the generated shared file:

推荐答案

要解决这个问题,我创建了一个包含没有属性的空白.shared.cs类(这显然是一个局部类)。然后,我创建了另一个部分类与类名相同的命名空间,并在这里我把我所需要访问的所有属性。

To solve this problem, I created a blank .shared.cs class containing no properties (this is obviously a partial class). I then created another partial class in the same namespace with that class name and in here I put all the properties I needed to access.

更多推荐

Silverlight的共享类的RIA服务导致生成错误

本文发布于:2023-11-09 10:24:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572128.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   Silverlight   RIA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!