我查看了这篇帖子,并尝试按照以下方式完成:
使用Entity Framework CTP5自动生成主键(GUID)
[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命令时,就会出现这种情况。