示例#1
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if (EventCoding != null)
            {
                writer.WritePropertyName("eventCoding");
                EventCoding.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(EventUri))
            {
                writer.WriteString("eventUri", (string)EventUri !);
            }

            if (_EventUri != null)
            {
                writer.WritePropertyName("_eventUri");
                _EventUri.SerializeJson(writer, options);
            }

            if ((Destination != null) && (Destination.Count != 0))
            {
                writer.WritePropertyName("destination");
                writer.WriteStartArray();

                foreach (MessageHeaderDestination valDestination in Destination)
                {
                    valDestination.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Sender != null)
            {
                writer.WritePropertyName("sender");
                Sender.SerializeJson(writer, options);
            }

            if (Enterer != null)
            {
                writer.WritePropertyName("enterer");
                Enterer.SerializeJson(writer, options);
            }

            if (Author != null)
            {
                writer.WritePropertyName("author");
                Author.SerializeJson(writer, options);
            }

            if (Source != null)
            {
                writer.WritePropertyName("source");
                Source.SerializeJson(writer, options);
            }

            if (Responsible != null)
            {
                writer.WritePropertyName("responsible");
                Responsible.SerializeJson(writer, options);
            }

            if (Reason != null)
            {
                writer.WritePropertyName("reason");
                Reason.SerializeJson(writer, options);
            }

            if (Response != null)
            {
                writer.WritePropertyName("response");
                Response.SerializeJson(writer, options);
            }

            if ((Focus != null) && (Focus.Count != 0))
            {
                writer.WritePropertyName("focus");
                writer.WriteStartArray();

                foreach (Reference valFocus in Focus)
                {
                    valFocus.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Definition))
            {
                writer.WriteString("definition", (string)Definition !);
            }

            if (_Definition != null)
            {
                writer.WritePropertyName("_definition");
                _Definition.SerializeJson(writer, options);
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
示例#2
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            ((Fhir.R4.Models.BackboneElement) this).SerializeJson(writer, options, false);

            if (Identifier != null)
            {
                writer.WritePropertyName("identifier");
                Identifier.SerializeJson(writer, options);
            }

            if (Predecessor != null)
            {
                writer.WritePropertyName("predecessor");
                Predecessor.SerializeJson(writer, options);
            }

            if (Type != null)
            {
                writer.WritePropertyName("type");
                Type.SerializeJson(writer, options);
            }

            if (Request != null)
            {
                writer.WritePropertyName("request");
                Request.SerializeJson(writer, options);
            }

            if (Submitter != null)
            {
                writer.WritePropertyName("submitter");
                Submitter.SerializeJson(writer, options);
            }

            if (Response != null)
            {
                writer.WritePropertyName("response");
                Response.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Date))
            {
                writer.WriteString("date", (string)Date !);
            }

            if (_Date != null)
            {
                writer.WritePropertyName("_date");
                _Date.SerializeJson(writer, options);
            }

            if (Responsible != null)
            {
                writer.WritePropertyName("responsible");
                Responsible.SerializeJson(writer, options);
            }

            if (Payee != null)
            {
                writer.WritePropertyName("payee");
                Payee.SerializeJson(writer, options);
            }

            if (Amount != null)
            {
                writer.WritePropertyName("amount");
                Amount.SerializeJson(writer, options);
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }