our existing code/schema follows the pattern of:
- table name = plural
- entity = singular
- entity collection = plural
So, a table called 'Dinners', a DbSet called Dinners, and a class name of Dinner (singular). As an example, this is the pattern used by the 'Nerd Dinner' sample - https://nerddinner.codeplex.com/SourceControl/latest#mvc4/NerdDinner/Models/NerdDinnerContext.cs
The Pluralization service handles both Pluralize() and Singularize(), and can be accessed by having a reference to the .Net Framework's System.Data.Entity.Design.dll and use its static CreateService call, like so:
var service = System.Data.Entity.Design.PluralizationServices.PluralizationService.CreateService(new System.Globalization.CultureInfo("en-US"));
and some quick testing shows it leaves singular nouns as singular, plural ones as plural (as you'd expect)
****
var service = System.Data.Entity.Design.PluralizationServices.PluralizationService.CreateService(new System.Globalization.CultureInfo("en-US"));
Console.WriteLine ("Pluralize of Dinner is {0}", service.Pluralize("Dinner"));
Console.WriteLine ("Pluralize of Dinners is {0}", service.Pluralize("Dinners"));
Console.WriteLine ("Singularize of Dinner is {0}", service.Singularize("Dinner"));
Console.WriteLine ("Singularize of Dinners is {0}", service.Singularize("Dinners"));
****
output:
****
Pluralize of Dinner is Dinners
Pluralize of Dinners is Dinners
Singularize of Dinner is Dinner
Singularize of Dinners is Dinner
****
Comments: Very useful tool you've created. Well done. However, this issue is pretty much a show stopper for using it in an existing project in place of the standard EF generator, which is what I was hoping to use it for.
- table name = plural
- entity = singular
- entity collection = plural
So, a table called 'Dinners', a DbSet called Dinners, and a class name of Dinner (singular). As an example, this is the pattern used by the 'Nerd Dinner' sample - https://nerddinner.codeplex.com/SourceControl/latest#mvc4/NerdDinner/Models/NerdDinnerContext.cs
The Pluralization service handles both Pluralize() and Singularize(), and can be accessed by having a reference to the .Net Framework's System.Data.Entity.Design.dll and use its static CreateService call, like so:
var service = System.Data.Entity.Design.PluralizationServices.PluralizationService.CreateService(new System.Globalization.CultureInfo("en-US"));
and some quick testing shows it leaves singular nouns as singular, plural ones as plural (as you'd expect)
****
var service = System.Data.Entity.Design.PluralizationServices.PluralizationService.CreateService(new System.Globalization.CultureInfo("en-US"));
Console.WriteLine ("Pluralize of Dinner is {0}", service.Pluralize("Dinner"));
Console.WriteLine ("Pluralize of Dinners is {0}", service.Pluralize("Dinners"));
Console.WriteLine ("Singularize of Dinner is {0}", service.Singularize("Dinner"));
Console.WriteLine ("Singularize of Dinners is {0}", service.Singularize("Dinners"));
****
output:
****
Pluralize of Dinner is Dinners
Pluralize of Dinners is Dinners
Singularize of Dinner is Dinner
Singularize of Dinners is Dinner
****
Comments: Very useful tool you've created. Well done. However, this issue is pretty much a show stopper for using it in an existing project in place of the standard EF generator, which is what I was hoping to use it for.