1

I'm working on a database for maritime monitoring data. I made a classic EER-Model (MySQL Workbench), generated an interim database for Entity Framework 6 Code First by Database First to get started with Entity classes and DbContext implementation. From here on out I need to use EF Migrations When I add the initial Migration the create table statements are naming the Tables like "DbContext"."TableName"**so the Database looks like **"SchemaName"."DbContext"."TableName" which is ugly AF.

I could write table names in modelbuilder fluentAPI or annotate them, but this is a hassle with a huge number of tables.

how can I alter the conventional naming? I just want the migrator to call the table like the property in DbContext derived class

  • 1
    Possible duplicate of [Howto specify table name with Entity Framework Code First Fluent API](http://stackoverflow.com/questions/20184644/howto-specify-table-name-with-entity-framework-code-first-fluent-api) – Zaheer Ul Hassan Apr 24 '17 at 09:49

1 Answers1

1

You can also use the Table annotation:

[Table("InternalBlogs")]
public class Blog

See: Code First Data Annotations

Zaheer Ul Hassan
  • 771
  • 9
  • 24
  • 1
    thank you Zaheer. Your comment pointed me to the right thing. The code first database first thing annotaded all classes with the schema name in front (which I didn't check for some reason) – Tim van Peterson Apr 24 '17 at 10:48