2013-02-18 62 views
0

異常消息解決這一例外:需要在代碼

The number of members in the conceptual type 'Model' does not match with the number of members on the object side type 'Model'. Make sure the number of members are the same. 

我不是很確定我需要張貼,因爲有很多它什麼代碼。我正在使用MEF或者我喜歡稱之爲「魔術」的東西,而我對它不是很熟悉。

可能的相關代碼:

public ObjectSet<BasicAccount> BasicAccounts 
    { 
     get 
     { 
      if ((_BasicAccounts == null)) 
      { 
       **_BasicAccounts = base.CreateObjectSet<BasicAccount>("BasicAccounts");** 
      } 
      return _BasicAccounts; 
     } 
    } 

周圍是當發生異常星線。如果您需要查看了代碼,只是讓我知道,我會盡量快張貼

AccountRepository acctRep = new AccountRepository(); 
ObservableCollection<BasicAccount> Accounts = new ObservableCollection<BasicAccount>(acctRep.GetBasicAccountList().Cast<BasicAccount>()); 

這是這行代碼後扔在另一個類執行。

任何幫助表示讚賞!

+0

當用谷歌搜索錯誤的結果都指向實體Franework不是MEF。似乎你的標籤已被修復。 – 2013-02-18 16:57:08

回答

0

嗨這個錯誤意味着代表你的模型的生成的類不與你的模型定義xml同步。嘗試再生他們(通過移動EF設計師的東西或右鍵單擊EDMX文件並選擇運行自定義工具)。我希望這將有所幫助。

+0

謝謝!它運行良好,我不必手動通過並找到問題! – JLott 2013-02-19 16:01:42