While reading an article on EF 4, I read that EF pluralizes certain objects (EntitySet’s, Navigation’s pointing to EntityCollection’s, etc.), while using the singular form for other objects. Out of curiosity – how does it do this ? Is it using a built-in dictionary ?
Thanks,
Scott
Microsoft added a
PluralizationServicebase abstract class to the .NET framework – which can be used for other purposes as well!See a great blog post on EF Pluralization which explains it in great detail. Microsoft provides a few concrete implementations of that service in various languages / cultures, but you’re totally free to roll your own.
I don’t know for a fact how the EF4 provided pluralization services work – but most likely it’s a combination of certain linguistic rules, and a plethora of exceptions to handle differently. Those are most likely stored as resources or in some other way inside the relevant assemblies.