/// <summary> /// Annotates payload with version as appropriate. /// </summary> /// <param name="payloadElement">The root of the payload to annotate.</param> /// <param name="version">The format version to annotate with.</param> /// <param name="requestPayload">true if the payload should represent a request payload, false if it's a response payload.</param> public static void AnnotateVerboseJson(ODataPayloadElement payloadElement, DataServiceProtocolVersion version, bool requestPayload) { PayloadFormatVersionAnnotatingVisitor visitor = new PayloadFormatVersionAnnotatingVisitor(version, requestPayload); visitor.Recurse(payloadElement); // Add the version/response annotation to the root if it's a response. if (!requestPayload && !(payloadElement is ODataErrorPayload)) { payloadElement.SetAnnotation(new PayloadFormatVersionAnnotation() { Version = version, Response = true, ResponseWrapper = true }); } }
/// <summary> /// Annotates payload with version as appropriate. /// </summary> /// <param name="payloadElement">The root of the payload to annotate.</param> /// <param name="version">The format version to annotate with.</param> /// <param name="requestPayload">true if the payload should represent a request payload, false if it's a response payload.</param> public static void AnnotateVerboseJson(ODataPayloadElement payloadElement, DataServiceProtocolVersion version, bool requestPayload) { PayloadFormatVersionAnnotatingVisitor visitor = new PayloadFormatVersionAnnotatingVisitor(version, requestPayload); visitor.Recurse(payloadElement); // Add the version/response annotation to the root if it's a response. if (!requestPayload && !(payloadElement is ODataErrorPayload)) { payloadElement.SetAnnotation(new PayloadFormatVersionAnnotation() { Version = version, Response = true, ResponseWrapper = true }); } }
/// <summary> /// Annotates payload with version as appropriate. /// </summary> /// <param name="payloadElement">The root of the payload to annotate.</param> /// <param name="version">The format version to annotate with.</param> /// <param name="requestPayload">true if the payload should represent a request payload, false if it's a response payload.</param> public static void AnnotateJsonLight(ODataPayloadElement payloadElement, DataServiceProtocolVersion version, bool requestPayload) { PayloadFormatVersionAnnotatingVisitor visitor = new PayloadFormatVersionAnnotatingVisitor(version, requestPayload); visitor.Recurse(payloadElement); }
/// <summary> /// Annotates payload with version as appropriate. /// </summary> /// <param name="payloadElement">The root of the payload to annotate.</param> /// <param name="version">The format version to annotate with.</param> /// <param name="requestPayload">true if the payload should represent a request payload, false if it's a response payload.</param> public static void AnnotateJsonLight(ODataPayloadElement payloadElement, DataServiceProtocolVersion version, bool requestPayload) { PayloadFormatVersionAnnotatingVisitor visitor = new PayloadFormatVersionAnnotatingVisitor(version, requestPayload); visitor.Recurse(payloadElement); }