Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Feature: UpForGrabs: Turn pluralization & singularization into a pluggable service [599]

$
0
0
This would allow anyone to implement non-English version of the service and configure it using a resolver.
Comments: As a non “en-us” locale user, this item is very interesting for me and I’d like to contribute to it. Reviewing the current code of PluralizationService and related elements, I’d propose the following: · Change the name from “PluralizationService” to “Inflector”, which is more commonly used for this service purpose in other technologies (Hibernate, Raven...). · Create a fallback system for the different implementations of Inflector instances, similar to the current fallback manager in System.Resources · Use the Locator to solve all the registered Inflectors in InflectorFallbackManager, and if nothing is registered use the neutral //The current pluralize service public class NeutralInflector : IInflector { } //a new inflector, public class SpanishInflector : IInflector { } public class InflectorFallbackManager { IInflector GetInflector(CultureInfo currentCulture); } Another interesting thing will be to allow the user to register key value pairs of custom words, similar to the current ICustomPluralizationMapping, but as a public service, without the need to create a new Inflector. This new keys would be applied to whichever Inflector was selected by the fallback manager. The next step could be adding a new mechanism in DbModelBuilder to indicate the culture for a specific item, overriding the current culture in the process of solving which Inflector to use. UnaiZorrilla

Viewing all articles
Browse latest Browse all 10318

Trending Articles