1 //---------------------------------------------------------------------
2 // <copyright file="EntityDesignPluralizationHandler.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
10 using System.Collections.Generic;
12 using System.Globalization;
13 using System.Data.Entity.Design.PluralizationServices;
14 using System.Data.Metadata.Edm;
16 using System.Data.Entity.Design.SsdlGenerator;
17 using System.Data.Entity.Design.Common;
18 using System.Diagnostics;
20 namespace System.Data.Entity.Design
22 internal class EntityDesignPluralizationHandler
25 /// user might set the service to null, so we have to check the null when using this property
27 internal PluralizationService Service
34 /// Handler for pluralization service in Entity Design
36 /// <param name="doPluralization">overall switch for the service, the service only start working when the value is true</param>
37 /// <param name="userDictionaryPath"></param>
38 /// <param name="errors"></param>
39 internal EntityDesignPluralizationHandler(PluralizationService service)
41 this.Service = service;
44 internal string GetEntityTypeName(string storeTableName)
46 return this.Service != null ? this.Service.Singularize(storeTableName) : storeTableName;
49 internal string GetEntitySetName(string storeTableName)
51 return this.Service != null ? this.Service.Pluralize(storeTableName) : storeTableName;
54 internal string GetNavigationPropertyName(AssociationEndMember toEnd, string storeTableName)
56 if (this.Service != null)
58 return toEnd.RelationshipMultiplicity == RelationshipMultiplicity.Many ?
59 this.Service.Pluralize(storeTableName) : this.Service.Singularize(storeTableName);
63 return storeTableName;