報錯: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

05-14 12:02