I created a simple console app that uses EF6 and MySql. Here is the connectionString in app.config:
<add name="Track" connectionString="Server=MyServer; UID=Myuserid; Pwd=Mypassword; Database=Track; " providerName="MySql.Data.MySqlClient"/>
Here is the dbcontext class:
using System;
using System.Collections.Generic;
using System.Data.Entity;
namespace EF6Console
{
/// <summary>
/// The person db context.
/// </summary>
public class PersonDbContext : DbContext
{
public PersonDbContext() : base("name=Track")
{
}
public DbSet<Person> Persons { get; set; }
}
}
In the Track database I created a table named "Persons" with the columns to match the Person class.
In program.cs I add a Person and save it. It threw an error at the constructor for PersonDbContext, saying Table "People" does not exist.
Nowhere in the solution is there a "People", including in the app.config.
I went ahead and created a "People" table with the same structure as the Persons table. After that the app works fine and the People table gets populated, not the Persons table.
Where in the world did the application come up with a "People" table???