Beispiel #1
0
        /// <summary>
        /// Encodes the dataset message
        /// </summary>
        /// <param name="jsonEncoder">The <see cref="JsonEncoder"/> used to encode this object.</param>
        /// <param name="fieldName">The field name to be used to encode this object, by default it is null.</param>
        public void Encode(JsonEncoder jsonEncoder, string fieldName = null)
        {
            jsonEncoder.PushStructure(fieldName);
            if (HasDataSetMessageHeader)
            {
                EncodeDataSetMessageHeader(jsonEncoder);
            }

            if (DataSet != null)
            {
                EncodePayload(jsonEncoder, HasDataSetMessageHeader);
            }

            jsonEncoder.PopStructure();
        }
Beispiel #2
0
        /// <summary>
        /// Encodes The DataSet message payload
        /// </summary>
        internal void EncodePayload(JsonEncoder jsonEncoder, bool pushStructure = true)
        {
            bool forceNamespaceUri = jsonEncoder.ForceNamespaceUri;

            if (pushStructure)
            {
                jsonEncoder.PushStructure(kFieldPayload);
            }
            foreach (var field in DataSet.Fields)
            {
                EncodeField(jsonEncoder, field);
            }
            if (pushStructure)
            {
                jsonEncoder.PopStructure();
            }

            jsonEncoder.ForceNamespaceUri = forceNamespaceUri;
        }