2011-03-30 70 views
0

我已經爲我的一個ria服務實體添加了一個客戶端屬性,但由於某種原因,它給了我的警告「類型」OLG.Entities.ViewList「in」...的.cs OLG.Entities.ViewList「中‘’與進口類型衝突」 .... DLL」爲Ria服務添加客戶端屬性

現在我明白了錯誤信息的意思,但爲什麼會發生衝突,而不是合併類?

我的客戶側部局部類:

namespace OLG.Entities 
{ 
public partial class ViewList : Entity 
{ 
    private bool _isSelected; 

    /// <summary> 
    /// This is used to add a client side property to the Ria Entity that will not be used on the model side (database) 
    /// </summary> 
    public bool IsSelected 
    { 
     get { return _isSelected; } 
     set { 
      if (_isSelected != value) 
      { 
       _isSelected = value; 
       this.RaisePropertyChanged("IsSelected"); 
      } 
     } 
    } 
} 

作爲一個側面說明生成的類不在SAM e Silverlight項目作爲新的部分類

回答

1

不能有跨2個部件的部分類。

看到這個類似的問題...

Is it possible to have two partial classes in different assemblies represent the same class?

+1

通過18秒毆打!詛咒! – 2011-03-30 10:11:18

+0

@Vincent當這種情況發生時,這不是很可怕嗎?抱歉。看起來你的答案無論如何都會被接受。它看起來比我的更好。 – BenCr 2011-03-30 10:13:40

+0

@ Vincent @BenCr謝謝你們,我很感激,雖然這很糟糕:-( – 2011-03-30 10:17:07

1

如前所述here

你不能指的是同一類兩種不同 組件兩個部分類 (項目) 。一旦編譯了程序集 ,就會烘焙出 元數據,並且您的類不再是部分。部分 類允許您將同一類的 定義拆分爲兩個 文件。

所以,錯誤的原因是事實,

生成的類是不在同一 Silverlight項目作爲新的部分 類