1

Given class animal when using Entity Framework:

public class MyDbContext : DbContext
{
    public DbSet<animal> abc_animals { get; set; }
}

Does the property name abc_animals matter? I was hoping this would control the table name without having to use annotations but apparently not. It's annoying if I want to prefix all my table-names with the same string.

Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
  • Guess this might help: http://stackoverflow.com/questions/12633015/how-to-add-table-prefix-in-entity-framework-code-first-globally – Zein Makki Jul 15 '16 at 10:30
  • Yeah that's very cool... but orginal question stands, does my property name make any difference at all? – Mr. Boy Jul 15 '16 at 10:36

1 Answers1

1

Source : Here

In past pre-release of EF Core, the table name for an entity was the same as the entity class name. In RC2 we now use the name of the DbSet property. If no DbSet property is defined for the given entity type, then the entity class name is used.

Table Naming Convention Changes

A significant functional change we took in RC2 was to use the name of the DbSet property for a given entity as the table name it maps to, rather than just the class name. You can read more about this change in the related announcement issue.

Zein Makki
  • 29,485
  • 6
  • 52
  • 63
  • Is this for upcoming EF7? – Mr. Boy Jul 15 '16 at 10:49
  • 1
    @Mr.Boy Already released : https://docs.efproject.net/en/latest/miscellaneous/rc1-rc2-upgrade.html#table-naming-convention-changes – Zein Makki Jul 15 '16 at 11:00
  • Ah OK this was released in the RC, but it is still _in_ RC status. Isn't this a breaking change when EF7 is released, for any project which automatically updates to v7? – Mr. Boy Jul 15 '16 at 11:02
  • @Mr.Boy The previous link in the comments have the update strategy stated for table names when moving from RC1 to RC2. Sorry but I don't really have any additional information on this matter as I stopped using EF since a while. – Zein Makki Jul 15 '16 at 11:08