简体   繁体   中英

Silverlight 4 and the System.Data.Entity.Design Namespace

BACKGROUND

I'm trying to write some string extension methods that utilize the following methods out of the PluralizationService Class :

PluralizationService.IsPlural()

PluralizationService.IsSingular()

PluralizationService.Pluralize()

PluralizationService.Singularize()



EXTENSION METHODS

public static string Pluralize(this string word)
{
    var svc = PluralizationService.CreateService(Thread.CurrentThread.CurrentCulture);
    return svc.IsSingular(word) ? svc.Pluralize(word) : word;
}

public static string Singularize(this string word)
{
    var svc = PluralizationService.CreateService(Thread.CurrentThread.CurrentCulture);
    return svc.IsPlural(word) ? svc.Singularize(word) : word;
}



PROBLEM

In Silverlight 4 I'm not able to see the System.Data.Entity.Design Namespace when choosing references. How can I reference this and use my extension methods?

Yeah, entity framework is likely not included in Silverlight. There are other alternatives that exist already that could be used in silverlight (likely). Check out this other answer for other options like subsonic's pluralizer or castle's inflector

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM