src/Misc/EFTools/EntityDesignModel/ModelHelper.cs
/// <summary>
///     Constructs a proposed NavigationProperty name given an EntityType name and the multiplicity
/// </summary>
/// <param name="pluralizationService"></param>
/// <param name="otherEndEntityName">name of the EntityType to which this NavigationProperty will point</param>
/// <param name="otherEndMultiplicity">Note: should be a constant value from ModelConstants, not a localized text string</param>
/// <returns></returns>
Constructs a proposed NavigationProperty name given an EntityType name and the multiplicity
Constructs a proposed NavigationProperty name given an EntityType name and the multiplicity
internal static string ConstructProposedNavigationPropertyName(
            IPluralizationService pluralizationService,
            string otherEndEntityName, string otherEndMultiplicity)
        {
            Debug.Assert(!string.IsNullOrEmpty(otherEndEntityName), "otherEndEntityName should not be null or empty");
            Debug.Assert(!string.IsNullOrEmpty(otherEndMultiplicity), "otherEndMultiplicity should not be null or empty");
            if (string.IsNullOrEmpty(otherEndEntityName))
            {
                return string.Empty;
            }
            if (string.IsNullOrEmpty(otherEndMultiplicity))
            {
                return otherEndEntityName;
            }
            if (pluralizationService == null)
            {
                return otherEndEntityName;
            }
            else
            {
                if (ModelConstants.Multiplicity_Many.Equals(otherEndMultiplicity))
                {
                    return pluralizationService.Pluralize(otherEndEntityName);
                }
                else
                {
                    return pluralizationService.Singularize(otherEndEntityName);
                }
            }
        }
internal static string ConstructProposedNavigationPropertyName ( IPluralizationService pluralizationService , string otherEndEntityName , string otherEndMultiplicity ) { Debug . Assert ( ! string . IsNullOrEmpty ( otherEndEntityName ) , " " ) ; Debug . Assert ( ! string . IsNullOrEmpty ( otherEndMultiplicity ) , " " ) ; if ( string . IsNullOrEmpty ( otherEndEntityName ) ) { return string . Empty ; } if ( string . IsNullOrEmpty ( otherEndMultiplicity ) ) { return otherEndEntityName ; } if ( pluralizationService == null ) { return otherEndEntityName ; } else { if ( ModelConstants . Multiplicity_Many . Equals ( otherEndMultiplicity ) ) { return pluralizationService . Pluralize ( otherEndEntityName ) ; } else { return pluralizationService . Singularize ( otherEndEntityName ) ; } } }
Constructs a proposed NavigationProperty name given an EntityType name and the multiplicity
Constructs a proposed NavigationProperty name given an EntityType name and the multiplicity
// should never happen - just for safety // cannot determine other end multiplicity - just return otherEndEntityName // indicates pluralization not needed so just return otherEndEntityName // other end multiplicity is plural and other end has non-plural name so pluralize the name // other end multiplicity is non-plural and other end has plural name so singularize the name
None
pluralizationService
IPluralizationService
None
otherEndEntityName
string
name of the EntityType to which this NavigationProperty will point
name of the EntityType to which this NavigationProperty will point
otherEndMultiplicity
string
should be a constant value from ModelConstants, not a localized text string
should be a constant value from ModelConstants not a localized text string