我得到了例外:InvalidOperationException: The original state instance has the wrong type.
使用以下缩减代码的版本时:
Table existing = context.Tables.Single(t => t.Key == derivedFromTable.Key);
context.Tables.Attach((Table)derivedFromTable, existing); //thrown here
context.SubmitChanges();
哪里derivedFromTable is DerivedFromTable
和class DerivedFromTable : Table
。
这个例外是什么意思(清楚地((Table)derivedFromTable) is Table
和existing is Table
),我该如何解决?