internal static ODataVersion GetDataServiceVersion(ODataMessage message, ODataVersion defaultVersion) { string header = message.GetHeader("DataServiceVersion"); if (!string.IsNullOrEmpty(header)) { return ODataUtils.StringToODataVersion(header); } return defaultVersion; }
internal static ODataVersion GetDataServiceVersion(ODataMessage message, ODataVersion defaultVersion) { string header = message.GetHeader("DataServiceVersion"); if (!string.IsNullOrEmpty(header)) { return(ODataUtils.StringToODataVersion(header)); } return(defaultVersion); }
/// <summary> /// Reads the DataServiceVersion header from the <paramref name="message"/> and parses it. /// If no DataServiceVersion header is found it sets the default version to be used for reading. /// </summary> /// <param name="message">The message to get the data service version header from.</param> /// <param name="defaultVersion">The default version to use if the header was not specified.</param> /// <returns> /// The <see cref="ODataVersion"/> retrieved from the DataServiceVersion header of the message. /// The default version if none is specified in the header. /// </returns> internal static ODataVersion GetDataServiceVersion(ODataMessage message, ODataVersion defaultVersion) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(message != null, "message != null"); string originalHeaderValue = message.GetHeader(ODataConstants.DataServiceVersionHeader); string headerValue = originalHeaderValue; return string.IsNullOrEmpty(headerValue) ? defaultVersion : ODataUtils.StringToODataVersion(headerValue); }
/// <summary> /// Reads the DataServiceVersion header from the <paramref name="message"/> and parses it. /// If no DataServiceVersion header is found it sets the default version to be used for reading. /// </summary> /// <param name="message">The message to get the data service version header from.</param> /// <param name="defaultVersion">The default version to use if the header was not specified.</param> /// <returns> /// The <see cref="ODataVersion"/> retrieved from the DataServiceVersion header of the message. /// The default version if none is specified in the header. /// </returns> internal static ODataVersion GetDataServiceVersion(ODataMessage message, ODataVersion defaultVersion) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(message != null, "message != null"); string originalHeaderValue = message.GetHeader(ODataConstants.DataServiceVersionHeader); string headerValue = originalHeaderValue; return(string.IsNullOrEmpty(headerValue) ? defaultVersion : ODataUtils.StringToODataVersion(headerValue)); }