无法将值NULL插入列BLAH表BLAH列不允许空值.INSERT失败

Fit*_*ure 1 entity-framework entity-framework-5

我有一个域实体

[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
Run Code Online (Sandbox Code Playgroud)

Id属性上设置,但EF仍尝试在尝试保存时插入空值.这是个常见的问题吗?这是它的样子的一个例子.

public class Invoice
{   
    [Key]
    [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }
    public ShippingInformation ShippingInformation{ get; set; }
    public BillingInformation BillingInformation { get; set; }
    public decimal Subtotal { get; set; }
    public User user { get; set; }
    public bool Processed { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

Ste*_*eve 8

实体框架中存在一个错误,其中迁移无法正确检测对其的更改DatabaseGeneratedOption.

有关问题的说明以及如何重新创建问题的示例,请参阅Codeplex网站上的Entity Framework页面上的此问题.