src/Misc/EFTools/EntityDesignModel/ModelHelper.cs
/// <summary>
///     Validate ComplexType property name value.
/// </summary>
/// <param name="entityType">Property's ComplexType instance.</param>
/// <param name="proposedName">The proposed property name.</param>
/// <param name="uniquenessIsCaseSensitive">A flag that indicates whether case sensitive string comparison is used to check the uniqueness of the property name.</param>
/// <param name="errorMessage">Property name validation error message.</param>
/// <returns>Return true if the property name is a valid CSDL property name and a unique name, return false otherwise.</returns>
Validate ComplexType property name value.
Validate ComplexType property name value .
internal static bool ValidateComplexTypePropertyName(
            ComplexType complexType, string proposedName, bool uniquenessIsCaseSensitive, out string errorMessage)
        {
            Debug.Assert(complexType != null, "ComplexType is null");
            if (!EscherAttributeContentValidator.IsValidCsdlPropertyName(proposedName))
            {
                errorMessage = string.Format(CultureInfo.CurrentCulture, Resources.Error_PropertyNameInvalid, proposedName);
                return false;
            }
            else if (complexType.LocalName.Value.Equals(proposedName))
            {
                errorMessage = string.Format(
                    CultureInfo.CurrentCulture, Resources.Error_MemberNameSameAsParent, proposedName, complexType.LocalName.Value);
                return false;
            }
            else if (!IsUniqueComplexTypePropertyName(complexType, proposedName, uniquenessIsCaseSensitive))
            {
                errorMessage = string.Format(
                    CultureInfo.CurrentCulture, Resources.Error_ComplexTypePropertyNameNotUnique, proposedName, complexType.LocalName.Value);
                return false;
            }
            else
            {
                errorMessage = string.Empty;
                return true;
            }
        }
internal static bool ValidateComplexTypePropertyName ( ComplexType complexType , string proposedName , bool uniquenessIsCaseSensitive , out string errorMessage ) { Debug . Assert ( complexType != null , " " ) ; if ( ! EscherAttributeContentValidator . IsValidCsdlPropertyName ( proposedName ) ) { errorMessage = string . Format ( CultureInfo . CurrentCulture , Resources . Error_PropertyNameInvalid , proposedName ) ; return false ; } else if ( complexType . LocalName . Value . Equals ( proposedName ) ) { errorMessage = string . Format ( CultureInfo . CurrentCulture , Resources . Error_MemberNameSameAsParent , proposedName , complexType . LocalName . Value ) ; return false ; } else if ( ! IsUniqueComplexTypePropertyName ( complexType , proposedName , uniquenessIsCaseSensitive ) ) { errorMessage = string . Format ( CultureInfo . CurrentCulture , Resources . Error_ComplexTypePropertyNameNotUnique , proposedName , complexType . LocalName . Value ) ; return false ; } else { errorMessage = string . Empty ; return true ; } }
Validate ComplexType property name value.
Validate ComplexType property name value .
// Check if the name is a valid CSDL property name. // Check if the property name is not equal to parent entity name. // Check if the property name is unique within the passed in EntityType scope.
Return true if the property name is a valid CSDL property name and a unique name, return false otherwise.
Return true if the property name is a valid CSDL property name and a unique name return false otherwise .
complexType
ComplexType
proposedName
string
The proposed property name.
The proposed property name .
uniquenessIsCaseSensitive
bool
A flag that indicates whether case sensitive string comparison is used to check the uniqueness of the property name.
A flag that indicates whether case sensitive string comparison is used to check the uniqueness of the property name .
string
out
entityType
Property's ComplexType instance.
Property ' s ComplexType instance .
errorMessage
Property name validation error message.
Property name validation error message .