In my application I receive the following error:
The context cannot be used while the model is being created.
I\'m not sure what
Solved by the following:
I had the same issue in my application and resolved by using the below.
Verify your Model names and the table names and it should be matched.
Datatype and Column names used in the model and the database table column name/ Datatype should be matched.
use the below code in your Context class
Public class MVCRepositoryContext : DbContext
{
static MVCRepositoryContext()
{
Database.SetInitializer < mvcrepositorycontext > (null);
}
public MVCRepositoryContext():base("MVCRepositoryContext"){ }
public virtual DbSet Customers { get; set; }
public virtual DbSet Books { get; set; }
public virtual DbSet Authors { get; set; }
}