PluralizationService.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntityDesign / Design / System / Data / Entity / Design / PluralizationService / PluralizationService.cs / 1305376 / PluralizationService.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 
using System;
using System.Collections.Generic; 
using System.Linq;
using System.Text;
using System.Globalization;
using System.Data.Entity.Design.Common; 

namespace System.Data.Entity.Design.PluralizationServices 
{ 
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Pluralization")]
    public abstract class PluralizationService 
    {
        public CultureInfo Culture { get; protected set; }

        public abstract bool IsPlural(string word); 
        public abstract bool IsSingular(string word);
        public abstract string Pluralize(string word); 
        public abstract string Singularize(string word); 

        ///  
        /// Factory method for PluralizationService. Only support english pluralization.
        /// Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator
        /// to extend the service to other locales.
        ///  
        /// CultureInfo
        /// PluralizationService 
        public static PluralizationService CreateService(CultureInfo culture) 
        {
            EDesignUtil.CheckArgumentNull(culture, "culture"); 

            if (culture.TwoLetterISOLanguageName == "en")
            {
                return new EnglishPluralizationService(); 
            }
            else 
            { 
                throw new NotImplementedException("We don't support locales other than english yet");
            } 
        }
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 
using System;
using System.Collections.Generic; 
using System.Linq;
using System.Text;
using System.Globalization;
using System.Data.Entity.Design.Common; 

namespace System.Data.Entity.Design.PluralizationServices 
{ 
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Pluralization")]
    public abstract class PluralizationService 
    {
        public CultureInfo Culture { get; protected set; }

        public abstract bool IsPlural(string word); 
        public abstract bool IsSingular(string word);
        public abstract string Pluralize(string word); 
        public abstract string Singularize(string word); 

        ///  
        /// Factory method for PluralizationService. Only support english pluralization.
        /// Please set the PluralizationService on the System.Data.Entity.Design.EntityModelSchemaGenerator
        /// to extend the service to other locales.
        ///  
        /// CultureInfo
        /// PluralizationService 
        public static PluralizationService CreateService(CultureInfo culture) 
        {
            EDesignUtil.CheckArgumentNull(culture, "culture"); 

            if (culture.TwoLetterISOLanguageName == "en")
            {
                return new EnglishPluralizationService(); 
            }
            else 
            { 
                throw new NotImplementedException("We don't support locales other than english yet");
            } 
        }
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK