How do I singularize my tables in EF Code First?
Solution 1:
You've removed the wrong convention (PluralizingEntitySetNameConvention) for this purpose. Just replace your OnModelCreating method with the below and you will be good to go.
using System.Data.Entity.ModelConfiguration.Conventions.Edm.Db;
...
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
With Entity Framework 6, on your file that inherit from DbContext:
using System.Data.Entity.ModelConfiguration.Conventions;
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
Solution 2:
You can also change the property value:
On the Tools menu, click Options. In the Options dialog box, expand Database Tools. Click O/R Designer. Set Pluralization of names to Enabled = False to set the O/R Designer so that it does not change class names. Set Pluralization of names to Enabled = True to apply pluralization rules to the class names of objects added to the O/R Designer.
Solution 3:
The location of the definition of PluralizingTableNameConvention has moved to:
using System.Data.Entity.ModelConfiguration.Conventions;