private static string GetQualifiedAndEscapedPropertyName(IEdmNavigationProperty property)
 {
     object[] objArray = new object[5];
     objArray[0] = SerializationExtensionMethods.EscapeName(property.DeclaringEntityType().Namespace).Replace('.', '\u005F');
     objArray[1] = (char)95;
     objArray[2] = SerializationExtensionMethods.EscapeName(property.DeclaringEntityType().Name);
     objArray[3] = (char)95;
     objArray[4] = SerializationExtensionMethods.EscapeName(property.Name);
     return(string.Concat(objArray));
 }
        public static string GetAssociationName(this IEdmModel model, IEdmNavigationProperty property)
        {
            EdmUtil.CheckArgumentNull <IEdmModel>(model, "model");
            EdmUtil.CheckArgumentNull <IEdmNavigationProperty>(property, "property");
            property.PopulateCaches();
            string annotationValue = model.GetAnnotationValue <string>(property, "http://schemas.microsoft.com/ado/2011/04/edm/internal", "AssociationName");

            if (annotationValue == null)
            {
                IEdmNavigationProperty primary = property.GetPrimary();
                IEdmNavigationProperty partner = primary.Partner;
                annotationValue = string.Concat(SerializationExtensionMethods.GetQualifiedAndEscapedPropertyName(partner), (char)95, SerializationExtensionMethods.GetQualifiedAndEscapedPropertyName(primary));
            }
            return(annotationValue);
        }