MVC EntityType has no key defined

关于MVC EntityType has no key defined的问题,如下:

 

image

可以采用在该字段上面再添加一个[Key]来解决。要先引用:

using System.ComponentModel.DataAnnotations;

[Key]
public int ProId { get; set; }

 

image

 

 

参考文献:

http://www.cnblogs.com/haisa/archive/2011/08/09/2131746.html