【发布时间】:2014-10-31 22:13:23
【问题描述】:
我在 WPF 项目下创建了数据库优先实体数据模型。然后我添加了一个 DataGrid 并将其绑定到模型。我一直在尝试添加 CRUD 功能。
一切都很好,直到我添加了一个按钮并绑定了它的点击事件来保存更新的数据。单击此按钮后,我会收到以下运行时错误。
System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details.
所以我检查了内部异常并得到以下信息:
System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details.—> System.NotSupportedException: Modifications to tables where a primary key column has property 'StoreGeneratedPattern' set to 'Computed' are not supported. Use 'Identity' pattern instead. Key column: 'Symbol_and_BenchmarkID'. Table: 'BenchMarkModel.Store.Weights'.
StoreGeneratePattern 在哪里,我可以解决这个问题吗?
【问题讨论】:
标签: c# wpf entity-framework