我们如何解决此EntitySet中已存在具有相同标识的实体

时间:2013-03-28 05:39:43

标签: entity-framework silverlight-4.0

public BusinessAccounting.ViewModel.Account.AccountViewModel AccountVM;    


public QBImportDataWizard()
{
    InitializeComponent();                
    dcBusinessAccountingContext.Load(dcBusinessAccountingContext.GetAccountsQuery());           
}

void oQB_RetrieveQBAccountsCompleted(object sender, QBAccountsServiceReference.RetrieveQBAccountsCompletedEventArgs e)
{
    foreach (BusinessAccounting.QBAccountsServiceReference.QBAccounts acc in QBAccountlist)
    {
        AccountVM.CurrentAccount.Active = acc.Active;
        AccountVM.CurrentAccount.Hierarchy =null;
        AccountVM.CurrentAccount.HierarchyLevel = acc.Sublevel;
        AccountVM.CurrentAccount.CashFlowID = 3;
        AccountVM.CurrentAccount.OpeningBalance = null;
        AccountVM.CurrentAccount.OpeningBalanceDate = DateTime.Now;
        AccountVM.CurrentAccount.Category1099ID = null;
        AccountVM.CurrentAccount.Remarks ="";
        AccountVM.CurrentAccount.BankID = 0;//Here i am getting error.
    }
}

如果我删除QBImportDataWizard() dcBusinessAccountingContext.Load(dcBusinessAccountingContext.GetAccountsQuery());下面的行,则表示没有任何错误。让我知道为什么?

0 个答案:

没有答案