I know This question is duplicate I found one solution too but this is four year old question and I think in these years the EntityFramework is on different level so I want to ask this question again. Here is the answer which I found and try to apply on entity Framework 5.0 but does not work
The model backing the <Database> context has changed since the database was created
here is my entity model classes first one is this
public class Student
{
public int StudentId {get; set;}
[StringLength(250),Required]
public string StudentName {get; set;}
[StringLength(20),Required]
public string Standard {get; set; }
[StringLength(250),Required]
public string Address {get; set; }
[StringLength(250),Required]
public string Emailid {get; set; }
[StringLength(12),Required]
public string Phoneno {get; set; }
}
and Second Model Class is this
public class Marks
{
public int MarksID { get; set; }
public int StudentId { get; set; }
public int English { get; set; }
public int Maths { get; set; }
public int Science { get; set; }
public int SocialStudy { get; set; }
public int Hindi { get; set; }
public int Total { get; set; }
public Student student { get; set; }
}
and this is my context class
public class DBContext:DbContext
{
public DBContext()
{
Database.SetInitializer<DbContext>(new DropCreateDatabaseAlways<DbContext>());
}
public DbSet<Student> TbStudent { get; set; }
public DbSet<Marks> TbMarks { get; set; }
}
I run this code and Getting this error
The model backing the 'DBContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
Please expert help me regarding this issue