I have a big ASP.NET MVC application database first and Entity Framework. It works fine with db first. I want to change application to Code first. And as a result I have error:
{"Invalid column name 'ID'"}
Also I have some inheritance classes.
All foreign keys mapped into OnModelCreating method and into classes as [ForeignKey("class name")] attribute
This is part of my code:
[Table("Member")]
public partial class Member
{
public Member() {}
public int ID { get; set; }
[ForeignKey("Seed1")]
public int? SeedID { get; set; }
public virtual Seed Seed1 { get; set; }
...
}
[Table("Seed")]
public partial class Seed : Member
{
public Seed()
{
Members = new HashSet<Member>();
}
public int Locale { get; set; }
public virtual ICollection<Member> Members { get; set; }
...
}