今天在进行C#winform开发时,使用Z.EntityFramework.Extensions进行批次更新插入到sqlserver数据库时,报错:
An error occured while resolving mapping by name. See the inner exception for details.
Inner Exception: Missing Colum : Discriminator
On entity : WeighDatas
On Table : [dbo].[WeighDatas]

看了下实体类WeighDatas没有外键之类的呀,数据库中的表也没少字段,也没有Discriminator这个字段.网上找了一翻才发现,原来是我有个子类WeighRaw继承了WeighDatas这个类,所以导致了这个错误,只要在子类属性中设置为[NotMapped]即可.如图

Missing Colum Discriminator On entity

NotMapped在System.ComponentModel.DataAnnotations.Schema命名空间下.

以上就是【C#EF报错 Missing Colum : Discriminator On entity】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论