樱丶玉溪

导航

報錯:One or more validation errors were detected during model generation:System.Data.Edm.EdmEntityType: : EntityType 'Movie' has no key

報錯:One or more validation errors were detected during model generation:System.Data.Edm.EdmEntityType: : EntityType 'Movie' has no key defined. Define the key for this EntityType.

 

 

解决方法,看你报错的那个表,然后添加一个一个主键标识  [Key],以及引用一下using System.ComponentModel.DataAnnotations;

一定要记得类名和数据库表名字是有单复数之别的,比如我的Movie.cs,数据库中表名是Movies

posted on 2014-10-28 11:39  五粮液和  阅读(780)  评论(0编辑  收藏  举报