Reputation: 14787
I want to disable pluralization for database tables which is easy enough. However, I use reflection and T4 templates to generate my context class.
public DbSet<User> User { get; set; }
public DbSet<Department> Department { get; set; }
Is there any way to use EF's to return pluralized names from within T4 templates so I can generate the following:
public DbSet<User> Users { get; set; }
public DbSet<Department> Departments { get; set; }
Some function like string name = EF.GetPluralizedName("User");
, etc.
I am using VS2010 targeting .NET 4 in case that helps.
Upvotes: 1
Views: 435
Reputation: 13599
you can use pluralization service it would be something like
string name = System.Data.Entity.Design.PluralizationServices.PluralizationService.
CreateService(System.Globalization.CultureInfo.CurrentUICulture).Pluralize("User");
Upvotes: 2