Пример #1
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            ((fhirCsR4.Models.BackboneElement) this).SerializeJson(writer, options, false);

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

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

            if (ValueBoolean != null)
            {
                writer.WriteBoolean("valueBoolean", (bool)ValueBoolean !);
            }

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

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

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

            writer.WriteBoolean("exclude", Exclude);

            if (Period != null)
            {
                writer.WritePropertyName("period");
                Period.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.Element) this).SerializeJson(writer, options, false);

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

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

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

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

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

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Пример #3
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 (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

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

            if (!string.IsNullOrEmpty(ValueBase64Binary))
            {
                writer.WriteString("valueBase64Binary", (string)ValueBase64Binary !);
            }

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

            if (ValueBoolean != null)
            {
                writer.WriteBoolean("valueBoolean", (bool)ValueBoolean !);
            }

            if (!string.IsNullOrEmpty(ValueCanonical))
            {
                writer.WriteString("valueCanonical", (string)ValueCanonical !);
            }

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

            if (!string.IsNullOrEmpty(ValueCode))
            {
                writer.WriteString("valueCode", (string)ValueCode !);
            }

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

            if (!string.IsNullOrEmpty(ValueDate))
            {
                writer.WriteString("valueDate", (string)ValueDate !);
            }

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

            if (!string.IsNullOrEmpty(ValueDateTime))
            {
                writer.WriteString("valueDateTime", (string)ValueDateTime !);
            }

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

            if (ValueDecimal != null)
            {
                writer.WriteNumber("valueDecimal", (decimal)ValueDecimal !);
            }

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

            if (!string.IsNullOrEmpty(ValueId))
            {
                writer.WriteString("valueId", (string)ValueId !);
            }

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

            if (!string.IsNullOrEmpty(ValueInstant))
            {
                writer.WriteString("valueInstant", (string)ValueInstant !);
            }

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

            if (ValueInteger != null)
            {
                writer.WriteNumber("valueInteger", (int)ValueInteger !);
            }

            if (!string.IsNullOrEmpty(ValueMarkdown))
            {
                writer.WriteString("valueMarkdown", (string)ValueMarkdown !);
            }

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

            if (!string.IsNullOrEmpty(ValueOid))
            {
                writer.WriteString("valueOid", (string)ValueOid !);
            }

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

            if (ValuePositiveInt != null)
            {
                writer.WriteNumber("valuePositiveInt", (uint)ValuePositiveInt !);
            }

            if (!string.IsNullOrEmpty(ValueString))
            {
                writer.WriteString("valueString", (string)ValueString !);
            }

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

            if (!string.IsNullOrEmpty(ValueTime))
            {
                writer.WriteString("valueTime", (string)ValueTime !);
            }

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

            if (ValueUnsignedInt != null)
            {
                writer.WriteNumber("valueUnsignedInt", (uint)ValueUnsignedInt !);
            }

            if (!string.IsNullOrEmpty(ValueUri))
            {
                writer.WriteString("valueUri", (string)ValueUri !);
            }

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

            if (!string.IsNullOrEmpty(ValueUrl))
            {
                writer.WriteString("valueUrl", (string)ValueUrl !);
            }

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

            if (ValueUuid != null)
            {
                writer.WriteString("valueUuid", (Guid)ValueUuid !);
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (Resource != null)
            {
                writer.WritePropertyName("resource");
                JsonSerializer.Serialize <Fhir.R4.Models.Resource>(writer, (Fhir.R4.Models.Resource)Resource, options);
            }

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

                foreach (ParametersParameter valPart in Part)
                {
                    valPart.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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