0

can ef5 work with mysql when using code first approach? when i'm trying to add new items to a not yet created table I'm getting "Table 'clients' doesn't exist. if I'm switching to mssql everything works well.

this is my dbcontext

    public class MyDBContext : DbContext
{
    public PowerToolsDBContext()
        : base("Name=MyContext") { }

    public DbSet<User> Users { get; set; }
    public DbSet<Client> Clients { get; set; }
    public DbSet<JobData> Jobs { get; set; }
}

1 Answer 1

1

Problem solved after adding database initializer

 static MyDBContext()
    {
        Database.SetInitializer<MyDBContext>(new DropCreateDatabaseIfModelChanges<MyDBContext>());
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.