I am converting from EF6 to ASP.NET Core 5. Like many, I am confounded trying to migrate a DB from EF to Core. This is my own db, not Identity. Identity seems to be a different can of worms for db migration.
I think my biggest problem when trying to do add-migration then update-database is that
public DbSet<EmailDTO> Emails { get; set; }
in EF creates a db table named EmailDTO whereas Core creates a db table named Emails. This can be seen in the ToTable command inside the migration file.
Can someone confirm? Is there some simple way to sync up class and db table names other than modifying a lot of code? And I wonder why this change.
Try this using dbcontext fluent api
modelBuilder.Entity<EmailDTO>().ToTable("Emails");
or if you prefer attributes
[Table("Emails")]
public class EmailDTO
{
//---- your code
}