internal static void ValidateStreamReferenceProperty(ODataProperty streamProperty, IEdmProperty edmProperty, ODataVersion version, bool writingResponse)
        {
            ODataVersionChecker.CheckStreamReferenceProperty(version);
            ValidationUtils.ValidateStreamReferenceProperty(streamProperty, edmProperty);
            if (!writingResponse)
            {
                throw new ODataException(Microsoft.Data.OData.Strings.WriterValidationUtils_StreamPropertyInRequest(streamProperty.Name));
            }
            ODataStreamReferenceValue streamReference = (ODataStreamReferenceValue)streamProperty.Value;

            ValidateStreamReferenceValue(streamReference, false);
        }
Esempio n. 2
0
        /// <summary>
        /// Validates a named stream property to ensure it's not null and it's name if correct.
        /// </summary>
        /// <param name="streamProperty">The stream reference property to validate.</param>
        /// <param name="edmProperty">Property metadata to validate against.</param>
        /// <param name="version">The version of the OData protocol used for checking.</param>
        /// <param name="writingResponse">true when writing a response; otherwise false.</param>
        /// <remarks>This does NOT validate the value of the stream property, just the property itself.</remarks>
        internal static void ValidateStreamReferenceProperty(ODataProperty streamProperty, IEdmProperty edmProperty, ODataVersion version, bool writingResponse)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(streamProperty != null, "streamProperty != null");

            ODataVersionChecker.CheckStreamReferenceProperty(version);
            ValidationUtils.ValidateStreamReferenceProperty(streamProperty, edmProperty);

            if (!writingResponse)
            {
                throw new ODataException(Strings.WriterValidationUtils_StreamPropertyInRequest(streamProperty.Name));
            }
        }