Почему `DatabaseGenerated (DatabaseGeneratedOption.Identity )`не работает в MVC 4

Я пытался перенести свой проект MVC 3 на MVC 4, но когда захотел переместить эту модель:

public class Link
{
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public Guid ID { get; set; }

    [DisplayName("Shorted URL")]
    public string SURL { get; set; }

    [DisplayName("General Link")]
    public string OriginalURL { get; set; }

    [DisplayName("Click Count")]
    public int ClickCount { get; set; }
}

public class LinkDBContext : DbContext
{
    public DbSet<Link> Links { get; set; }
}

Я получил ошибку с атрибутом [System.ComponentModel.DataAnnotations.(DatabaseGeneratedOption.Identity)]. Я не знаю, в чем проблема. Кто-нибудь знает?!?

Обновление

Это ошибки:

The type or namespace name 'DatabaseGeneratedAttribute' could not be found (are you missing a using directive or an assembly reference?)

The type or namespace name 'DatabaseGenerated' could not be found (are you missing a using directive or an assembly reference?)

11
задан Stacked 29 December 2016 в 16:17
поделиться