我看过这篇文章并尝试这样做
Autogenerate primary key (Guid) Entity Framework CTP5
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid CompanyID { set; get; }
但是我仍然得到错误
Identity column 'CompanyID' must be of data type int,bigint,smallint,tinyint,or decimal or numeric with a scale of 0,and constrained to be nonnullable.
这是我在包管理器控制台上运行Update-Database命令的时候.
最佳答案