I have existing database. Then new requirement came for more tables so I created model and used code first approach to generate tables to existing db.
But when I run command
Enable-Migrations -ContextTypeName ListHell.CODE.flagen -force
I get error
Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.
I have checked all the answer related to it on SO but all are useless to my case
my dbcontext class
public partial class flagen:DbContext
{
public flagen() : base("name=LH_newEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<flag> flags { get; set; }
}
thanksfor help
flagenis also a db-first context because it has thepartialkeyword - Panagiotis Kanavos