コード例 #1
0
        /// <summary>Checks for duplicate navigation links and if there already is an association link with the same name
        /// sets the association link URL on the nested resource info.</summary>
        /// <param name="propertyAndAnnotationCollector">The duplicate property names checker for the current scope.</param>
        /// <param name="nestedResourceInfo">The nested resource info to be checked.</param>
        internal static void CheckForDuplicateNestedResourceInfoNameAndSetAssociationLink(
            PropertyAndAnnotationCollector propertyAndAnnotationCollector,
            ODataNestedResourceInfo nestedResourceInfo)
        {
            Debug.Assert(propertyAndAnnotationCollector != null, "propertyAndAnnotationCollector != null");
            Debug.Assert(nestedResourceInfo != null, "nestedResourceInfo != null");

            Uri associationLinkUrl = propertyAndAnnotationCollector.ValidatePropertyUniquenessAndGetAssociationLink(nestedResourceInfo);

            // We must not set the AssociationLinkUrl to null since that would disable templating on it, but we want templating to work if the association link was not in the payload.
            if (associationLinkUrl != null && nestedResourceInfo.AssociationLinkUrl == null)
            {
                nestedResourceInfo.AssociationLinkUrl = associationLinkUrl;
            }
        }
コード例 #2
0
        /// <summary>Checks that for duplicate association links and if there already is a nested resource info with the same name
        /// sets the association link URL on that nested resource info.</summary>
        /// <param name="propertyAndAnnotationCollector">The duplicate property names checker for the current scope.</param>
        /// <param name="associationLinkName">The name of association link to be checked.</param>
        /// <param name="associationLinkUrl">The url of association link to be checked.</param>
        internal static void CheckForDuplicateAssociationLinkAndUpdateNestedResourceInfo(
            PropertyAndAnnotationCollector propertyAndAnnotationCollector,
            string associationLinkName,
            Uri associationLinkUrl)
        {
            Debug.Assert(propertyAndAnnotationCollector != null, "propertyAndAnnotationCollector != null");
            Debug.Assert(associationLinkName != null, "associationLinkName != null");

            ODataNestedResourceInfo nestedResourceInfo = propertyAndAnnotationCollector.ValidatePropertyOpenForAssociationLinkAndGetNestedResourceInfo(associationLinkName, associationLinkUrl);

            // We must not set the AssociationLinkUrl to null since that would disable templating on it, but we want templating to work if the association link was not in the payload.
            if (nestedResourceInfo != null && nestedResourceInfo.AssociationLinkUrl == null && associationLinkUrl != null)
            {
                nestedResourceInfo.AssociationLinkUrl = associationLinkUrl;
            }
        }