public class Movie
{
public int Id { get; set; }
[Required]
[StringLength(255)]
public string Name { get; set; }
public virtual IList<Genre> Genre { get; set; }
public virtual IList<Cast> cast { get; set; }
[Display(Name = "Release Date")]
public DateTime ReleaseDate { get; set; }
}
public class Genre
{
public int Id { get; set; }
[Required]
[StringLength(255)]
public String Name { get; set; }
}
These are 2 of my models. They work perfectly well, except auto increment isn't implemented on the primary key.
I'm getting error of the id being null and not be able to insert into the database which seems logic to me. Any ideas why there aren't any auto increments and secondly how can I add them? I'm using code-first migration in .NET Framework 4.6, it's a Winforms application.