I want my domain class name to match my db table name (no pluralisation).
In EF Core 1.1, I used this code to do that:
public static void RemovePluralisingTableNameConvention(this ModelBuilder modelBuilder)
{
foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
{
entityType.Relational().TableName = entityType.DisplayName();
}
}
In EF Core 2.0, this code doesn't compile as Relational()
is not a method on IMutableEntityType.
Anyway, in EF Core 2.0, they have added IPluralizer, documented here:
There aren't many examples to show how to achieve the same behaviour that I had before. Any clue of how to remove pluralisation in EF Core 2?
See Question&Answers more detail:os