diff --git a/src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj b/src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj
index 57492d3a40..29d2dab7fb 100644
--- a/src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj
+++ b/src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj
@@ -8,6 +8,7 @@
Firely's HL7 FHIR SDK Base Class Library
Firely's HL7 FHIR SDK Base Class Library. Is a dependency for the FHIR release-specific NuGet packages and is usually not directly referenced.
HL7;FHIR;Firely;SDK;BCL
+ Hl7.Fhir
diff --git a/src/Hl7.Fhir.Base/Model/Base.Extensions.cs b/src/Hl7.Fhir.Base/Model/Base.Extensions.cs
index f9259af2cf..42a88b569e 100644
--- a/src/Hl7.Fhir.Base/Model/Base.Extensions.cs
+++ b/src/Hl7.Fhir.Base/Model/Base.Extensions.cs
@@ -1,10 +1,14 @@
+/*
+ * Copyright (c) 2025, Firely (info@fire.ly) and contributors
+ * See the file CONTRIBUTORS for details.
+ *
+ * This file is licensed under the BSD 3-Clause license
+ * available at https://raw.githubusercontent.com/FirelyTeam/firely-net-sdk/master/LICENSE
+ */
+
#nullable enable
-using Hl7.Fhir.ElementModel;
-using Hl7.Fhir.Introspection;
-using Hl7.Fhir.Rest;
-using Hl7.Fhir.Utility;
+
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/Hl7.Fhir.Base/Model/Bundle.cs b/src/Hl7.Fhir.Base/Model/Bundle.cs
index 25df5eceda..a15e207521 100644
--- a/src/Hl7.Fhir.Base/Model/Bundle.cs
+++ b/src/Hl7.Fhir.Base/Model/Bundle.cs
@@ -109,11 +109,11 @@ public Uri? Alternate
private Uri? getLink(string rel)
{
- if (Link is null) return null;
+ if (!Link.Any()) return null;
var entry = Link.FirstOrDefault(e => rel.Equals(e.Relation, StringComparison.OrdinalIgnoreCase));
- return entry != null ? new Uri(entry.Url, UriKind.RelativeOrAbsolute) : null;
+ return entry?.Url != null ? new Uri(entry.Url, UriKind.RelativeOrAbsolute) : null;
}
private void setLink(string rel, Uri? uri)
diff --git a/src/Hl7.Fhir.Base/Model/Canonical.cs b/src/Hl7.Fhir.Base/Model/Canonical.cs
index eb0e8a9167..9681a3a69f 100644
--- a/src/Hl7.Fhir.Base/Model/Canonical.cs
+++ b/src/Hl7.Fhir.Base/Model/Canonical.cs
@@ -128,23 +128,25 @@ public static Canonical ForCoreType(string typename)
///
/// The version string of the canonical (if present).
///
- public string? Version => splitCanonical(Value).version;
+ public string? Version => Value is null ? null : splitCanonical(Value).version;
///
/// Optional anchor at the end of the canonical, without the '#' prefix.
///
- public string? Fragment => splitCanonical(Value).fragment;
+ public string? Fragment => Value is null ? null : splitCanonical(Value).fragment;
///
/// The uri part of the canonical, which is the canonical without the version indication.
///
- public string? Uri => splitCanonical(Value).url;
+ public string? Uri => Value is null ? null : splitCanonical(Value).url;
///
/// Converts the canonical to a .
///
///
- public Uri ToUri() => new(Value, UriKind.RelativeOrAbsolute);
+ public Uri ToUri() => new(
+ Value ?? throw new InvalidOperationException("Cannot turn a canonical without a value into a Uri"),
+ UriKind.RelativeOrAbsolute);
///
/// Whether the canonical is a relative or an absolute uri.
diff --git a/src/Hl7.Fhir.Base/Model/CodeableReference.cs b/src/Hl7.Fhir.Base/Model/CodeableReference.cs
index 6219e15c39..bab7deade1 100644
--- a/src/Hl7.Fhir.Base/Model/CodeableReference.cs
+++ b/src/Hl7.Fhir.Base/Model/CodeableReference.cs
@@ -43,7 +43,7 @@ public P.Concept ToSystemConcept() =>
"and can therefore not be converted to a System Concept.");
internal P.Concept? ToSystemConceptInternal() =>
- ((P.IToSystemPrimitive)Concept)?.TryConvertToSystemType(out var result) == true ? (P.Concept)result : null;
+ ((P.IToSystemPrimitive?)Concept)?.TryConvertToSystemType(out var result) == true ? (P.Concept)result : null;
///
/// Converts the reference part of this CodeableReference to a .
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs b/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs
index 868c078d66..931be5efc9 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -66,28 +69,25 @@ public partial class Attachment : Hl7.Fhir.Model.DataType
[FhirElement("contentType", InSummary=true, Order=30)]
[Binding("MimeType")]
[DataMember]
- public Hl7.Fhir.Model.Code ContentTypeElement
+ public Hl7.Fhir.Model.Code? ContentTypeElement
{
get { return _ContentTypeElement; }
set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); }
}
- private Hl7.Fhir.Model.Code _ContentTypeElement;
+ private Hl7.Fhir.Model.Code? _ContentTypeElement;
///
/// Mime type of the content, with charset etc.
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string ContentType
+ public string? ContentType
{
- get { return ContentTypeElement != null ? ContentTypeElement.Value : null; }
+ get => _ContentTypeElement?.Value;
set
{
- if (value == null)
- ContentTypeElement = null;
- else
- ContentTypeElement = new Hl7.Fhir.Model.Code(value);
+ ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("ContentType");
}
}
@@ -98,28 +98,25 @@ public string ContentType
[FhirElement("language", InSummary=true, Order=40)]
[Binding("Language")]
[DataMember]
- public Hl7.Fhir.Model.Code LanguageElement
+ public Hl7.Fhir.Model.Code? LanguageElement
{
get { return _LanguageElement; }
set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); }
}
- private Hl7.Fhir.Model.Code _LanguageElement;
+ private Hl7.Fhir.Model.Code? _LanguageElement;
///
/// Human language of the content (BCP-47)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Language
+ public string? Language
{
- get { return LanguageElement != null ? LanguageElement.Value : null; }
+ get => _LanguageElement?.Value;
set
{
- if (value == null)
- LanguageElement = null;
- else
- LanguageElement = new Hl7.Fhir.Model.Code(value);
+ LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("Language");
}
}
@@ -129,28 +126,25 @@ public string Language
///
[FhirElement("data", Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Base64Binary DataElement
+ public Hl7.Fhir.Model.Base64Binary? DataElement
{
get { return _DataElement; }
set { _DataElement = value; OnPropertyChanged("DataElement"); }
}
- private Hl7.Fhir.Model.Base64Binary _DataElement;
+ private Hl7.Fhir.Model.Base64Binary? _DataElement;
///
/// Data inline, base64ed
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public byte[] Data
+ public byte[]? Data
{
- get { return DataElement != null ? DataElement.Value : null; }
+ get => _DataElement?.Value;
set
{
- if (value == null)
- DataElement = null;
- else
- DataElement = new Hl7.Fhir.Model.Base64Binary(value);
+ DataElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value);
OnPropertyChanged("Data");
}
}
@@ -170,28 +164,25 @@ public byte[] Data
[DeclaredType(Type = typeof(Hl7.Fhir.Model.FhirUri), Since = FhirRelease.STU3)]
[DeclaredType(Type = typeof(Hl7.Fhir.Model.FhirUrl), Since = FhirRelease.R4)]
[DataMember]
- public Hl7.Fhir.Model.PrimitiveType UrlElement
+ public Hl7.Fhir.Model.PrimitiveType? UrlElement
{
get { return _UrlElement; }
set { _UrlElement = value; OnPropertyChanged("UrlElement"); }
}
- private Hl7.Fhir.Model.PrimitiveType _UrlElement;
+ private Hl7.Fhir.Model.PrimitiveType? _UrlElement;
///
/// Uri where the data can be found. Use this property in STU3.
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string UrlUri
+ public string? UrlUri
{
- get { return UrlElement != null ? ((IValue)UrlElement).Value : null; }
+ get => ((IValue?)_UrlElement)?.Value;
set
{
- if (value == null)
- UrlElement = null;
- else
- UrlElement = new Hl7.Fhir.Model.FhirUri(value);
+ UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("UrlUri");
}
}
@@ -201,15 +192,12 @@ public string UrlUri
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Url
+ public string? Url
{
- get { return UrlElement != null ? ((IValue)UrlElement).Value : null; }
+ get => ((IValue?)_UrlElement)?.Value;
set
{
- if (value == null)
- UrlElement = null;
- else
- UrlElement = new Hl7.Fhir.Model.FhirUrl(value);
+ UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value);
OnPropertyChanged("Url");
}
}
@@ -229,13 +217,13 @@ public string Url
[DeclaredType(Type = typeof(Hl7.Fhir.Model.UnsignedInt), Since = FhirRelease.STU3)]
[DeclaredType(Type = typeof(Hl7.Fhir.Model.Integer64), Since = FhirRelease.R5)]
[DataMember]
- public Hl7.Fhir.Model.PrimitiveType SizeElement
+ public Hl7.Fhir.Model.PrimitiveType? SizeElement
{
get { return _SizeElement; }
set { _SizeElement = value; OnPropertyChanged("SizeElement"); }
}
- private Hl7.Fhir.Model.PrimitiveType _SizeElement;
+ private Hl7.Fhir.Model.PrimitiveType? _SizeElement;
///
/// Number of bytes of content (if url provided). Use this property in STU3, R4 and R4B.
@@ -244,13 +232,10 @@ public Hl7.Fhir.Model.PrimitiveType SizeElement
[IgnoreDataMember]
public int? SizeUnsignedInt
{
- get { return SizeElement != null ? ((Hl7.Fhir.Model.UnsignedInt)SizeElement).Value : null; }
+ get => ((Hl7.Fhir.Model.UnsignedInt?)_SizeElement)?.Value;
set
{
- if (value == null)
- SizeElement = null;
- else
- SizeElement = new Hl7.Fhir.Model.UnsignedInt(value);
+ SizeElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value);
OnPropertyChanged("SizeUnsignedInt");
}
}
@@ -262,13 +247,10 @@ public int? SizeUnsignedInt
[IgnoreDataMember]
public long? Size
{
- get { return SizeElement != null ? ((Hl7.Fhir.Model.Integer64)SizeElement).Value : null; }
+ get => ((Hl7.Fhir.Model.Integer64?)_SizeElement)?.Value;
set
{
- if (value == null)
- SizeElement = null;
- else
- SizeElement = new Hl7.Fhir.Model.Integer64(value);
+ SizeElement = value is null ? null : new Hl7.Fhir.Model.Integer64(value);
OnPropertyChanged("Size");
}
}
@@ -278,28 +260,25 @@ public long? Size
///
[FhirElement("hash", InSummary=true, Order=80)]
[DataMember]
- public Hl7.Fhir.Model.Base64Binary HashElement
+ public Hl7.Fhir.Model.Base64Binary? HashElement
{
get { return _HashElement; }
set { _HashElement = value; OnPropertyChanged("HashElement"); }
}
- private Hl7.Fhir.Model.Base64Binary _HashElement;
+ private Hl7.Fhir.Model.Base64Binary? _HashElement;
///
/// Hash of the data (sha-1, base64ed)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public byte[] Hash
+ public byte[]? Hash
{
- get { return HashElement != null ? HashElement.Value : null; }
+ get => _HashElement?.Value;
set
{
- if (value == null)
- HashElement = null;
- else
- HashElement = new Hl7.Fhir.Model.Base64Binary(value);
+ HashElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value);
OnPropertyChanged("Hash");
}
}
@@ -309,28 +288,25 @@ public byte[] Hash
///
[FhirElement("title", InSummary=true, Order=90)]
[DataMember]
- public Hl7.Fhir.Model.FhirString TitleElement
+ public Hl7.Fhir.Model.FhirString? TitleElement
{
get { return _TitleElement; }
set { _TitleElement = value; OnPropertyChanged("TitleElement"); }
}
- private Hl7.Fhir.Model.FhirString _TitleElement;
+ private Hl7.Fhir.Model.FhirString? _TitleElement;
///
/// Label to display in place of the data
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Title
+ public string? Title
{
- get { return TitleElement != null ? TitleElement.Value : null; }
+ get => _TitleElement?.Value;
set
{
- if (value == null)
- TitleElement = null;
- else
- TitleElement = new Hl7.Fhir.Model.FhirString(value);
+ TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Title");
}
}
@@ -340,28 +316,25 @@ public string Title
///
[FhirElement("creation", InSummary=true, Order=100)]
[DataMember]
- public Hl7.Fhir.Model.FhirDateTime CreationElement
+ public Hl7.Fhir.Model.FhirDateTime? CreationElement
{
get { return _CreationElement; }
set { _CreationElement = value; OnPropertyChanged("CreationElement"); }
}
- private Hl7.Fhir.Model.FhirDateTime _CreationElement;
+ private Hl7.Fhir.Model.FhirDateTime? _CreationElement;
///
/// Date attachment was first created
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Creation
+ public string? Creation
{
- get { return CreationElement != null ? CreationElement.Value : null; }
+ get => _CreationElement?.Value;
set
{
- if (value == null)
- CreationElement = null;
- else
- CreationElement = new Hl7.Fhir.Model.FhirDateTime(value);
+ CreationElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value);
OnPropertyChanged("Creation");
}
}
@@ -374,13 +347,13 @@ public string Creation
///
[FhirElement("height", Order=110, Since=FhirRelease.R5)]
[DataMember]
- public Hl7.Fhir.Model.PositiveInt HeightElement
+ public Hl7.Fhir.Model.PositiveInt? HeightElement
{
get { return _HeightElement; }
set { _HeightElement = value; OnPropertyChanged("HeightElement"); }
}
- private Hl7.Fhir.Model.PositiveInt _HeightElement;
+ private Hl7.Fhir.Model.PositiveInt? _HeightElement;
///
/// Height of the image in pixels (photo/video)
@@ -389,13 +362,10 @@ public Hl7.Fhir.Model.PositiveInt HeightElement
[IgnoreDataMember]
public int? Height
{
- get { return HeightElement != null ? HeightElement.Value : null; }
+ get => _HeightElement?.Value;
set
{
- if (value == null)
- HeightElement = null;
- else
- HeightElement = new Hl7.Fhir.Model.PositiveInt(value);
+ HeightElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value);
OnPropertyChanged("Height");
}
}
@@ -408,13 +378,13 @@ public int? Height
///
[FhirElement("width", Order=120, Since=FhirRelease.R5)]
[DataMember]
- public Hl7.Fhir.Model.PositiveInt WidthElement
+ public Hl7.Fhir.Model.PositiveInt? WidthElement
{
get { return _WidthElement; }
set { _WidthElement = value; OnPropertyChanged("WidthElement"); }
}
- private Hl7.Fhir.Model.PositiveInt _WidthElement;
+ private Hl7.Fhir.Model.PositiveInt? _WidthElement;
///
/// Width of the image in pixels (photo/video)
@@ -423,13 +393,10 @@ public Hl7.Fhir.Model.PositiveInt WidthElement
[IgnoreDataMember]
public int? Width
{
- get { return WidthElement != null ? WidthElement.Value : null; }
+ get => _WidthElement?.Value;
set
{
- if (value == null)
- WidthElement = null;
- else
- WidthElement = new Hl7.Fhir.Model.PositiveInt(value);
+ WidthElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value);
OnPropertyChanged("Width");
}
}
@@ -442,13 +409,13 @@ public int? Width
///
[FhirElement("frames", Order=130, Since=FhirRelease.R5)]
[DataMember]
- public Hl7.Fhir.Model.PositiveInt FramesElement
+ public Hl7.Fhir.Model.PositiveInt? FramesElement
{
get { return _FramesElement; }
set { _FramesElement = value; OnPropertyChanged("FramesElement"); }
}
- private Hl7.Fhir.Model.PositiveInt _FramesElement;
+ private Hl7.Fhir.Model.PositiveInt? _FramesElement;
///
/// Number of frames if > 1 (photo)
@@ -457,13 +424,10 @@ public Hl7.Fhir.Model.PositiveInt FramesElement
[IgnoreDataMember]
public int? Frames
{
- get { return FramesElement != null ? FramesElement.Value : null; }
+ get => _FramesElement?.Value;
set
{
- if (value == null)
- FramesElement = null;
- else
- FramesElement = new Hl7.Fhir.Model.PositiveInt(value);
+ FramesElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value);
OnPropertyChanged("Frames");
}
}
@@ -476,13 +440,13 @@ public int? Frames
///
[FhirElement("duration", Order=140, Since=FhirRelease.R5)]
[DataMember]
- public Hl7.Fhir.Model.FhirDecimal DurationElement
+ public Hl7.Fhir.Model.FhirDecimal? DurationElement
{
get { return _DurationElement; }
set { _DurationElement = value; OnPropertyChanged("DurationElement"); }
}
- private Hl7.Fhir.Model.FhirDecimal _DurationElement;
+ private Hl7.Fhir.Model.FhirDecimal? _DurationElement;
///
/// Length in seconds (audio / video)
@@ -491,13 +455,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationElement
[IgnoreDataMember]
public decimal? Duration
{
- get { return DurationElement != null ? DurationElement.Value : null; }
+ get => _DurationElement?.Value;
set
{
- if (value == null)
- DurationElement = null;
- else
- DurationElement = new Hl7.Fhir.Model.FhirDecimal(value);
+ DurationElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value);
OnPropertyChanged("Duration");
}
}
@@ -510,13 +471,13 @@ public decimal? Duration
///
[FhirElement("pages", Order=150, Since=FhirRelease.R5)]
[DataMember]
- public Hl7.Fhir.Model.PositiveInt PagesElement
+ public Hl7.Fhir.Model.PositiveInt? PagesElement
{
get { return _PagesElement; }
set { _PagesElement = value; OnPropertyChanged("PagesElement"); }
}
- private Hl7.Fhir.Model.PositiveInt _PagesElement;
+ private Hl7.Fhir.Model.PositiveInt? _PagesElement;
///
/// Number of printed pages
@@ -525,40 +486,33 @@ public Hl7.Fhir.Model.PositiveInt PagesElement
[IgnoreDataMember]
public int? Pages
{
- get { return PagesElement != null ? PagesElement.Value : null; }
+ get => _PagesElement?.Value;
set
{
- if (value == null)
- PagesElement = null;
- else
- PagesElement = new Hl7.Fhir.Model.PositiveInt(value);
+ PagesElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value);
OnPropertyChanged("Pages");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Attachment;
-
- if (dest == null)
- {
+ if(other is not Attachment dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal();
- if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal();
- if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)DataElement.DeepCopyInternal();
- if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.PrimitiveType)UrlElement.DeepCopyInternal();
- if(SizeElement != null) dest.SizeElement = (Hl7.Fhir.Model.PrimitiveType)SizeElement.DeepCopyInternal();
- if(HashElement != null) dest.HashElement = (Hl7.Fhir.Model.Base64Binary)HashElement.DeepCopyInternal();
- if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal();
- if(CreationElement != null) dest.CreationElement = (Hl7.Fhir.Model.FhirDateTime)CreationElement.DeepCopyInternal();
- if(HeightElement != null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)HeightElement.DeepCopyInternal();
- if(WidthElement != null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)WidthElement.DeepCopyInternal();
- if(FramesElement != null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)FramesElement.DeepCopyInternal();
- if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopyInternal();
- if(PagesElement != null) dest.PagesElement = (Hl7.Fhir.Model.PositiveInt)PagesElement.DeepCopyInternal();
+ if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal();
+ if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal();
+ if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)_DataElement.DeepCopyInternal();
+ if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.PrimitiveType)_UrlElement.DeepCopyInternal();
+ if(_SizeElement is not null) dest.SizeElement = (Hl7.Fhir.Model.PrimitiveType)_SizeElement.DeepCopyInternal();
+ if(_HashElement is not null) dest.HashElement = (Hl7.Fhir.Model.Base64Binary)_HashElement.DeepCopyInternal();
+ if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal();
+ if(_CreationElement is not null) dest.CreationElement = (Hl7.Fhir.Model.FhirDateTime)_CreationElement.DeepCopyInternal();
+ if(_HeightElement is not null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)_HeightElement.DeepCopyInternal();
+ if(_WidthElement is not null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)_WidthElement.DeepCopyInternal();
+ if(_FramesElement is not null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)_FramesElement.DeepCopyInternal();
+ if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)_DurationElement.DeepCopyInternal();
+ if(_PagesElement is not null) dest.PagesElement = (Hl7.Fhir.Model.PositiveInt)_PagesElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -570,118 +524,119 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Attachment;
- if(otherT == null) return false;
+ if(other is not Attachment otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false;
- if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false;
- if(!comparer.Equals(DataElement, otherT.DataElement)) return false;
- if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false;
- if(!comparer.Equals(SizeElement, otherT.SizeElement)) return false;
- if(!comparer.Equals(HashElement, otherT.HashElement)) return false;
- if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false;
- if(!comparer.Equals(CreationElement, otherT.CreationElement)) return false;
- if(!comparer.Equals(HeightElement, otherT.HeightElement)) return false;
- if(!comparer.Equals(WidthElement, otherT.WidthElement)) return false;
- if(!comparer.Equals(FramesElement, otherT.FramesElement)) return false;
- if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false;
- if(!comparer.Equals(PagesElement, otherT.PagesElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false;
+ if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false;
+ if(!comparer.Equals(_DataElement, otherT._DataElement)) return false;
+ if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false;
+ if(!comparer.Equals(_SizeElement, otherT._SizeElement)) return false;
+ if(!comparer.Equals(_HashElement, otherT._HashElement)) return false;
+ if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false;
+ if(!comparer.Equals(_CreationElement, otherT._CreationElement)) return false;
+ if(!comparer.Equals(_HeightElement, otherT._HeightElement)) return false;
+ if(!comparer.Equals(_WidthElement, otherT._WidthElement)) return false;
+ if(!comparer.Equals(_FramesElement, otherT._FramesElement)) return false;
+ if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false;
+ if(!comparer.Equals(_PagesElement, otherT._PagesElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "contentType":
- value = ContentTypeElement;
- return ContentTypeElement is not null;
+ value = _ContentTypeElement;
+ return _ContentTypeElement is not null;
case "language":
- value = LanguageElement;
- return LanguageElement is not null;
+ value = _LanguageElement;
+ return _LanguageElement is not null;
case "data":
- value = DataElement;
- return DataElement is not null;
+ value = _DataElement;
+ return _DataElement is not null;
case "url":
- value = UrlElement;
- return UrlElement is not null;
+ value = _UrlElement;
+ return _UrlElement is not null;
case "size":
- value = SizeElement;
- return SizeElement is not null;
+ value = _SizeElement;
+ return _SizeElement is not null;
case "hash":
- value = HashElement;
- return HashElement is not null;
+ value = _HashElement;
+ return _HashElement is not null;
case "title":
- value = TitleElement;
- return TitleElement is not null;
+ value = _TitleElement;
+ return _TitleElement is not null;
case "creation":
- value = CreationElement;
- return CreationElement is not null;
+ value = _CreationElement;
+ return _CreationElement is not null;
case "height":
- value = HeightElement;
- return HeightElement is not null;
+ value = _HeightElement;
+ return _HeightElement is not null;
case "width":
- value = WidthElement;
- return WidthElement is not null;
+ value = _WidthElement;
+ return _WidthElement is not null;
case "frames":
- value = FramesElement;
- return FramesElement is not null;
+ value = _FramesElement;
+ return _FramesElement is not null;
case "duration":
- value = DurationElement;
- return DurationElement is not null;
+ value = _DurationElement;
+ return _DurationElement is not null;
case "pages":
- value = PagesElement;
- return PagesElement is not null;
+ value = _PagesElement;
+ return _PagesElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "contentType":
- ContentTypeElement = (Hl7.Fhir.Model.Code)value;
+ ContentTypeElement = (Hl7.Fhir.Model.Code?)value;
return this;
case "language":
- LanguageElement = (Hl7.Fhir.Model.Code)value;
+ LanguageElement = (Hl7.Fhir.Model.Code?)value;
return this;
case "data":
- DataElement = (Hl7.Fhir.Model.Base64Binary)value;
+ DataElement = (Hl7.Fhir.Model.Base64Binary?)value;
return this;
case "url":
- UrlElement = (Hl7.Fhir.Model.PrimitiveType)value;
+ UrlElement = (Hl7.Fhir.Model.PrimitiveType?)value;
return this;
case "size":
- SizeElement = (Hl7.Fhir.Model.PrimitiveType)value;
+ SizeElement = (Hl7.Fhir.Model.PrimitiveType?)value;
return this;
case "hash":
- HashElement = (Hl7.Fhir.Model.Base64Binary)value;
+ HashElement = (Hl7.Fhir.Model.Base64Binary?)value;
return this;
case "title":
- TitleElement = (Hl7.Fhir.Model.FhirString)value;
+ TitleElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "creation":
- CreationElement = (Hl7.Fhir.Model.FhirDateTime)value;
+ CreationElement = (Hl7.Fhir.Model.FhirDateTime?)value;
return this;
case "height":
- HeightElement = (Hl7.Fhir.Model.PositiveInt)value;
+ HeightElement = (Hl7.Fhir.Model.PositiveInt?)value;
return this;
case "width":
- WidthElement = (Hl7.Fhir.Model.PositiveInt)value;
+ WidthElement = (Hl7.Fhir.Model.PositiveInt?)value;
return this;
case "frames":
- FramesElement = (Hl7.Fhir.Model.PositiveInt)value;
+ FramesElement = (Hl7.Fhir.Model.PositiveInt?)value;
return this;
case "duration":
- DurationElement = (Hl7.Fhir.Model.FhirDecimal)value;
+ DurationElement = (Hl7.Fhir.Model.FhirDecimal?)value;
return this;
case "pages":
- PagesElement = (Hl7.Fhir.Model.PositiveInt)value;
+ PagesElement = (Hl7.Fhir.Model.PositiveInt?)value;
return this;
default:
return base.SetValue(key, value);
@@ -692,19 +647,19 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement);
- if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement);
- if (DataElement is not null) yield return new KeyValuePair("data",DataElement);
- if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement);
- if (SizeElement is not null) yield return new KeyValuePair("size",SizeElement);
- if (HashElement is not null) yield return new KeyValuePair("hash",HashElement);
- if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement);
- if (CreationElement is not null) yield return new KeyValuePair("creation",CreationElement);
- if (HeightElement is not null) yield return new KeyValuePair("height",HeightElement);
- if (WidthElement is not null) yield return new KeyValuePair("width",WidthElement);
- if (FramesElement is not null) yield return new KeyValuePair("frames",FramesElement);
- if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement);
- if (PagesElement is not null) yield return new KeyValuePair("pages",PagesElement);
+ if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement);
+ if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement);
+ if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement);
+ if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement);
+ if (_SizeElement is not null) yield return new KeyValuePair("size",_SizeElement);
+ if (_HashElement is not null) yield return new KeyValuePair("hash",_HashElement);
+ if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement);
+ if (_CreationElement is not null) yield return new KeyValuePair("creation",_CreationElement);
+ if (_HeightElement is not null) yield return new KeyValuePair("height",_HeightElement);
+ if (_WidthElement is not null) yield return new KeyValuePair("width",_WidthElement);
+ if (_FramesElement is not null) yield return new KeyValuePair("frames",_FramesElement);
+ if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement);
+ if (_PagesElement is not null) yield return new KeyValuePair("pages",_PagesElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs
index 15ec37a82c..8728aa3e77 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,55 +65,52 @@ public abstract partial class BackboneElement : Hl7.Fhir.Model.Element, Hl7.Fhir
[DataMember]
public List ModifierExtension
{
- get { if(_ModifierExtension==null) _ModifierExtension = new List(); return _ModifierExtension; }
+ get => _ModifierExtension ??= [];
set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); }
}
- private List _ModifierExtension;
+ private List? _ModifierExtension;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as BackboneElement;
-
- if (dest == null)
- {
+ if(other is not BackboneElement dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ModifierExtension.Any()) dest.ModifierExtension = new List(ModifierExtension.DeepCopyInternal());
+ if(_ModifierExtension is not null) dest.ModifierExtension = new List(_ModifierExtension.DeepCopyInternal());
}
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as BackboneElement;
- if(otherT == null) return false;
+ if(other is not BackboneElement otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.ListEquals(ModifierExtension, otherT.ModifierExtension)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "modifierExtension":
- value = ModifierExtension;
- return ModifierExtension?.Any() == true;
+ value = _ModifierExtension;
+ return _ModifierExtension?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "modifierExtension":
- ModifierExtension = (List)value;
+ ModifierExtension = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -121,7 +121,7 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",ModifierExtension);
+ if (_ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",_ModifierExtension);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs
index fea1afd059..4f0bd9c53b 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,55 +65,52 @@ public abstract partial class BackboneType : Hl7.Fhir.Model.DataType, Hl7.Fhir.M
[DataMember]
public List ModifierExtension
{
- get { if(_ModifierExtension==null) _ModifierExtension = new List(); return _ModifierExtension; }
+ get => _ModifierExtension ??= [];
set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); }
}
- private List _ModifierExtension;
+ private List? _ModifierExtension;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as BackboneType;
-
- if (dest == null)
- {
+ if(other is not BackboneType dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ModifierExtension.Any()) dest.ModifierExtension = new List(ModifierExtension.DeepCopyInternal());
+ if(_ModifierExtension is not null) dest.ModifierExtension = new List(_ModifierExtension.DeepCopyInternal());
}
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as BackboneType;
- if(otherT == null) return false;
+ if(other is not BackboneType otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.ListEquals(ModifierExtension, otherT.ModifierExtension)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "modifierExtension":
- value = ModifierExtension;
- return ModifierExtension?.Any() == true;
+ value = _ModifierExtension;
+ return _ModifierExtension?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "modifierExtension":
- ModifierExtension = (List)value;
+ ModifierExtension = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -121,7 +121,7 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",ModifierExtension);
+ if (_ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",_ModifierExtension);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Base.cs b/src/Hl7.Fhir.Base/Model/Generated/Base.cs
index 6ebbce7f19..8fa9b969cb 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Base.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Base.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -56,12 +59,8 @@ public abstract partial class Base
{
protected internal virtual void CopyToInternal(Base other)
{
- var dest = other as Base;
-
- if (dest == null)
- {
+ if(other is not Base dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
if (_annotations is not null)
dest.annotations.AddRange(annotations);
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Base64Binary.cs b/src/Hl7.Fhir.Base/Model/Generated/Base64Binary.cs
index 12a3214ba8..4b75e4a3f9 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Base64Binary.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Base64Binary.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class Base64Binary : PrimitiveType, IValue
/// Must conform to the pattern "(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?"
public const string PATTERN = @"(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?";
- public Base64Binary(byte[] value)
+ public Base64Binary(byte[]? value)
{
Value = value;
}
- public Base64Binary(): this((byte[])null) {}
+ public Base64Binary(): this((byte[]?)null) {}
protected internal override Base DeepCopyInternal()
{
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Binary.cs b/src/Hl7.Fhir.Base/Model/Generated/Binary.cs
index 74db8051e9..380660714c 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Binary.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Binary.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -70,28 +73,25 @@ public partial class Binary : Hl7.Fhir.Model.Resource
[Binding("MimeType")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.Code ContentTypeElement
+ public Hl7.Fhir.Model.Code? ContentTypeElement
{
get { return _ContentTypeElement; }
set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); }
}
- private Hl7.Fhir.Model.Code _ContentTypeElement;
+ private Hl7.Fhir.Model.Code? _ContentTypeElement;
///
/// MimeType of the binary content
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string ContentType
+ public string? ContentType
{
- get { return ContentTypeElement != null ? ContentTypeElement.Value : null; }
+ get => _ContentTypeElement?.Value;
set
{
- if (value == null)
- ContentTypeElement = null;
- else
- ContentTypeElement = new Hl7.Fhir.Model.Code(value);
+ ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("ContentType");
}
}
@@ -103,13 +103,13 @@ public string ContentType
[CLSCompliant(false)]
[References("Resource")]
[DataMember]
- public Hl7.Fhir.Model.ResourceReference SecurityContext
+ public Hl7.Fhir.Model.ResourceReference? SecurityContext
{
get { return _SecurityContext; }
set { _SecurityContext = value; OnPropertyChanged("SecurityContext"); }
}
- private Hl7.Fhir.Model.ResourceReference _SecurityContext;
+ private Hl7.Fhir.Model.ResourceReference? _SecurityContext;
///
/// The actual content.
@@ -120,28 +120,25 @@ public Hl7.Fhir.Model.ResourceReference SecurityContext
[FhirElement("content", Order=70)]
[NotMapped(Since=FhirRelease.R4)]
[DataMember]
- public Hl7.Fhir.Model.Base64Binary ContentElement
+ public Hl7.Fhir.Model.Base64Binary? ContentElement
{
get { return _ContentElement; }
set { _ContentElement = value; OnPropertyChanged("ContentElement"); }
}
- private Hl7.Fhir.Model.Base64Binary _ContentElement;
+ private Hl7.Fhir.Model.Base64Binary? _ContentElement;
///
/// The actual content
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public byte[] Content
+ public byte[]? Content
{
- get { return ContentElement != null ? ContentElement.Value : null; }
+ get => _ContentElement?.Value;
set
{
- if (value == null)
- ContentElement = null;
- else
- ContentElement = new Hl7.Fhir.Model.Base64Binary(value);
+ ContentElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value);
OnPropertyChanged("Content");
}
}
@@ -154,46 +151,39 @@ public byte[] Content
///
[FhirElement("data", Order=70, Since=FhirRelease.R4)]
[DataMember]
- public Hl7.Fhir.Model.Base64Binary DataElement
+ public Hl7.Fhir.Model.Base64Binary? DataElement
{
get { return _DataElement; }
set { _DataElement = value; OnPropertyChanged("DataElement"); }
}
- private Hl7.Fhir.Model.Base64Binary _DataElement;
+ private Hl7.Fhir.Model.Base64Binary? _DataElement;
///
/// The actual content
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public byte[] Data
+ public byte[]? Data
{
- get { return DataElement != null ? DataElement.Value : null; }
+ get => _DataElement?.Value;
set
{
- if (value == null)
- DataElement = null;
- else
- DataElement = new Hl7.Fhir.Model.Base64Binary(value);
+ DataElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value);
OnPropertyChanged("Data");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Binary;
-
- if (dest == null)
- {
+ if(other is not Binary dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal();
- if(SecurityContext != null) dest.SecurityContext = (Hl7.Fhir.Model.ResourceReference)SecurityContext.DeepCopyInternal();
- if(ContentElement != null) dest.ContentElement = (Hl7.Fhir.Model.Base64Binary)ContentElement.DeepCopyInternal();
- if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)DataElement.DeepCopyInternal();
+ if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal();
+ if(_SecurityContext is not null) dest.SecurityContext = (Hl7.Fhir.Model.ResourceReference)_SecurityContext.DeepCopyInternal();
+ if(_ContentElement is not null) dest.ContentElement = (Hl7.Fhir.Model.Base64Binary)_ContentElement.DeepCopyInternal();
+ if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)_DataElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -205,55 +195,56 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Binary;
- if(otherT == null) return false;
+ if(other is not Binary otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false;
- if(!comparer.Equals(SecurityContext, otherT.SecurityContext)) return false;
- if(!comparer.Equals(ContentElement, otherT.ContentElement)) return false;
- if(!comparer.Equals(DataElement, otherT.DataElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false;
+ if(!comparer.Equals(_SecurityContext, otherT._SecurityContext)) return false;
+ if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false;
+ if(!comparer.Equals(_DataElement, otherT._DataElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "contentType":
- value = ContentTypeElement;
- return ContentTypeElement is not null;
+ value = _ContentTypeElement;
+ return _ContentTypeElement is not null;
case "securityContext":
- value = SecurityContext;
- return SecurityContext is not null;
+ value = _SecurityContext;
+ return _SecurityContext is not null;
case "content":
- value = ContentElement;
- return ContentElement is not null;
+ value = _ContentElement;
+ return _ContentElement is not null;
case "data":
- value = DataElement;
- return DataElement is not null;
+ value = _DataElement;
+ return _DataElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "contentType":
- ContentTypeElement = (Hl7.Fhir.Model.Code)value;
+ ContentTypeElement = (Hl7.Fhir.Model.Code?)value;
return this;
case "securityContext":
- SecurityContext = (Hl7.Fhir.Model.ResourceReference)value;
+ SecurityContext = (Hl7.Fhir.Model.ResourceReference?)value;
return this;
case "content":
- ContentElement = (Hl7.Fhir.Model.Base64Binary)value;
+ ContentElement = (Hl7.Fhir.Model.Base64Binary?)value;
return this;
case "data":
- DataElement = (Hl7.Fhir.Model.Base64Binary)value;
+ DataElement = (Hl7.Fhir.Model.Base64Binary?)value;
return this;
default:
return base.SetValue(key, value);
@@ -264,10 +255,10 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement);
- if (SecurityContext is not null) yield return new KeyValuePair("securityContext",SecurityContext);
- if (ContentElement is not null) yield return new KeyValuePair("content",ContentElement);
- if (DataElement is not null) yield return new KeyValuePair("data",DataElement);
+ if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement);
+ if (_SecurityContext is not null) yield return new KeyValuePair("securityContext",_SecurityContext);
+ if (_ContentElement is not null) yield return new KeyValuePair("content",_ContentElement);
+ if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs
index d2d5e91288..3335a99846 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model
[Serializable]
[DataContract]
[FhirType("Bundle","http://hl7.org/fhir/StructureDefinition/Bundle")]
- public partial class Bundle : Hl7.Fhir.Model.Resource, IIdentifiable
+ public partial class Bundle : Hl7.Fhir.Model.Resource, IIdentifiable
{
///
/// FHIR Type Name
@@ -969,28 +972,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement
[DeclaredType(Type = typeof(Hl7.Fhir.Model.Code), Since = FhirRelease.R5)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.PrimitiveType RelationElement
+ public Hl7.Fhir.Model.PrimitiveType? RelationElement
{
get { return _RelationElement; }
set { _RelationElement = value; OnPropertyChanged("RelationElement"); }
}
- private Hl7.Fhir.Model.PrimitiveType _RelationElement;
+ private Hl7.Fhir.Model.PrimitiveType? _RelationElement;
///
/// See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1. Use this property in STU3, R4 and R4B.
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string RelationString
+ public string? RelationString
{
- get { return RelationElement != null ? ((IValue)RelationElement).Value : null; }
+ get => ((IValue?)_RelationElement)?.Value;
set
{
- if (value == null)
- RelationElement = null;
- else
- RelationElement = new Hl7.Fhir.Model.FhirString(value);
+ RelationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("RelationString");
}
}
@@ -1000,15 +1000,12 @@ public string RelationString
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Relation
+ public string? Relation
{
- get { return RelationElement != null ? ((IValue)RelationElement).Value : null; }
+ get => ((IValue?)_RelationElement)?.Value;
set
{
- if (value == null)
- RelationElement = null;
- else
- RelationElement = new Hl7.Fhir.Model.Code(value);
+ RelationElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("Relation");
}
}
@@ -1019,44 +1016,37 @@ public string Relation
[FhirElement("url", InSummary=true, Order=50)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri UrlElement
+ public Hl7.Fhir.Model.FhirUri? UrlElement
{
get { return _UrlElement; }
set { _UrlElement = value; OnPropertyChanged("UrlElement"); }
}
- private Hl7.Fhir.Model.FhirUri _UrlElement;
+ private Hl7.Fhir.Model.FhirUri? _UrlElement;
///
/// Reference details for the link
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Url
+ public string? Url
{
- get { return UrlElement != null ? UrlElement.Value : null; }
+ get => _UrlElement?.Value;
set
{
- if (value == null)
- UrlElement = null;
- else
- UrlElement = new Hl7.Fhir.Model.FhirUri(value);
+ UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("Url");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as LinkComponent;
-
- if (dest == null)
- {
+ if(other is not LinkComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(RelationElement != null) dest.RelationElement = (Hl7.Fhir.Model.PrimitiveType)RelationElement.DeepCopyInternal();
- if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal();
+ if(_RelationElement is not null) dest.RelationElement = (Hl7.Fhir.Model.PrimitiveType)_RelationElement.DeepCopyInternal();
+ if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -1068,41 +1058,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as LinkComponent;
- if(otherT == null) return false;
+ if(other is not LinkComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(RelationElement, otherT.RelationElement)) return false;
- if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_RelationElement, otherT._RelationElement)) return false;
+ if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "relation":
- value = RelationElement;
- return RelationElement is not null;
+ value = _RelationElement;
+ return _RelationElement is not null;
case "url":
- value = UrlElement;
- return UrlElement is not null;
+ value = _UrlElement;
+ return _UrlElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "relation":
- RelationElement = (Hl7.Fhir.Model.PrimitiveType)value;
+ RelationElement = (Hl7.Fhir.Model.PrimitiveType?)value;
return this;
case "url":
- UrlElement = (Hl7.Fhir.Model.FhirUri)value;
+ UrlElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
default:
return base.SetValue(key, value);
@@ -1113,8 +1104,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (RelationElement is not null) yield return new KeyValuePair("relation",RelationElement);
- if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement);
+ if (_RelationElement is not null) yield return new KeyValuePair("relation",_RelationElement);
+ if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement);
}
}
@@ -1143,39 +1134,36 @@ public partial class EntryComponent : Hl7.Fhir.Model.BackboneElement
[DataMember]
public List Link
{
- get { if(_Link==null) _Link = new List(); return _Link; }
+ get => _Link ??= [];
set { _Link = value; OnPropertyChanged("Link"); }
}
- private List _Link;
+ private List? _Link;
///
/// URI for resource (e.g. the absolute URL server address, URI for UUID/OID, etc.).
///
[FhirElement("fullUrl", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri FullUrlElement
+ public Hl7.Fhir.Model.FhirUri? FullUrlElement
{
get { return _FullUrlElement; }
set { _FullUrlElement = value; OnPropertyChanged("FullUrlElement"); }
}
- private Hl7.Fhir.Model.FhirUri _FullUrlElement;
+ private Hl7.Fhir.Model.FhirUri? _FullUrlElement;
///
/// URI for resource (e.g. the absolute URL server address, URI for UUID/OID, etc.)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string FullUrl
+ public string? FullUrl
{
- get { return FullUrlElement != null ? FullUrlElement.Value : null; }
+ get => _FullUrlElement?.Value;
set
{
- if (value == null)
- FullUrlElement = null;
- else
- FullUrlElement = new Hl7.Fhir.Model.FhirUri(value);
+ FullUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("FullUrl");
}
}
@@ -1187,69 +1175,65 @@ public string FullUrl
[CLSCompliant(false)]
[AllowedTypes(typeof(Hl7.Fhir.Model.Resource))]
[DataMember]
- public Hl7.Fhir.Model.Resource Resource
+ public Hl7.Fhir.Model.Resource? Resource
{
get { return _Resource; }
set { _Resource = value; OnPropertyChanged("Resource"); }
}
- private Hl7.Fhir.Model.Resource _Resource;
+ private Hl7.Fhir.Model.Resource? _Resource;
///
/// Search related information.
///
[FhirElement("search", InSummary=true, Order=70)]
[DataMember]
- public Hl7.Fhir.Model.Bundle.SearchComponent Search
+ public Hl7.Fhir.Model.Bundle.SearchComponent? Search
{
get { return _Search; }
set { _Search = value; OnPropertyChanged("Search"); }
}
- private Hl7.Fhir.Model.Bundle.SearchComponent _Search;
+ private Hl7.Fhir.Model.Bundle.SearchComponent? _Search;
///
/// Additional execution information (transaction/batch/history).
///
[FhirElement("request", InSummary=true, Order=80)]
[DataMember]
- public Hl7.Fhir.Model.Bundle.RequestComponent Request
+ public Hl7.Fhir.Model.Bundle.RequestComponent? Request
{
get { return _Request; }
set { _Request = value; OnPropertyChanged("Request"); }
}
- private Hl7.Fhir.Model.Bundle.RequestComponent _Request;
+ private Hl7.Fhir.Model.Bundle.RequestComponent? _Request;
///
/// Results of execution (transaction/batch/history).
///
[FhirElement("response", InSummary=true, Order=90)]
[DataMember]
- public Hl7.Fhir.Model.Bundle.ResponseComponent Response
+ public Hl7.Fhir.Model.Bundle.ResponseComponent? Response
{
get { return _Response; }
set { _Response = value; OnPropertyChanged("Response"); }
}
- private Hl7.Fhir.Model.Bundle.ResponseComponent _Response;
+ private Hl7.Fhir.Model.Bundle.ResponseComponent? _Response;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as EntryComponent;
-
- if (dest == null)
- {
+ if(other is not EntryComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal());
- if(FullUrlElement != null) dest.FullUrlElement = (Hl7.Fhir.Model.FhirUri)FullUrlElement.DeepCopyInternal();
- if(Resource != null) dest.Resource = (Hl7.Fhir.Model.Resource)Resource.DeepCopyInternal();
- if(Search != null) dest.Search = (Hl7.Fhir.Model.Bundle.SearchComponent)Search.DeepCopyInternal();
- if(Request != null) dest.Request = (Hl7.Fhir.Model.Bundle.RequestComponent)Request.DeepCopyInternal();
- if(Response != null) dest.Response = (Hl7.Fhir.Model.Bundle.ResponseComponent)Response.DeepCopyInternal();
+ if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal());
+ if(_FullUrlElement is not null) dest.FullUrlElement = (Hl7.Fhir.Model.FhirUri)_FullUrlElement.DeepCopyInternal();
+ if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.Resource)_Resource.DeepCopyInternal();
+ if(_Search is not null) dest.Search = (Hl7.Fhir.Model.Bundle.SearchComponent)_Search.DeepCopyInternal();
+ if(_Request is not null) dest.Request = (Hl7.Fhir.Model.Bundle.RequestComponent)_Request.DeepCopyInternal();
+ if(_Response is not null) dest.Response = (Hl7.Fhir.Model.Bundle.ResponseComponent)_Response.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -1261,69 +1245,70 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as EntryComponent;
- if(otherT == null) return false;
+ if(other is not EntryComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.ListEquals(Link, otherT.Link)) return false;
- if(!comparer.Equals(FullUrlElement, otherT.FullUrlElement)) return false;
- if(!comparer.Equals(Resource, otherT.Resource)) return false;
- if(!comparer.Equals(Search, otherT.Search)) return false;
- if(!comparer.Equals(Request, otherT.Request)) return false;
- if(!comparer.Equals(Response, otherT.Response)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.ListEquals(_Link, otherT._Link)) return false;
+ if(!comparer.Equals(_FullUrlElement, otherT._FullUrlElement)) return false;
+ if(!comparer.Equals(_Resource, otherT._Resource)) return false;
+ if(!comparer.Equals(_Search, otherT._Search)) return false;
+ if(!comparer.Equals(_Request, otherT._Request)) return false;
+ if(!comparer.Equals(_Response, otherT._Response)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "link":
- value = Link;
- return Link?.Any() == true;
+ value = _Link;
+ return _Link?.Any() == true;
case "fullUrl":
- value = FullUrlElement;
- return FullUrlElement is not null;
+ value = _FullUrlElement;
+ return _FullUrlElement is not null;
case "resource":
- value = Resource;
- return Resource is not null;
+ value = _Resource;
+ return _Resource is not null;
case "search":
- value = Search;
- return Search is not null;
+ value = _Search;
+ return _Search is not null;
case "request":
- value = Request;
- return Request is not null;
+ value = _Request;
+ return _Request is not null;
case "response":
- value = Response;
- return Response is not null;
+ value = _Response;
+ return _Response is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "link":
- Link = (List)value;
+ Link = (List?)value!;
return this;
case "fullUrl":
- FullUrlElement = (Hl7.Fhir.Model.FhirUri)value;
+ FullUrlElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "resource":
- Resource = (Hl7.Fhir.Model.Resource)value;
+ Resource = (Hl7.Fhir.Model.Resource?)value;
return this;
case "search":
- Search = (Hl7.Fhir.Model.Bundle.SearchComponent)value;
+ Search = (Hl7.Fhir.Model.Bundle.SearchComponent?)value;
return this;
case "request":
- Request = (Hl7.Fhir.Model.Bundle.RequestComponent)value;
+ Request = (Hl7.Fhir.Model.Bundle.RequestComponent?)value;
return this;
case "response":
- Response = (Hl7.Fhir.Model.Bundle.ResponseComponent)value;
+ Response = (Hl7.Fhir.Model.Bundle.ResponseComponent?)value;
return this;
default:
return base.SetValue(key, value);
@@ -1334,12 +1319,12 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Link?.Any() == true) yield return new KeyValuePair("link",Link);
- if (FullUrlElement is not null) yield return new KeyValuePair("fullUrl",FullUrlElement);
- if (Resource is not null) yield return new KeyValuePair("resource",Resource);
- if (Search is not null) yield return new KeyValuePair("search",Search);
- if (Request is not null) yield return new KeyValuePair("request",Request);
- if (Response is not null) yield return new KeyValuePair("response",Response);
+ if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link);
+ if (_FullUrlElement is not null) yield return new KeyValuePair("fullUrl",_FullUrlElement);
+ if (_Resource is not null) yield return new KeyValuePair("resource",_Resource);
+ if (_Search is not null) yield return new KeyValuePair("search",_Search);
+ if (_Request is not null) yield return new KeyValuePair("request",_Request);
+ if (_Response is not null) yield return new KeyValuePair("response",_Response);
}
}
@@ -1367,13 +1352,13 @@ public partial class SearchComponent : Hl7.Fhir.Model.BackboneElement
[DeclaredType(Type = typeof(Code))]
[Binding("SearchEntryMode")]
[DataMember]
- public Code ModeElement
+ public Code? ModeElement
{
get { return _ModeElement; }
set { _ModeElement = value; OnPropertyChanged("ModeElement"); }
}
- private Code _ModeElement;
+ private Code? _ModeElement;
///
/// match | include - why this is in the result set
@@ -1382,13 +1367,10 @@ public Code ModeElement
[IgnoreDataMember]
public Hl7.Fhir.Model.Bundle.SearchEntryMode? Mode
{
- get { return ModeElement != null ? ModeElement.Value : null; }
+ get => _ModeElement?.Value;
set
{
- if (value == null)
- ModeElement = null;
- else
- ModeElement = new Code(value);
+ ModeElement = value is null ? null : new Code(value);
OnPropertyChanged("Mode");
}
}
@@ -1398,13 +1380,13 @@ public Hl7.Fhir.Model.Bundle.SearchEntryMode? Mode
///
[FhirElement("score", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.FhirDecimal ScoreElement
+ public Hl7.Fhir.Model.FhirDecimal? ScoreElement
{
get { return _ScoreElement; }
set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); }
}
- private Hl7.Fhir.Model.FhirDecimal _ScoreElement;
+ private Hl7.Fhir.Model.FhirDecimal? _ScoreElement;
///
/// Search ranking (between 0 and 1)
@@ -1413,29 +1395,22 @@ public Hl7.Fhir.Model.FhirDecimal ScoreElement
[IgnoreDataMember]
public decimal? Score
{
- get { return ScoreElement != null ? ScoreElement.Value : null; }
+ get => _ScoreElement?.Value;
set
{
- if (value == null)
- ScoreElement = null;
- else
- ScoreElement = new Hl7.Fhir.Model.FhirDecimal(value);
+ ScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value);
OnPropertyChanged("Score");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as SearchComponent;
-
- if (dest == null)
- {
+ if(other is not SearchComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal();
- if(ScoreElement != null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)ScoreElement.DeepCopyInternal();
+ if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal();
+ if(_ScoreElement is not null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)_ScoreElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -1447,41 +1422,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as SearchComponent;
- if(otherT == null) return false;
+ if(other is not SearchComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false;
- if(!comparer.Equals(ScoreElement, otherT.ScoreElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false;
+ if(!comparer.Equals(_ScoreElement, otherT._ScoreElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "mode":
- value = ModeElement;
- return ModeElement is not null;
+ value = _ModeElement;
+ return _ModeElement is not null;
case "score":
- value = ScoreElement;
- return ScoreElement is not null;
+ value = _ScoreElement;
+ return _ScoreElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "mode":
- ModeElement = (Code)value;
+ ModeElement = (Code?)value;
return this;
case "score":
- ScoreElement = (Hl7.Fhir.Model.FhirDecimal)value;
+ ScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value;
return this;
default:
return base.SetValue(key, value);
@@ -1492,8 +1468,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement);
- if (ScoreElement is not null) yield return new KeyValuePair("score",ScoreElement);
+ if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement);
+ if (_ScoreElement is not null) yield return new KeyValuePair("score",_ScoreElement);
}
}
@@ -1522,13 +1498,13 @@ public partial class RequestComponent : Hl7.Fhir.Model.BackboneElement
[Binding("HTTPVerb")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code MethodElement
+ public Code? MethodElement
{
get { return _MethodElement; }
set { _MethodElement = value; OnPropertyChanged("MethodElement"); }
}
- private Code _MethodElement;
+ private Code? _MethodElement;
///
/// GET | HEAD | POST | PUT | DELETE | PATCH
@@ -1537,13 +1513,10 @@ public Code MethodElement
[IgnoreDataMember]
public Hl7.Fhir.Model.Bundle.HTTPVerb? Method
{
- get { return MethodElement != null ? MethodElement.Value : null; }
+ get => _MethodElement?.Value;
set
{
- if (value == null)
- MethodElement = null;
- else
- MethodElement = new Code(value);
+ MethodElement = value is null ? null : new Code(value);
OnPropertyChanged("Method");
}
}
@@ -1554,28 +1527,25 @@ public Hl7.Fhir.Model.Bundle.HTTPVerb? Method
[FhirElement("url", InSummary=true, Order=50)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri UrlElement
+ public Hl7.Fhir.Model.FhirUri? UrlElement
{
get { return _UrlElement; }
set { _UrlElement = value; OnPropertyChanged("UrlElement"); }
}
- private Hl7.Fhir.Model.FhirUri _UrlElement;
+ private Hl7.Fhir.Model.FhirUri? _UrlElement;
///
/// URL for HTTP equivalent of this entry
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Url
+ public string? Url
{
- get { return UrlElement != null ? UrlElement.Value : null; }
+ get => _UrlElement?.Value;
set
{
- if (value == null)
- UrlElement = null;
- else
- UrlElement = new Hl7.Fhir.Model.FhirUri(value);
+ UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("Url");
}
}
@@ -1585,28 +1555,25 @@ public string Url
///
[FhirElement("ifNoneMatch", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.FhirString IfNoneMatchElement
+ public Hl7.Fhir.Model.FhirString? IfNoneMatchElement
{
get { return _IfNoneMatchElement; }
set { _IfNoneMatchElement = value; OnPropertyChanged("IfNoneMatchElement"); }
}
- private Hl7.Fhir.Model.FhirString _IfNoneMatchElement;
+ private Hl7.Fhir.Model.FhirString? _IfNoneMatchElement;
///
/// For managing cache validation
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string IfNoneMatch
+ public string? IfNoneMatch
{
- get { return IfNoneMatchElement != null ? IfNoneMatchElement.Value : null; }
+ get => _IfNoneMatchElement?.Value;
set
{
- if (value == null)
- IfNoneMatchElement = null;
- else
- IfNoneMatchElement = new Hl7.Fhir.Model.FhirString(value);
+ IfNoneMatchElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("IfNoneMatch");
}
}
@@ -1616,13 +1583,13 @@ public string IfNoneMatch
///
[FhirElement("ifModifiedSince", InSummary=true, Order=70)]
[DataMember]
- public Hl7.Fhir.Model.Instant IfModifiedSinceElement
+ public Hl7.Fhir.Model.Instant? IfModifiedSinceElement
{
get { return _IfModifiedSinceElement; }
set { _IfModifiedSinceElement = value; OnPropertyChanged("IfModifiedSinceElement"); }
}
- private Hl7.Fhir.Model.Instant _IfModifiedSinceElement;
+ private Hl7.Fhir.Model.Instant? _IfModifiedSinceElement;
///
/// For managing cache currency
@@ -1631,13 +1598,10 @@ public Hl7.Fhir.Model.Instant IfModifiedSinceElement
[IgnoreDataMember]
public DateTimeOffset? IfModifiedSince
{
- get { return IfModifiedSinceElement != null ? IfModifiedSinceElement.Value : null; }
+ get => _IfModifiedSinceElement?.Value;
set
{
- if (value == null)
- IfModifiedSinceElement = null;
- else
- IfModifiedSinceElement = new Hl7.Fhir.Model.Instant(value);
+ IfModifiedSinceElement = value is null ? null : new Hl7.Fhir.Model.Instant(value);
OnPropertyChanged("IfModifiedSince");
}
}
@@ -1647,28 +1611,25 @@ public DateTimeOffset? IfModifiedSince
///
[FhirElement("ifMatch", InSummary=true, Order=80)]
[DataMember]
- public Hl7.Fhir.Model.FhirString IfMatchElement
+ public Hl7.Fhir.Model.FhirString? IfMatchElement
{
get { return _IfMatchElement; }
set { _IfMatchElement = value; OnPropertyChanged("IfMatchElement"); }
}
- private Hl7.Fhir.Model.FhirString _IfMatchElement;
+ private Hl7.Fhir.Model.FhirString? _IfMatchElement;
///
/// For managing update contention
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string IfMatch
+ public string? IfMatch
{
- get { return IfMatchElement != null ? IfMatchElement.Value : null; }
+ get => _IfMatchElement?.Value;
set
{
- if (value == null)
- IfMatchElement = null;
- else
- IfMatchElement = new Hl7.Fhir.Model.FhirString(value);
+ IfMatchElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("IfMatch");
}
}
@@ -1678,48 +1639,41 @@ public string IfMatch
///
[FhirElement("ifNoneExist", InSummary=true, Order=90)]
[DataMember]
- public Hl7.Fhir.Model.FhirString IfNoneExistElement
+ public Hl7.Fhir.Model.FhirString? IfNoneExistElement
{
get { return _IfNoneExistElement; }
set { _IfNoneExistElement = value; OnPropertyChanged("IfNoneExistElement"); }
}
- private Hl7.Fhir.Model.FhirString _IfNoneExistElement;
+ private Hl7.Fhir.Model.FhirString? _IfNoneExistElement;
///
/// For conditional creates
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string IfNoneExist
+ public string? IfNoneExist
{
- get { return IfNoneExistElement != null ? IfNoneExistElement.Value : null; }
+ get => _IfNoneExistElement?.Value;
set
{
- if (value == null)
- IfNoneExistElement = null;
- else
- IfNoneExistElement = new Hl7.Fhir.Model.FhirString(value);
+ IfNoneExistElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("IfNoneExist");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as RequestComponent;
-
- if (dest == null)
- {
+ if(other is not RequestComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(MethodElement != null) dest.MethodElement = (Code)MethodElement.DeepCopyInternal();
- if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal();
- if(IfNoneMatchElement != null) dest.IfNoneMatchElement = (Hl7.Fhir.Model.FhirString)IfNoneMatchElement.DeepCopyInternal();
- if(IfModifiedSinceElement != null) dest.IfModifiedSinceElement = (Hl7.Fhir.Model.Instant)IfModifiedSinceElement.DeepCopyInternal();
- if(IfMatchElement != null) dest.IfMatchElement = (Hl7.Fhir.Model.FhirString)IfMatchElement.DeepCopyInternal();
- if(IfNoneExistElement != null) dest.IfNoneExistElement = (Hl7.Fhir.Model.FhirString)IfNoneExistElement.DeepCopyInternal();
+ if(_MethodElement is not null) dest.MethodElement = (Code)_MethodElement.DeepCopyInternal();
+ if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal();
+ if(_IfNoneMatchElement is not null) dest.IfNoneMatchElement = (Hl7.Fhir.Model.FhirString)_IfNoneMatchElement.DeepCopyInternal();
+ if(_IfModifiedSinceElement is not null) dest.IfModifiedSinceElement = (Hl7.Fhir.Model.Instant)_IfModifiedSinceElement.DeepCopyInternal();
+ if(_IfMatchElement is not null) dest.IfMatchElement = (Hl7.Fhir.Model.FhirString)_IfMatchElement.DeepCopyInternal();
+ if(_IfNoneExistElement is not null) dest.IfNoneExistElement = (Hl7.Fhir.Model.FhirString)_IfNoneExistElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -1731,69 +1685,70 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as RequestComponent;
- if(otherT == null) return false;
+ if(other is not RequestComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(MethodElement, otherT.MethodElement)) return false;
- if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false;
- if(!comparer.Equals(IfNoneMatchElement, otherT.IfNoneMatchElement)) return false;
- if(!comparer.Equals(IfModifiedSinceElement, otherT.IfModifiedSinceElement)) return false;
- if(!comparer.Equals(IfMatchElement, otherT.IfMatchElement)) return false;
- if(!comparer.Equals(IfNoneExistElement, otherT.IfNoneExistElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false;
+ if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false;
+ if(!comparer.Equals(_IfNoneMatchElement, otherT._IfNoneMatchElement)) return false;
+ if(!comparer.Equals(_IfModifiedSinceElement, otherT._IfModifiedSinceElement)) return false;
+ if(!comparer.Equals(_IfMatchElement, otherT._IfMatchElement)) return false;
+ if(!comparer.Equals(_IfNoneExistElement, otherT._IfNoneExistElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "method":
- value = MethodElement;
- return MethodElement is not null;
+ value = _MethodElement;
+ return _MethodElement is not null;
case "url":
- value = UrlElement;
- return UrlElement is not null;
+ value = _UrlElement;
+ return _UrlElement is not null;
case "ifNoneMatch":
- value = IfNoneMatchElement;
- return IfNoneMatchElement is not null;
+ value = _IfNoneMatchElement;
+ return _IfNoneMatchElement is not null;
case "ifModifiedSince":
- value = IfModifiedSinceElement;
- return IfModifiedSinceElement is not null;
+ value = _IfModifiedSinceElement;
+ return _IfModifiedSinceElement is not null;
case "ifMatch":
- value = IfMatchElement;
- return IfMatchElement is not null;
+ value = _IfMatchElement;
+ return _IfMatchElement is not null;
case "ifNoneExist":
- value = IfNoneExistElement;
- return IfNoneExistElement is not null;
+ value = _IfNoneExistElement;
+ return _IfNoneExistElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "method":
- MethodElement = (Code)value;
+ MethodElement = (Code?)value;
return this;
case "url":
- UrlElement = (Hl7.Fhir.Model.FhirUri)value;
+ UrlElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "ifNoneMatch":
- IfNoneMatchElement = (Hl7.Fhir.Model.FhirString)value;
+ IfNoneMatchElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "ifModifiedSince":
- IfModifiedSinceElement = (Hl7.Fhir.Model.Instant)value;
+ IfModifiedSinceElement = (Hl7.Fhir.Model.Instant?)value;
return this;
case "ifMatch":
- IfMatchElement = (Hl7.Fhir.Model.FhirString)value;
+ IfMatchElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "ifNoneExist":
- IfNoneExistElement = (Hl7.Fhir.Model.FhirString)value;
+ IfNoneExistElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
default:
return base.SetValue(key, value);
@@ -1804,12 +1759,12 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (MethodElement is not null) yield return new KeyValuePair("method",MethodElement);
- if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement);
- if (IfNoneMatchElement is not null) yield return new KeyValuePair("ifNoneMatch",IfNoneMatchElement);
- if (IfModifiedSinceElement is not null) yield return new KeyValuePair("ifModifiedSince",IfModifiedSinceElement);
- if (IfMatchElement is not null) yield return new KeyValuePair("ifMatch",IfMatchElement);
- if (IfNoneExistElement is not null) yield return new KeyValuePair("ifNoneExist",IfNoneExistElement);
+ if (_MethodElement is not null) yield return new KeyValuePair("method",_MethodElement);
+ if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement);
+ if (_IfNoneMatchElement is not null) yield return new KeyValuePair("ifNoneMatch",_IfNoneMatchElement);
+ if (_IfModifiedSinceElement is not null) yield return new KeyValuePair("ifModifiedSince",_IfModifiedSinceElement);
+ if (_IfMatchElement is not null) yield return new KeyValuePair("ifMatch",_IfMatchElement);
+ if (_IfNoneExistElement is not null) yield return new KeyValuePair("ifNoneExist",_IfNoneExistElement);
}
}
@@ -1836,28 +1791,25 @@ public partial class ResponseComponent : Hl7.Fhir.Model.BackboneElement
[FhirElement("status", InSummary=true, Order=40)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirString StatusElement
+ public Hl7.Fhir.Model.FhirString? StatusElement
{
get { return _StatusElement; }
set { _StatusElement = value; OnPropertyChanged("StatusElement"); }
}
- private Hl7.Fhir.Model.FhirString _StatusElement;
+ private Hl7.Fhir.Model.FhirString? _StatusElement;
///
/// Status response code (text optional)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Status
+ public string? Status
{
- get { return StatusElement != null ? StatusElement.Value : null; }
+ get => _StatusElement?.Value;
set
{
- if (value == null)
- StatusElement = null;
- else
- StatusElement = new Hl7.Fhir.Model.FhirString(value);
+ StatusElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Status");
}
}
@@ -1867,28 +1819,25 @@ public string Status
///
[FhirElement("location", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri LocationElement
+ public Hl7.Fhir.Model.FhirUri? LocationElement
{
get { return _LocationElement; }
set { _LocationElement = value; OnPropertyChanged("LocationElement"); }
}
- private Hl7.Fhir.Model.FhirUri _LocationElement;
+ private Hl7.Fhir.Model.FhirUri? _LocationElement;
///
/// The location (if the operation returns a location)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Location
+ public string? Location
{
- get { return LocationElement != null ? LocationElement.Value : null; }
+ get => _LocationElement?.Value;
set
{
- if (value == null)
- LocationElement = null;
- else
- LocationElement = new Hl7.Fhir.Model.FhirUri(value);
+ LocationElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("Location");
}
}
@@ -1898,28 +1847,25 @@ public string Location
///
[FhirElement("etag", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.FhirString EtagElement
+ public Hl7.Fhir.Model.FhirString? EtagElement
{
get { return _EtagElement; }
set { _EtagElement = value; OnPropertyChanged("EtagElement"); }
}
- private Hl7.Fhir.Model.FhirString _EtagElement;
+ private Hl7.Fhir.Model.FhirString? _EtagElement;
///
/// The Etag for the resource (if relevant)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Etag
+ public string? Etag
{
- get { return EtagElement != null ? EtagElement.Value : null; }
+ get => _EtagElement?.Value;
set
{
- if (value == null)
- EtagElement = null;
- else
- EtagElement = new Hl7.Fhir.Model.FhirString(value);
+ EtagElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Etag");
}
}
@@ -1929,13 +1875,13 @@ public string Etag
///
[FhirElement("lastModified", InSummary=true, Order=70)]
[DataMember]
- public Hl7.Fhir.Model.Instant LastModifiedElement
+ public Hl7.Fhir.Model.Instant? LastModifiedElement
{
get { return _LastModifiedElement; }
set { _LastModifiedElement = value; OnPropertyChanged("LastModifiedElement"); }
}
- private Hl7.Fhir.Model.Instant _LastModifiedElement;
+ private Hl7.Fhir.Model.Instant? _LastModifiedElement;
///
/// Server's date time modified
@@ -1944,13 +1890,10 @@ public Hl7.Fhir.Model.Instant LastModifiedElement
[IgnoreDataMember]
public DateTimeOffset? LastModified
{
- get { return LastModifiedElement != null ? LastModifiedElement.Value : null; }
+ get => _LastModifiedElement?.Value;
set
{
- if (value == null)
- LastModifiedElement = null;
- else
- LastModifiedElement = new Hl7.Fhir.Model.Instant(value);
+ LastModifiedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value);
OnPropertyChanged("LastModified");
}
}
@@ -1962,29 +1905,25 @@ public DateTimeOffset? LastModified
[CLSCompliant(false)]
[AllowedTypes(typeof(Hl7.Fhir.Model.Resource))]
[DataMember]
- public Hl7.Fhir.Model.Resource Outcome
+ public Hl7.Fhir.Model.Resource? Outcome
{
get { return _Outcome; }
set { _Outcome = value; OnPropertyChanged("Outcome"); }
}
- private Hl7.Fhir.Model.Resource _Outcome;
+ private Hl7.Fhir.Model.Resource? _Outcome;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as ResponseComponent;
-
- if (dest == null)
- {
+ if(other is not ResponseComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(StatusElement != null) dest.StatusElement = (Hl7.Fhir.Model.FhirString)StatusElement.DeepCopyInternal();
- if(LocationElement != null) dest.LocationElement = (Hl7.Fhir.Model.FhirUri)LocationElement.DeepCopyInternal();
- if(EtagElement != null) dest.EtagElement = (Hl7.Fhir.Model.FhirString)EtagElement.DeepCopyInternal();
- if(LastModifiedElement != null) dest.LastModifiedElement = (Hl7.Fhir.Model.Instant)LastModifiedElement.DeepCopyInternal();
- if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.Resource)Outcome.DeepCopyInternal();
+ if(_StatusElement is not null) dest.StatusElement = (Hl7.Fhir.Model.FhirString)_StatusElement.DeepCopyInternal();
+ if(_LocationElement is not null) dest.LocationElement = (Hl7.Fhir.Model.FhirUri)_LocationElement.DeepCopyInternal();
+ if(_EtagElement is not null) dest.EtagElement = (Hl7.Fhir.Model.FhirString)_EtagElement.DeepCopyInternal();
+ if(_LastModifiedElement is not null) dest.LastModifiedElement = (Hl7.Fhir.Model.Instant)_LastModifiedElement.DeepCopyInternal();
+ if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.Resource)_Outcome.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -1996,62 +1935,63 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as ResponseComponent;
- if(otherT == null) return false;
+ if(other is not ResponseComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false;
- if(!comparer.Equals(LocationElement, otherT.LocationElement)) return false;
- if(!comparer.Equals(EtagElement, otherT.EtagElement)) return false;
- if(!comparer.Equals(LastModifiedElement, otherT.LastModifiedElement)) return false;
- if(!comparer.Equals(Outcome, otherT.Outcome)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false;
+ if(!comparer.Equals(_LocationElement, otherT._LocationElement)) return false;
+ if(!comparer.Equals(_EtagElement, otherT._EtagElement)) return false;
+ if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false;
+ if(!comparer.Equals(_Outcome, otherT._Outcome)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "status":
- value = StatusElement;
- return StatusElement is not null;
+ value = _StatusElement;
+ return _StatusElement is not null;
case "location":
- value = LocationElement;
- return LocationElement is not null;
+ value = _LocationElement;
+ return _LocationElement is not null;
case "etag":
- value = EtagElement;
- return EtagElement is not null;
+ value = _EtagElement;
+ return _EtagElement is not null;
case "lastModified":
- value = LastModifiedElement;
- return LastModifiedElement is not null;
+ value = _LastModifiedElement;
+ return _LastModifiedElement is not null;
case "outcome":
- value = Outcome;
- return Outcome is not null;
+ value = _Outcome;
+ return _Outcome is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "status":
- StatusElement = (Hl7.Fhir.Model.FhirString)value;
+ StatusElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "location":
- LocationElement = (Hl7.Fhir.Model.FhirUri)value;
+ LocationElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "etag":
- EtagElement = (Hl7.Fhir.Model.FhirString)value;
+ EtagElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "lastModified":
- LastModifiedElement = (Hl7.Fhir.Model.Instant)value;
+ LastModifiedElement = (Hl7.Fhir.Model.Instant?)value;
return this;
case "outcome":
- Outcome = (Hl7.Fhir.Model.Resource)value;
+ Outcome = (Hl7.Fhir.Model.Resource?)value;
return this;
default:
return base.SetValue(key, value);
@@ -2062,11 +2002,11 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement);
- if (LocationElement is not null) yield return new KeyValuePair("location",LocationElement);
- if (EtagElement is not null) yield return new KeyValuePair("etag",EtagElement);
- if (LastModifiedElement is not null) yield return new KeyValuePair("lastModified",LastModifiedElement);
- if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome);
+ if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement);
+ if (_LocationElement is not null) yield return new KeyValuePair("location",_LocationElement);
+ if (_EtagElement is not null) yield return new KeyValuePair("etag",_EtagElement);
+ if (_LastModifiedElement is not null) yield return new KeyValuePair("lastModified",_LastModifiedElement);
+ if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome);
}
}
@@ -2076,13 +2016,13 @@ public override IEnumerable> EnumerateElements()
///
[FhirElement("identifier", InSummary=true, Order=50, FiveWs="FiveWs.identifier")]
[DataMember]
- public Hl7.Fhir.Model.Identifier Identifier
+ public Hl7.Fhir.Model.Identifier? Identifier
{
get { return _Identifier; }
set { _Identifier = value; OnPropertyChanged("Identifier"); }
}
- private Hl7.Fhir.Model.Identifier _Identifier;
+ private Hl7.Fhir.Model.Identifier? _Identifier;
///
/// document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection | subscription-notification.
@@ -2092,13 +2032,13 @@ public Hl7.Fhir.Model.Identifier Identifier
[Binding("BundleType")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code TypeElement
+ public Code? TypeElement
{
get { return _TypeElement; }
set { _TypeElement = value; OnPropertyChanged("TypeElement"); }
}
- private Code _TypeElement;
+ private Code? _TypeElement;
///
/// document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection | subscription-notification
@@ -2107,13 +2047,10 @@ public Code TypeElement
[IgnoreDataMember]
public Hl7.Fhir.Model.Bundle.BundleType? Type
{
- get { return TypeElement != null ? TypeElement.Value : null; }
+ get => _TypeElement?.Value;
set
{
- if (value == null)
- TypeElement = null;
- else
- TypeElement = new Code(value);
+ TypeElement = value is null ? null : new Code(value);
OnPropertyChanged("Type");
}
}
@@ -2126,13 +2063,13 @@ public Hl7.Fhir.Model.Bundle.BundleType? Type
///
[FhirElement("timestamp", InSummary=true, Order=70, FiveWs="FiveWs.init", Since=FhirRelease.R4)]
[DataMember]
- public Hl7.Fhir.Model.Instant TimestampElement
+ public Hl7.Fhir.Model.Instant? TimestampElement
{
get { return _TimestampElement; }
set { _TimestampElement = value; OnPropertyChanged("TimestampElement"); }
}
- private Hl7.Fhir.Model.Instant _TimestampElement;
+ private Hl7.Fhir.Model.Instant? _TimestampElement;
///
/// When the bundle was assembled
@@ -2141,13 +2078,10 @@ public Hl7.Fhir.Model.Instant TimestampElement
[IgnoreDataMember]
public DateTimeOffset? Timestamp
{
- get { return TimestampElement != null ? TimestampElement.Value : null; }
+ get => _TimestampElement?.Value;
set
{
- if (value == null)
- TimestampElement = null;
- else
- TimestampElement = new Hl7.Fhir.Model.Instant(value);
+ TimestampElement = value is null ? null : new Hl7.Fhir.Model.Instant(value);
OnPropertyChanged("Timestamp");
}
}
@@ -2157,13 +2091,13 @@ public DateTimeOffset? Timestamp
///
[FhirElement("total", InSummary=true, Order=80)]
[DataMember]
- public Hl7.Fhir.Model.UnsignedInt TotalElement
+ public Hl7.Fhir.Model.UnsignedInt? TotalElement
{
get { return _TotalElement; }
set { _TotalElement = value; OnPropertyChanged("TotalElement"); }
}
- private Hl7.Fhir.Model.UnsignedInt _TotalElement;
+ private Hl7.Fhir.Model.UnsignedInt? _TotalElement;
///
/// If search, the total number of matches
@@ -2172,13 +2106,10 @@ public Hl7.Fhir.Model.UnsignedInt TotalElement
[IgnoreDataMember]
public int? Total
{
- get { return TotalElement != null ? TotalElement.Value : null; }
+ get => _TotalElement?.Value;
set
{
- if (value == null)
- TotalElement = null;
- else
- TotalElement = new Hl7.Fhir.Model.UnsignedInt(value);
+ TotalElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value);
OnPropertyChanged("Total");
}
}
@@ -2191,11 +2122,11 @@ public int? Total
[DataMember]
public List Link
{
- get { if(_Link==null) _Link = new List(); return _Link; }
+ get => _Link ??= [];
set { _Link = value; OnPropertyChanged("Link"); }
}
- private List _Link;
+ private List? _Link;
///
/// Entry in the bundle - will have a resource or information.
@@ -2205,24 +2136,24 @@ public List Link
[DataMember]
public List Entry
{
- get { if(_Entry==null) _Entry = new List(); return _Entry; }
+ get => _Entry ??= [];
set { _Entry = value; OnPropertyChanged("Entry"); }
}
- private List _Entry;
+ private List? _Entry;
///
/// Digital Signature.
///
[FhirElement("signature", InSummary=true, Order=110)]
[DataMember]
- public Hl7.Fhir.Model.Signature Signature
+ public Hl7.Fhir.Model.Signature? Signature
{
get { return _Signature; }
set { _Signature = value; OnPropertyChanged("Signature"); }
}
- private Hl7.Fhir.Model.Signature _Signature;
+ private Hl7.Fhir.Model.Signature? _Signature;
///
/// Issues with the Bundle.
@@ -2234,34 +2165,30 @@ public Hl7.Fhir.Model.Signature Signature
[CLSCompliant(false)]
[AllowedTypes(typeof(Hl7.Fhir.Model.Resource))]
[DataMember]
- public Hl7.Fhir.Model.Resource Issues
+ public Hl7.Fhir.Model.Resource? Issues
{
get { return _Issues; }
set { _Issues = value; OnPropertyChanged("Issues"); }
}
- private Hl7.Fhir.Model.Resource _Issues;
+ private Hl7.Fhir.Model.Resource? _Issues;
- Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; }
+ Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; }
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Bundle;
-
- if (dest == null)
- {
+ if(other is not Bundle dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal();
- if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal();
- if(TimestampElement != null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)TimestampElement.DeepCopyInternal();
- if(TotalElement != null) dest.TotalElement = (Hl7.Fhir.Model.UnsignedInt)TotalElement.DeepCopyInternal();
- if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal());
- if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal());
- if(Signature != null) dest.Signature = (Hl7.Fhir.Model.Signature)Signature.DeepCopyInternal();
- if(Issues != null) dest.Issues = (Hl7.Fhir.Model.Resource)Issues.DeepCopyInternal();
+ if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal();
+ if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal();
+ if(_TimestampElement is not null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)_TimestampElement.DeepCopyInternal();
+ if(_TotalElement is not null) dest.TotalElement = (Hl7.Fhir.Model.UnsignedInt)_TotalElement.DeepCopyInternal();
+ if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal());
+ if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal());
+ if(_Signature is not null) dest.Signature = (Hl7.Fhir.Model.Signature)_Signature.DeepCopyInternal();
+ if(_Issues is not null) dest.Issues = (Hl7.Fhir.Model.Resource)_Issues.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -2273,83 +2200,84 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Bundle;
- if(otherT == null) return false;
+ if(other is not Bundle otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(Identifier, otherT.Identifier)) return false;
- if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false;
- if(!comparer.Equals(TimestampElement, otherT.TimestampElement)) return false;
- if(!comparer.Equals(TotalElement, otherT.TotalElement)) return false;
- if(!comparer.ListEquals(Link, otherT.Link)) return false;
- if(!comparer.ListEquals(Entry, otherT.Entry)) return false;
- if(!comparer.Equals(Signature, otherT.Signature)) return false;
- if(!comparer.Equals(Issues, otherT.Issues)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_Identifier, otherT._Identifier)) return false;
+ if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false;
+ if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false;
+ if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false;
+ if(!comparer.ListEquals(_Link, otherT._Link)) return false;
+ if(!comparer.ListEquals(_Entry, otherT._Entry)) return false;
+ if(!comparer.Equals(_Signature, otherT._Signature)) return false;
+ if(!comparer.Equals(_Issues, otherT._Issues)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "identifier":
- value = Identifier;
- return Identifier is not null;
+ value = _Identifier;
+ return _Identifier is not null;
case "type":
- value = TypeElement;
- return TypeElement is not null;
+ value = _TypeElement;
+ return _TypeElement is not null;
case "timestamp":
- value = TimestampElement;
- return TimestampElement is not null;
+ value = _TimestampElement;
+ return _TimestampElement is not null;
case "total":
- value = TotalElement;
- return TotalElement is not null;
+ value = _TotalElement;
+ return _TotalElement is not null;
case "link":
- value = Link;
- return Link?.Any() == true;
+ value = _Link;
+ return _Link?.Any() == true;
case "entry":
- value = Entry;
- return Entry?.Any() == true;
+ value = _Entry;
+ return _Entry?.Any() == true;
case "signature":
- value = Signature;
- return Signature is not null;
+ value = _Signature;
+ return _Signature is not null;
case "issues":
- value = Issues;
- return Issues is not null;
+ value = _Issues;
+ return _Issues is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "identifier":
- Identifier = (Hl7.Fhir.Model.Identifier)value;
+ Identifier = (Hl7.Fhir.Model.Identifier?)value;
return this;
case "type":
- TypeElement = (Code)value;
+ TypeElement = (Code?)value;
return this;
case "timestamp":
- TimestampElement = (Hl7.Fhir.Model.Instant)value;
+ TimestampElement = (Hl7.Fhir.Model.Instant?)value;
return this;
case "total":
- TotalElement = (Hl7.Fhir.Model.UnsignedInt)value;
+ TotalElement = (Hl7.Fhir.Model.UnsignedInt?)value;
return this;
case "link":
- Link = (List)value;
+ Link = (List?)value!;
return this;
case "entry":
- Entry = (List)value;
+ Entry = (List?)value!;
return this;
case "signature":
- Signature = (Hl7.Fhir.Model.Signature)value;
+ Signature = (Hl7.Fhir.Model.Signature?)value;
return this;
case "issues":
- Issues = (Hl7.Fhir.Model.Resource)value;
+ Issues = (Hl7.Fhir.Model.Resource?)value;
return this;
default:
return base.SetValue(key, value);
@@ -2360,14 +2288,14 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier);
- if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement);
- if (TimestampElement is not null) yield return new KeyValuePair("timestamp",TimestampElement);
- if (TotalElement is not null) yield return new KeyValuePair("total",TotalElement);
- if (Link?.Any() == true) yield return new KeyValuePair("link",Link);
- if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry);
- if (Signature is not null) yield return new KeyValuePair("signature",Signature);
- if (Issues is not null) yield return new KeyValuePair("issues",Issues);
+ if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier);
+ if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement);
+ if (_TimestampElement is not null) yield return new KeyValuePair("timestamp",_TimestampElement);
+ if (_TotalElement is not null) yield return new KeyValuePair("total",_TotalElement);
+ if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link);
+ if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry);
+ if (_Signature is not null) yield return new KeyValuePair("signature",_Signature);
+ if (_Issues is not null) yield return new KeyValuePair("issues",_Issues);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Canonical.cs b/src/Hl7.Fhir.Base/Model/Generated/Canonical.cs
index 4574c57ad2..ee532b7ef5 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Canonical.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Canonical.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class Canonical : PrimitiveType, IValue
/// Must conform to the pattern "\S*"
public const string PATTERN = @"\S*";
- public Canonical(string value)
+ public Canonical(string? value)
{
Value = value;
}
- public Canonical(): this((string)null) {}
+ public Canonical(): this((string?)null) {}
///
/// Primitive value of the element
@@ -75,9 +78,9 @@ public Canonical(): this((string)null) {}
[FhirElement("value", IsPrimitiveValue=true, XmlSerialization=XmlRepresentation.XmlAttr, InSummary=true, Order=30)]
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Code.cs b/src/Hl7.Fhir.Base/Model/Generated/Code.cs
index 5481ebc255..a3843aeba0 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Code.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Code.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -59,12 +62,12 @@ public partial class Code : PrimitiveType, IValue
/// Must conform to the pattern "[^\s]+( [^\s]+)*"
public const string PATTERN = @"[^\s]+( [^\s]+)*";
- public Code(string value)
+ public Code(string? value)
{
Value = value;
}
- public Code(): this((string)null) {}
+ public Code(): this((string?)null) {}
///
/// Primitive value of the element
@@ -73,9 +76,9 @@ public Code(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[CodePattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs
index dab9d114e7..1658d5be46 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -68,55 +71,48 @@ public partial class CodeableConcept : Hl7.Fhir.Model.DataType
[DataMember]
public List Coding
{
- get { if(_Coding==null) _Coding = new List(); return _Coding; }
+ get => _Coding ??= [];
set { _Coding = value; OnPropertyChanged("Coding"); }
}
- private List _Coding;
+ private List? _Coding;
///
/// Plain text representation of the concept.
///
[FhirElement("text", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.FhirString TextElement
+ public Hl7.Fhir.Model.FhirString? TextElement
{
get { return _TextElement; }
set { _TextElement = value; OnPropertyChanged("TextElement"); }
}
- private Hl7.Fhir.Model.FhirString _TextElement;
+ private Hl7.Fhir.Model.FhirString? _TextElement;
///
/// Plain text representation of the concept
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Text
+ public string? Text
{
- get { return TextElement != null ? TextElement.Value : null; }
+ get => _TextElement?.Value;
set
{
- if (value == null)
- TextElement = null;
- else
- TextElement = new Hl7.Fhir.Model.FhirString(value);
+ TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Text");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as CodeableConcept;
-
- if (dest == null)
- {
+ if(other is not CodeableConcept dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Coding.Any()) dest.Coding = new List(Coding.DeepCopyInternal());
- if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal();
+ if(_Coding is not null) dest.Coding = new List(_Coding.DeepCopyInternal());
+ if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -128,41 +124,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as CodeableConcept;
- if(otherT == null) return false;
+ if(other is not CodeableConcept otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.ListEquals(Coding, otherT.Coding)) return false;
- if(!comparer.Equals(TextElement, otherT.TextElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.ListEquals(_Coding, otherT._Coding)) return false;
+ if(!comparer.Equals(_TextElement, otherT._TextElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "coding":
- value = Coding;
- return Coding?.Any() == true;
+ value = _Coding;
+ return _Coding?.Any() == true;
case "text":
- value = TextElement;
- return TextElement is not null;
+ value = _TextElement;
+ return _TextElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "coding":
- Coding = (List)value;
+ Coding = (List?)value!;
return this;
case "text":
- TextElement = (Hl7.Fhir.Model.FhirString)value;
+ TextElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
default:
return base.SetValue(key, value);
@@ -173,8 +170,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Coding?.Any() == true) yield return new KeyValuePair("coding",Coding);
- if (TextElement is not null) yield return new KeyValuePair("text",TextElement);
+ if (_Coding?.Any() == true) yield return new KeyValuePair("coding",_Coding);
+ if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs
index 05dd1da8ac..1b8e939aa6 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -64,39 +67,35 @@ public partial class CodeableReference : Hl7.Fhir.Model.DataType
///
[FhirElement("concept", InSummary=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.CodeableConcept Concept
+ public Hl7.Fhir.Model.CodeableConcept? Concept
{
get { return _Concept; }
set { _Concept = value; OnPropertyChanged("Concept"); }
}
- private Hl7.Fhir.Model.CodeableConcept _Concept;
+ private Hl7.Fhir.Model.CodeableConcept? _Concept;
///
/// Reference to a resource (by instance).
///
[FhirElement("reference", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.ResourceReference Reference
+ public Hl7.Fhir.Model.ResourceReference? Reference
{
get { return _Reference; }
set { _Reference = value; OnPropertyChanged("Reference"); }
}
- private Hl7.Fhir.Model.ResourceReference _Reference;
+ private Hl7.Fhir.Model.ResourceReference? _Reference;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as CodeableReference;
-
- if (dest == null)
- {
+ if(other is not CodeableReference dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Concept != null) dest.Concept = (Hl7.Fhir.Model.CodeableConcept)Concept.DeepCopyInternal();
- if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal();
+ if(_Concept is not null) dest.Concept = (Hl7.Fhir.Model.CodeableConcept)_Concept.DeepCopyInternal();
+ if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -108,41 +107,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as CodeableReference;
- if(otherT == null) return false;
+ if(other is not CodeableReference otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(Concept, otherT.Concept)) return false;
- if(!comparer.Equals(Reference, otherT.Reference)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_Concept, otherT._Concept)) return false;
+ if(!comparer.Equals(_Reference, otherT._Reference)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "concept":
- value = Concept;
- return Concept is not null;
+ value = _Concept;
+ return _Concept is not null;
case "reference":
- value = Reference;
- return Reference is not null;
+ value = _Reference;
+ return _Reference is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "concept":
- Concept = (Hl7.Fhir.Model.CodeableConcept)value;
+ Concept = (Hl7.Fhir.Model.CodeableConcept?)value;
return this;
case "reference":
- Reference = (Hl7.Fhir.Model.ResourceReference)value;
+ Reference = (Hl7.Fhir.Model.ResourceReference?)value;
return this;
default:
return base.SetValue(key, value);
@@ -153,8 +153,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Concept is not null) yield return new KeyValuePair("concept",Concept);
- if (Reference is not null) yield return new KeyValuePair("reference",Reference);
+ if (_Concept is not null) yield return new KeyValuePair("concept",_Concept);
+ if (_Reference is not null) yield return new KeyValuePair("reference",_Reference);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Coding.cs b/src/Hl7.Fhir.Base/Model/Generated/Coding.cs
index 7466b0f9e4..1e01c6593e 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Coding.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Coding.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -64,28 +67,25 @@ public partial class Coding : Hl7.Fhir.Model.DataType
///
[FhirElement("system", InSummary=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri SystemElement
+ public Hl7.Fhir.Model.FhirUri? SystemElement
{
get { return _SystemElement; }
set { _SystemElement = value; OnPropertyChanged("SystemElement"); }
}
- private Hl7.Fhir.Model.FhirUri _SystemElement;
+ private Hl7.Fhir.Model.FhirUri? _SystemElement;
///
/// Identity of the terminology system
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string System
+ public string? System
{
- get { return SystemElement != null ? SystemElement.Value : null; }
+ get => _SystemElement?.Value;
set
{
- if (value == null)
- SystemElement = null;
- else
- SystemElement = new Hl7.Fhir.Model.FhirUri(value);
+ SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("System");
}
}
@@ -95,28 +95,25 @@ public string System
///
[FhirElement("version", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.FhirString VersionElement
+ public Hl7.Fhir.Model.FhirString? VersionElement
{
get { return _VersionElement; }
set { _VersionElement = value; OnPropertyChanged("VersionElement"); }
}
- private Hl7.Fhir.Model.FhirString _VersionElement;
+ private Hl7.Fhir.Model.FhirString? _VersionElement;
///
/// Version of the system - if relevant
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Version
+ public string? Version
{
- get { return VersionElement != null ? VersionElement.Value : null; }
+ get => _VersionElement?.Value;
set
{
- if (value == null)
- VersionElement = null;
- else
- VersionElement = new Hl7.Fhir.Model.FhirString(value);
+ VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Version");
}
}
@@ -126,28 +123,25 @@ public string Version
///
[FhirElement("code", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Code CodeElement
+ public Hl7.Fhir.Model.Code? CodeElement
{
get { return _CodeElement; }
set { _CodeElement = value; OnPropertyChanged("CodeElement"); }
}
- private Hl7.Fhir.Model.Code _CodeElement;
+ private Hl7.Fhir.Model.Code? _CodeElement;
///
/// Symbol in syntax defined by the system
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Code
+ public string? Code
{
- get { return CodeElement != null ? CodeElement.Value : null; }
+ get => _CodeElement?.Value;
set
{
- if (value == null)
- CodeElement = null;
- else
- CodeElement = new Hl7.Fhir.Model.Code(value);
+ CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("Code");
}
}
@@ -157,28 +151,25 @@ public string Code
///
[FhirElement("display", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.FhirString DisplayElement
+ public Hl7.Fhir.Model.FhirString? DisplayElement
{
get { return _DisplayElement; }
set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); }
}
- private Hl7.Fhir.Model.FhirString _DisplayElement;
+ private Hl7.Fhir.Model.FhirString? _DisplayElement;
///
/// Representation defined by the system
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Display
+ public string? Display
{
- get { return DisplayElement != null ? DisplayElement.Value : null; }
+ get => _DisplayElement?.Value;
set
{
- if (value == null)
- DisplayElement = null;
- else
- DisplayElement = new Hl7.Fhir.Model.FhirString(value);
+ DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Display");
}
}
@@ -188,13 +179,13 @@ public string Display
///
[FhirElement("userSelected", InSummary=true, Order=70)]
[DataMember]
- public Hl7.Fhir.Model.FhirBoolean UserSelectedElement
+ public Hl7.Fhir.Model.FhirBoolean? UserSelectedElement
{
get { return _UserSelectedElement; }
set { _UserSelectedElement = value; OnPropertyChanged("UserSelectedElement"); }
}
- private Hl7.Fhir.Model.FhirBoolean _UserSelectedElement;
+ private Hl7.Fhir.Model.FhirBoolean? _UserSelectedElement;
///
/// If this coding was chosen directly by the user
@@ -203,32 +194,25 @@ public Hl7.Fhir.Model.FhirBoolean UserSelectedElement
[IgnoreDataMember]
public bool? UserSelected
{
- get { return UserSelectedElement != null ? UserSelectedElement.Value : null; }
+ get => _UserSelectedElement?.Value;
set
{
- if (value == null)
- UserSelectedElement = null;
- else
- UserSelectedElement = new Hl7.Fhir.Model.FhirBoolean(value);
+ UserSelectedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value);
OnPropertyChanged("UserSelected");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Coding;
-
- if (dest == null)
- {
+ if(other is not Coding dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal();
- if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal();
- if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal();
- if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal();
- if(UserSelectedElement != null) dest.UserSelectedElement = (Hl7.Fhir.Model.FhirBoolean)UserSelectedElement.DeepCopyInternal();
+ if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal();
+ if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal();
+ if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal();
+ if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal();
+ if(_UserSelectedElement is not null) dest.UserSelectedElement = (Hl7.Fhir.Model.FhirBoolean)_UserSelectedElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -240,62 +224,63 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Coding;
- if(otherT == null) return false;
+ if(other is not Coding otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false;
- if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false;
- if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false;
- if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false;
- if(!comparer.Equals(UserSelectedElement, otherT.UserSelectedElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false;
+ if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false;
+ if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false;
+ if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false;
+ if(!comparer.Equals(_UserSelectedElement, otherT._UserSelectedElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "system":
- value = SystemElement;
- return SystemElement is not null;
+ value = _SystemElement;
+ return _SystemElement is not null;
case "version":
- value = VersionElement;
- return VersionElement is not null;
+ value = _VersionElement;
+ return _VersionElement is not null;
case "code":
- value = CodeElement;
- return CodeElement is not null;
+ value = _CodeElement;
+ return _CodeElement is not null;
case "display":
- value = DisplayElement;
- return DisplayElement is not null;
+ value = _DisplayElement;
+ return _DisplayElement is not null;
case "userSelected":
- value = UserSelectedElement;
- return UserSelectedElement is not null;
+ value = _UserSelectedElement;
+ return _UserSelectedElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "system":
- SystemElement = (Hl7.Fhir.Model.FhirUri)value;
+ SystemElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "version":
- VersionElement = (Hl7.Fhir.Model.FhirString)value;
+ VersionElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "code":
- CodeElement = (Hl7.Fhir.Model.Code)value;
+ CodeElement = (Hl7.Fhir.Model.Code?)value;
return this;
case "display":
- DisplayElement = (Hl7.Fhir.Model.FhirString)value;
+ DisplayElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "userSelected":
- UserSelectedElement = (Hl7.Fhir.Model.FhirBoolean)value;
+ UserSelectedElement = (Hl7.Fhir.Model.FhirBoolean?)value;
return this;
default:
return base.SetValue(key, value);
@@ -306,11 +291,11 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement);
- if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement);
- if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement);
- if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement);
- if (UserSelectedElement is not null) yield return new KeyValuePair("userSelected",UserSelectedElement);
+ if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement);
+ if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement);
+ if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement);
+ if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement);
+ if (_UserSelectedElement is not null) yield return new KeyValuePair("userSelected",_UserSelectedElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs
index 5bccaba8b9..97303ed63c 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -64,28 +67,25 @@ public partial class ContactDetail : Hl7.Fhir.Model.DataType
///
[FhirElement("name", InSummary=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.FhirString NameElement
+ public Hl7.Fhir.Model.FhirString? NameElement
{
get { return _NameElement; }
set { _NameElement = value; OnPropertyChanged("NameElement"); }
}
- private Hl7.Fhir.Model.FhirString _NameElement;
+ private Hl7.Fhir.Model.FhirString? _NameElement;
///
/// Name of an individual to contact
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Name
+ public string? Name
{
- get { return NameElement != null ? NameElement.Value : null; }
+ get => _NameElement?.Value;
set
{
- if (value == null)
- NameElement = null;
- else
- NameElement = new Hl7.Fhir.Model.FhirString(value);
+ NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Name");
}
}
@@ -98,24 +98,20 @@ public string Name
[DataMember]
public List Telecom
{
- get { if(_Telecom==null) _Telecom = new List(); return _Telecom; }
+ get => _Telecom ??= [];
set { _Telecom = value; OnPropertyChanged("Telecom"); }
}
- private List _Telecom;
+ private List? _Telecom;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as ContactDetail;
-
- if (dest == null)
- {
+ if(other is not ContactDetail dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal();
- if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal());
+ if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal();
+ if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -127,41 +123,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as ContactDetail;
- if(otherT == null) return false;
+ if(other is not ContactDetail otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(NameElement, otherT.NameElement)) return false;
- if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_NameElement, otherT._NameElement)) return false;
+ if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "name":
- value = NameElement;
- return NameElement is not null;
+ value = _NameElement;
+ return _NameElement is not null;
case "telecom":
- value = Telecom;
- return Telecom?.Any() == true;
+ value = _Telecom;
+ return _Telecom?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "name":
- NameElement = (Hl7.Fhir.Model.FhirString)value;
+ NameElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "telecom":
- Telecom = (List)value;
+ Telecom = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -172,8 +169,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (NameElement is not null) yield return new KeyValuePair("name",NameElement);
- if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom);
+ if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement);
+ if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs
index 0e145ac89e..dd94c16a07 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -158,13 +161,13 @@ public enum ContactPointUse
[DeclaredType(Type = typeof(Code))]
[Binding("ContactPointSystem")]
[DataMember]
- public Code SystemElement
+ public Code? SystemElement
{
get { return _SystemElement; }
set { _SystemElement = value; OnPropertyChanged("SystemElement"); }
}
- private Code _SystemElement;
+ private Code? _SystemElement;
///
/// phone | fax | email | pager | url | sms | other
@@ -173,13 +176,10 @@ public Code SystemElement
[IgnoreDataMember]
public Hl7.Fhir.Model.ContactPoint.ContactPointSystem? System
{
- get { return SystemElement != null ? SystemElement.Value : null; }
+ get => _SystemElement?.Value;
set
{
- if (value == null)
- SystemElement = null;
- else
- SystemElement = new Code(value);
+ SystemElement = value is null ? null : new Code(value);
OnPropertyChanged("System");
}
}
@@ -189,28 +189,25 @@ public Hl7.Fhir.Model.ContactPoint.ContactPointSystem? System
///
[FhirElement("value", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.FhirString ValueElement
+ public Hl7.Fhir.Model.FhirString? ValueElement
{
get { return _ValueElement; }
set { _ValueElement = value; OnPropertyChanged("ValueElement"); }
}
- private Hl7.Fhir.Model.FhirString _ValueElement;
+ private Hl7.Fhir.Model.FhirString? _ValueElement;
///
/// The actual contact point details
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Value
+ public string? Value
{
- get { return ValueElement != null ? ValueElement.Value : null; }
+ get => _ValueElement?.Value;
set
{
- if (value == null)
- ValueElement = null;
- else
- ValueElement = new Hl7.Fhir.Model.FhirString(value);
+ ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Value");
}
}
@@ -222,13 +219,13 @@ public string Value
[DeclaredType(Type = typeof(Code))]
[Binding("ContactPointUse")]
[DataMember]
- public Code UseElement
+ public Code? UseElement
{
get { return _UseElement; }
set { _UseElement = value; OnPropertyChanged("UseElement"); }
}
- private Code _UseElement;
+ private Code? _UseElement;
///
/// home | work | temp | old | mobile - purpose of this contact point
@@ -237,13 +234,10 @@ public Code UseElement
[IgnoreDataMember]
public Hl7.Fhir.Model.ContactPoint.ContactPointUse? Use
{
- get { return UseElement != null ? UseElement.Value : null; }
+ get => _UseElement?.Value;
set
{
- if (value == null)
- UseElement = null;
- else
- UseElement = new Code(value);
+ UseElement = value is null ? null : new Code(value);
OnPropertyChanged("Use");
}
}
@@ -253,13 +247,13 @@ public Hl7.Fhir.Model.ContactPoint.ContactPointUse? Use
///
[FhirElement("rank", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.PositiveInt RankElement
+ public Hl7.Fhir.Model.PositiveInt? RankElement
{
get { return _RankElement; }
set { _RankElement = value; OnPropertyChanged("RankElement"); }
}
- private Hl7.Fhir.Model.PositiveInt _RankElement;
+ private Hl7.Fhir.Model.PositiveInt? _RankElement;
///
/// Specify preferred order of use (1 = highest)
@@ -268,13 +262,10 @@ public Hl7.Fhir.Model.PositiveInt RankElement
[IgnoreDataMember]
public int? Rank
{
- get { return RankElement != null ? RankElement.Value : null; }
+ get => _RankElement?.Value;
set
{
- if (value == null)
- RankElement = null;
- else
- RankElement = new Hl7.Fhir.Model.PositiveInt(value);
+ RankElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value);
OnPropertyChanged("Rank");
}
}
@@ -284,29 +275,25 @@ public int? Rank
///
[FhirElement("period", InSummary=true, Order=70)]
[DataMember]
- public Hl7.Fhir.Model.Period Period
+ public Hl7.Fhir.Model.Period? Period
{
get { return _Period; }
set { _Period = value; OnPropertyChanged("Period"); }
}
- private Hl7.Fhir.Model.Period _Period;
+ private Hl7.Fhir.Model.Period? _Period;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as ContactPoint;
-
- if (dest == null)
- {
+ if(other is not ContactPoint dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(SystemElement != null) dest.SystemElement = (Code)SystemElement.DeepCopyInternal();
- if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal();
- if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal();
- if(RankElement != null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)RankElement.DeepCopyInternal();
- if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal();
+ if(_SystemElement is not null) dest.SystemElement = (Code)_SystemElement.DeepCopyInternal();
+ if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal();
+ if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal();
+ if(_RankElement is not null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)_RankElement.DeepCopyInternal();
+ if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -318,62 +305,63 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as ContactPoint;
- if(otherT == null) return false;
+ if(other is not ContactPoint otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false;
- if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false;
- if(!comparer.Equals(UseElement, otherT.UseElement)) return false;
- if(!comparer.Equals(RankElement, otherT.RankElement)) return false;
- if(!comparer.Equals(Period, otherT.Period)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false;
+ if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false;
+ if(!comparer.Equals(_UseElement, otherT._UseElement)) return false;
+ if(!comparer.Equals(_RankElement, otherT._RankElement)) return false;
+ if(!comparer.Equals(_Period, otherT._Period)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "system":
- value = SystemElement;
- return SystemElement is not null;
+ value = _SystemElement;
+ return _SystemElement is not null;
case "value":
- value = ValueElement;
- return ValueElement is not null;
+ value = _ValueElement;
+ return _ValueElement is not null;
case "use":
- value = UseElement;
- return UseElement is not null;
+ value = _UseElement;
+ return _UseElement is not null;
case "rank":
- value = RankElement;
- return RankElement is not null;
+ value = _RankElement;
+ return _RankElement is not null;
case "period":
- value = Period;
- return Period is not null;
+ value = _Period;
+ return _Period is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "system":
- SystemElement = (Code)value;
+ SystemElement = (Code?)value;
return this;
case "value":
- ValueElement = (Hl7.Fhir.Model.FhirString)value;
+ ValueElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "use":
- UseElement = (Code)value;
+ UseElement = (Code?)value;
return this;
case "rank":
- RankElement = (Hl7.Fhir.Model.PositiveInt)value;
+ RankElement = (Hl7.Fhir.Model.PositiveInt?)value;
return this;
case "period":
- Period = (Hl7.Fhir.Model.Period)value;
+ Period = (Hl7.Fhir.Model.Period?)value;
return this;
default:
return base.SetValue(key, value);
@@ -384,11 +372,11 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement);
- if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement);
- if (UseElement is not null) yield return new KeyValuePair("use",UseElement);
- if (RankElement is not null) yield return new KeyValuePair("rank",RankElement);
- if (Period is not null) yield return new KeyValuePair("period",Period);
+ if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement);
+ if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement);
+ if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement);
+ if (_RankElement is not null) yield return new KeyValuePair("rank",_RankElement);
+ if (_Period is not null) yield return new KeyValuePair("period",_Period);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/DataType.cs b/src/Hl7.Fhir.Base/Model/Generated/DataType.cs
index 26b0a62e07..8e616ebd33 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/DataType.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/DataType.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -56,22 +59,19 @@ public abstract partial class DataType : Hl7.Fhir.Model.Element
{
protected internal override void CopyToInternal(Base other)
{
- var dest = other as DataType;
-
- if (dest == null)
- {
+ if(other is not DataType dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
}
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as DataType;
- if(otherT == null) return false;
+ if(other is not DataType otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Date.cs b/src/Hl7.Fhir.Base/Model/Generated/Date.cs
index efb4b4b05c..86e5c92e3c 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Date.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Date.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -59,12 +62,12 @@ public partial class Date : PrimitiveType, IValue
/// Must conform to the pattern "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1]))?)?"
public const string PATTERN = @"([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1]))?)?";
- public Date(string value)
+ public Date(string? value)
{
Value = value;
}
- public Date(): this((string)null) {}
+ public Date(): this((string?)null) {}
///
/// Primitive value of the element
@@ -73,9 +76,9 @@ public Date(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.Date))]
[DatePattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs
index b50e9962a8..7c709d0a1d 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -59,13 +62,13 @@ public abstract partial class DomainResource : Hl7.Fhir.Model.Resource, Hl7.Fhir
///
[FhirElement("text", Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Narrative Text
+ public Hl7.Fhir.Model.Narrative? Text
{
get { return _Text; }
set { _Text = value; OnPropertyChanged("Text"); }
}
- private Hl7.Fhir.Model.Narrative _Text;
+ private Hl7.Fhir.Model.Narrative? _Text;
///
/// Contained, inline Resources.
@@ -77,11 +80,11 @@ public Hl7.Fhir.Model.Narrative Text
[DataMember]
public List Contained
{
- get { if(_Contained==null) _Contained = new List(); return _Contained; }
+ get => _Contained ??= [];
set { _Contained = value; OnPropertyChanged("Contained"); }
}
- private List _Contained;
+ private List? _Contained;
///
/// Additional content defined by implementations.
@@ -91,11 +94,11 @@ public List Contained
[DataMember]
public List Extension
{
- get { if(_Extension==null) _Extension = new List(); return _Extension; }
+ get => _Extension ??= [];
set { _Extension = value; OnPropertyChanged("Extension"); }
}
- private List _Extension;
+ private List? _Extension;
///
/// Extensions that cannot be ignored.
@@ -105,79 +108,76 @@ public List Extension
[DataMember]
public List ModifierExtension
{
- get { if(_ModifierExtension==null) _ModifierExtension = new List(); return _ModifierExtension; }
+ get => _ModifierExtension ??= [];
set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); }
}
- private List _ModifierExtension;
+ private List? _ModifierExtension;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as DomainResource;
-
- if (dest == null)
- {
+ if(other is not DomainResource dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Text != null) dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopyInternal();
- if(Contained.Any()) dest.Contained = new List(Contained.DeepCopyInternal());
- if(Extension.Any()) dest.Extension = new List(Extension.DeepCopyInternal());
- if(ModifierExtension.Any()) dest.ModifierExtension = new List(ModifierExtension.DeepCopyInternal());
+ if(_Text is not null) dest.Text = (Hl7.Fhir.Model.Narrative)_Text.DeepCopyInternal();
+ if(_Contained is not null) dest.Contained = new List(_Contained.DeepCopyInternal());
+ if(_Extension is not null) dest.Extension = new List(_Extension.DeepCopyInternal());
+ if(_ModifierExtension is not null) dest.ModifierExtension = new List(_ModifierExtension.DeepCopyInternal());
}
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as DomainResource;
- if(otherT == null) return false;
+ if(other is not DomainResource otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(Text, otherT.Text)) return false;
- if(!comparer.ListEquals(Contained, otherT.Contained)) return false;
- if(!comparer.ListEquals(Extension, otherT.Extension)) return false;
- if(!comparer.ListEquals(ModifierExtension, otherT.ModifierExtension)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_Text, otherT._Text)) return false;
+ if(!comparer.ListEquals(_Contained, otherT._Contained)) return false;
+ if(!comparer.ListEquals(_Extension, otherT._Extension)) return false;
+ if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "text":
- value = Text;
- return Text is not null;
+ value = _Text;
+ return _Text is not null;
case "contained":
- value = Contained;
- return Contained?.Any() == true;
+ value = _Contained;
+ return _Contained?.Any() == true;
case "extension":
- value = Extension;
- return Extension?.Any() == true;
+ value = _Extension;
+ return _Extension?.Any() == true;
case "modifierExtension":
- value = ModifierExtension;
- return ModifierExtension?.Any() == true;
+ value = _ModifierExtension;
+ return _ModifierExtension?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "text":
- Text = (Hl7.Fhir.Model.Narrative)value;
+ Text = (Hl7.Fhir.Model.Narrative?)value;
return this;
case "contained":
- Contained = (List)value;
+ Contained = (List?)value!;
return this;
case "extension":
- Extension = (List)value;
+ Extension = (List?)value!;
return this;
case "modifierExtension":
- ModifierExtension = (List)value;
+ ModifierExtension = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -188,10 +188,10 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Text is not null) yield return new KeyValuePair("text",Text);
- if (Contained?.Any() == true) yield return new KeyValuePair("contained",Contained);
- if (Extension?.Any() == true) yield return new KeyValuePair("extension",Extension);
- if (ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",ModifierExtension);
+ if (_Text is not null) yield return new KeyValuePair("text",_Text);
+ if (_Contained?.Any() == true) yield return new KeyValuePair("contained",_Contained);
+ if (_Extension?.Any() == true) yield return new KeyValuePair("extension",_Extension);
+ if (_ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",_ModifierExtension);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Element.cs b/src/Hl7.Fhir.Base/Model/Generated/Element.cs
index b786796903..49a344a700 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Element.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Element.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -59,28 +62,25 @@ public abstract partial class Element : Hl7.Fhir.Model.Base
///
[FhirElement("id", XmlSerialization = XmlRepresentation.XmlAttr, Order=10)]
[DataMember]
- public Hl7.Fhir.Model.FhirString ElementIdElement
+ public Hl7.Fhir.Model.FhirString? ElementIdElement
{
get { return _ElementIdElement; }
set { _ElementIdElement = value; OnPropertyChanged("ElementIdElement"); }
}
- private Hl7.Fhir.Model.FhirString _ElementIdElement;
+ private Hl7.Fhir.Model.FhirString? _ElementIdElement;
///
/// Unique id for inter-element referencing
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string ElementId
+ public string? ElementId
{
- get { return ElementIdElement != null ? ElementIdElement.Value : null; }
+ get => _ElementIdElement?.Value;
set
{
- if (value == null)
- ElementIdElement = null;
- else
- ElementIdElement = new Hl7.Fhir.Model.FhirString(value);
+ ElementIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("ElementId");
}
}
@@ -93,63 +93,60 @@ public string ElementId
[DataMember]
public List Extension
{
- get { if(_Extension==null) _Extension = new List(); return _Extension; }
+ get => _Extension ??= [];
set { _Extension = value; OnPropertyChanged("Extension"); }
}
- private List _Extension;
+ private List? _Extension;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Element;
-
- if (dest == null)
- {
+ if(other is not Element dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ElementIdElement != null) dest.ElementIdElement = (Hl7.Fhir.Model.FhirString)ElementIdElement.DeepCopyInternal();
- if(Extension.Any()) dest.Extension = new List(Extension.DeepCopyInternal());
+ if(_ElementIdElement is not null) dest.ElementIdElement = (Hl7.Fhir.Model.FhirString)_ElementIdElement.DeepCopyInternal();
+ if(_Extension is not null) dest.Extension = new List(_Extension.DeepCopyInternal());
}
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Element;
- if(otherT == null) return false;
+ if(other is not Element otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ElementIdElement, otherT.ElementIdElement)) return false;
- if(!comparer.ListEquals(Extension, otherT.Extension)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ElementIdElement, otherT._ElementIdElement)) return false;
+ if(!comparer.ListEquals(_Extension, otherT._Extension)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "id":
- value = ElementIdElement;
- return ElementIdElement is not null;
+ value = _ElementIdElement;
+ return _ElementIdElement is not null;
case "extension":
- value = Extension;
- return Extension?.Any() == true;
+ value = _Extension;
+ return _Extension?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "id":
- ElementIdElement = (Hl7.Fhir.Model.FhirString)value;
+ ElementIdElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "extension":
- Extension = (List)value;
+ Extension = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -160,8 +157,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ElementIdElement is not null) yield return new KeyValuePair("id",ElementIdElement);
- if (Extension?.Any() == true) yield return new KeyValuePair("extension",Extension);
+ if (_ElementIdElement is not null) yield return new KeyValuePair("id",_ElementIdElement);
+ if (_Extension?.Any() == true) yield return new KeyValuePair("extension",_Extension);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Extension.cs b/src/Hl7.Fhir.Base/Model/Generated/Extension.cs
index c0deb98418..2ec4a993d5 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Extension.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Extension.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -65,28 +68,25 @@ public partial class Extension : Hl7.Fhir.Model.DataType
[FhirElement("url", XmlSerialization = XmlRepresentation.XmlAttr, InSummary=true, Order=30)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri UrlElement
+ public Hl7.Fhir.Model.FhirUri? UrlElement
{
get { return _UrlElement; }
set { _UrlElement = value; OnPropertyChanged("UrlElement"); }
}
- private Hl7.Fhir.Model.FhirUri _UrlElement;
+ private Hl7.Fhir.Model.FhirUri? _UrlElement;
///
/// identifies the meaning of the extension
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Url
+ public string? Url
{
- get { return UrlElement != null ? UrlElement.Value : null; }
+ get => _UrlElement?.Value;
set
{
- if (value == null)
- UrlElement = null;
- else
- UrlElement = new Hl7.Fhir.Model.FhirUri(value);
+ UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("Url");
}
}
@@ -96,26 +96,22 @@ public string Url
///
[FhirElement("value", InSummary=true, Order=40, Choice=ChoiceType.DatatypeChoice)]
[DataMember]
- public Hl7.Fhir.Model.DataType Value
+ public Hl7.Fhir.Model.DataType? Value
{
get { return _Value; }
set { _Value = value; OnPropertyChanged("Value"); }
}
- private Hl7.Fhir.Model.DataType _Value;
+ private Hl7.Fhir.Model.DataType? _Value;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Extension;
-
- if (dest == null)
- {
+ if(other is not Extension dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal();
- if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal();
+ if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal();
+ if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -127,41 +123,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Extension;
- if(otherT == null) return false;
+ if(other is not Extension otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false;
- if(!comparer.Equals(Value, otherT.Value)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false;
+ if(!comparer.Equals(_Value, otherT._Value)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "url":
- value = UrlElement;
- return UrlElement is not null;
+ value = _UrlElement;
+ return _UrlElement is not null;
case "value":
- value = Value;
- return Value is not null;
+ value = _Value;
+ return _Value is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "url":
- UrlElement = (Hl7.Fhir.Model.FhirUri)value;
+ UrlElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "value":
- Value = (Hl7.Fhir.Model.DataType)value;
+ Value = (Hl7.Fhir.Model.DataType?)value;
return this;
default:
return base.SetValue(key, value);
@@ -172,8 +169,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement);
- if (Value is not null) yield return new KeyValuePair("value",Value);
+ if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement);
+ if (_Value is not null) yield return new KeyValuePair("value",_Value);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirBoolean.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirBoolean.cs
index fad870b494..3cb2ea23b6 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/FhirBoolean.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/FhirBoolean.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirDateTime.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirDateTime.cs
index d71b13ff9b..57791cc9b8 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/FhirDateTime.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/FhirDateTime.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class FhirDateTime : PrimitiveType, IValue
/// Must conform to the pattern "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?)?)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)?)?)?"
public const string PATTERN = @"([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?)?)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)?)?)?";
- public FhirDateTime(string value)
+ public FhirDateTime(string? value)
{
Value = value;
}
- public FhirDateTime(): this((string)null) {}
+ public FhirDateTime(): this((string?)null) {}
///
/// Primitive value of the element
@@ -76,9 +79,9 @@ public FhirDateTime(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.DateTime))]
[DateTimePattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirDecimal.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirDecimal.cs
index 35b1dde629..af4145b3bd 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/FhirDecimal.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/FhirDecimal.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirString.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirString.cs
index c562952927..0d66ad430e 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/FhirString.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/FhirString.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class FhirString : PrimitiveType, IValue
/// Must conform to the pattern "^[\s\S]+$"
public const string PATTERN = @"^[\s\S]+$";
- public FhirString(string value)
+ public FhirString(string? value)
{
Value = value;
}
- public FhirString(): this((string)null) {}
+ public FhirString(): this((string?)null) {}
///
/// Primitive value of the element
@@ -76,9 +79,9 @@ public FhirString(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[StringPattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs
index 7b61da5f3f..1d3f123ec1 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class FhirUri : PrimitiveType, IValue
/// Must conform to the pattern "\S*"
public const string PATTERN = @"\S*";
- public FhirUri(string value)
+ public FhirUri(string? value)
{
Value = value;
}
- public FhirUri(): this((string)null) {}
+ public FhirUri(): this((string?)null) {}
///
/// Primitive value of the element
@@ -76,9 +79,9 @@ public FhirUri(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[UriPattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs
index 605794031b..019cde620a 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -59,12 +62,12 @@ public partial class FhirUrl : PrimitiveType, IValue
/// Must conform to the pattern "\S*"
public const string PATTERN = @"\S*";
- public FhirUrl(string value)
+ public FhirUrl(string? value)
{
Value = value;
}
- public FhirUrl(): this((string)null) {}
+ public FhirUrl(): this((string?)null) {}
///
/// Primitive value of the element
@@ -72,9 +75,9 @@ public FhirUrl(): this((string)null) {}
[FhirElement("value", IsPrimitiveValue=true, XmlSerialization=XmlRepresentation.XmlAttr, InSummary=true, Order=30)]
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Id.cs b/src/Hl7.Fhir.Base/Model/Generated/Id.cs
index 7064bba8f6..0767912acc 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Id.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Id.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class Id : PrimitiveType, IValue
/// Must conform to the pattern "[A-Za-z0-9\-\.]{1,64}"
public const string PATTERN = @"[A-Za-z0-9\-\.]{1,64}";
- public Id(string value)
+ public Id(string? value)
{
Value = value;
}
- public Id(): this((string)null) {}
+ public Id(): this((string?)null) {}
///
/// Primitive value of the element
@@ -76,9 +79,9 @@ public Id(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[IdPattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs b/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs
index 33d6a0bf29..f86c1f7312 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -107,13 +110,13 @@ public enum IdentifierUse
[DeclaredType(Type = typeof(Code))]
[Binding("IdentifierUse")]
[DataMember]
- public Code UseElement
+ public Code? UseElement
{
get { return _UseElement; }
set { _UseElement = value; OnPropertyChanged("UseElement"); }
}
- private Code _UseElement;
+ private Code? _UseElement;
///
/// usual | official | temp | secondary | old (If known)
@@ -122,13 +125,10 @@ public Code UseElement
[IgnoreDataMember]
public Hl7.Fhir.Model.Identifier.IdentifierUse? Use
{
- get { return UseElement != null ? UseElement.Value : null; }
+ get => _UseElement?.Value;
set
{
- if (value == null)
- UseElement = null;
- else
- UseElement = new Code(value);
+ UseElement = value is null ? null : new Code(value);
OnPropertyChanged("Use");
}
}
@@ -139,41 +139,38 @@ public Hl7.Fhir.Model.Identifier.IdentifierUse? Use
[FhirElement("type", InSummary=true, Order=40)]
[Binding("IdentifierType")]
[DataMember]
- public Hl7.Fhir.Model.CodeableConcept Type
+ public Hl7.Fhir.Model.CodeableConcept? Type
{
get { return _Type; }
set { _Type = value; OnPropertyChanged("Type"); }
}
- private Hl7.Fhir.Model.CodeableConcept _Type;
+ private Hl7.Fhir.Model.CodeableConcept? _Type;
///
/// The namespace for the identifier value.
///
[FhirElement("system", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri SystemElement
+ public Hl7.Fhir.Model.FhirUri? SystemElement
{
get { return _SystemElement; }
set { _SystemElement = value; OnPropertyChanged("SystemElement"); }
}
- private Hl7.Fhir.Model.FhirUri _SystemElement;
+ private Hl7.Fhir.Model.FhirUri? _SystemElement;
///
/// The namespace for the identifier value
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string System
+ public string? System
{
- get { return SystemElement != null ? SystemElement.Value : null; }
+ get => _SystemElement?.Value;
set
{
- if (value == null)
- SystemElement = null;
- else
- SystemElement = new Hl7.Fhir.Model.FhirUri(value);
+ SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("System");
}
}
@@ -183,28 +180,25 @@ public string System
///
[FhirElement("value", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.FhirString ValueElement
+ public Hl7.Fhir.Model.FhirString? ValueElement
{
get { return _ValueElement; }
set { _ValueElement = value; OnPropertyChanged("ValueElement"); }
}
- private Hl7.Fhir.Model.FhirString _ValueElement;
+ private Hl7.Fhir.Model.FhirString? _ValueElement;
///
/// The value that is unique
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Value
+ public string? Value
{
- get { return ValueElement != null ? ValueElement.Value : null; }
+ get => _ValueElement?.Value;
set
{
- if (value == null)
- ValueElement = null;
- else
- ValueElement = new Hl7.Fhir.Model.FhirString(value);
+ ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Value");
}
}
@@ -214,13 +208,13 @@ public string Value
///
[FhirElement("period", InSummary=true, Order=70)]
[DataMember]
- public Hl7.Fhir.Model.Period Period
+ public Hl7.Fhir.Model.Period? Period
{
get { return _Period; }
set { _Period = value; OnPropertyChanged("Period"); }
}
- private Hl7.Fhir.Model.Period _Period;
+ private Hl7.Fhir.Model.Period? _Period;
///
/// Organization that issued id (may be just text).
@@ -229,30 +223,26 @@ public Hl7.Fhir.Model.Period Period
[CLSCompliant(false)]
[References("Organization")]
[DataMember]
- public Hl7.Fhir.Model.ResourceReference Assigner
+ public Hl7.Fhir.Model.ResourceReference? Assigner
{
get { return _Assigner; }
set { _Assigner = value; OnPropertyChanged("Assigner"); }
}
- private Hl7.Fhir.Model.ResourceReference _Assigner;
+ private Hl7.Fhir.Model.ResourceReference? _Assigner;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Identifier;
-
- if (dest == null)
- {
+ if(other is not Identifier dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal();
- if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal();
- if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal();
- if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal();
- if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal();
- if(Assigner != null) dest.Assigner = (Hl7.Fhir.Model.ResourceReference)Assigner.DeepCopyInternal();
+ if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal();
+ if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal();
+ if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal();
+ if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal();
+ if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal();
+ if(_Assigner is not null) dest.Assigner = (Hl7.Fhir.Model.ResourceReference)_Assigner.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -264,69 +254,70 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Identifier;
- if(otherT == null) return false;
+ if(other is not Identifier otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(UseElement, otherT.UseElement)) return false;
- if(!comparer.Equals(Type, otherT.Type)) return false;
- if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false;
- if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false;
- if(!comparer.Equals(Period, otherT.Period)) return false;
- if(!comparer.Equals(Assigner, otherT.Assigner)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_UseElement, otherT._UseElement)) return false;
+ if(!comparer.Equals(_Type, otherT._Type)) return false;
+ if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false;
+ if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false;
+ if(!comparer.Equals(_Period, otherT._Period)) return false;
+ if(!comparer.Equals(_Assigner, otherT._Assigner)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "use":
- value = UseElement;
- return UseElement is not null;
+ value = _UseElement;
+ return _UseElement is not null;
case "type":
- value = Type;
- return Type is not null;
+ value = _Type;
+ return _Type is not null;
case "system":
- value = SystemElement;
- return SystemElement is not null;
+ value = _SystemElement;
+ return _SystemElement is not null;
case "value":
- value = ValueElement;
- return ValueElement is not null;
+ value = _ValueElement;
+ return _ValueElement is not null;
case "period":
- value = Period;
- return Period is not null;
+ value = _Period;
+ return _Period is not null;
case "assigner":
- value = Assigner;
- return Assigner is not null;
+ value = _Assigner;
+ return _Assigner is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "use":
- UseElement = (Code)value;
+ UseElement = (Code?)value;
return this;
case "type":
- Type = (Hl7.Fhir.Model.CodeableConcept)value;
+ Type = (Hl7.Fhir.Model.CodeableConcept?)value;
return this;
case "system":
- SystemElement = (Hl7.Fhir.Model.FhirUri)value;
+ SystemElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "value":
- ValueElement = (Hl7.Fhir.Model.FhirString)value;
+ ValueElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "period":
- Period = (Hl7.Fhir.Model.Period)value;
+ Period = (Hl7.Fhir.Model.Period?)value;
return this;
case "assigner":
- Assigner = (Hl7.Fhir.Model.ResourceReference)value;
+ Assigner = (Hl7.Fhir.Model.ResourceReference?)value;
return this;
default:
return base.SetValue(key, value);
@@ -337,12 +328,12 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (UseElement is not null) yield return new KeyValuePair("use",UseElement);
- if (Type is not null) yield return new KeyValuePair("type",Type);
- if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement);
- if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement);
- if (Period is not null) yield return new KeyValuePair("period",Period);
- if (Assigner is not null) yield return new KeyValuePair("assigner",Assigner);
+ if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement);
+ if (_Type is not null) yield return new KeyValuePair("type",_Type);
+ if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement);
+ if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement);
+ if (_Period is not null) yield return new KeyValuePair("period",_Period);
+ if (_Assigner is not null) yield return new KeyValuePair("assigner",_Assigner);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Instant.cs b/src/Hl7.Fhir.Base/Model/Generated/Instant.cs
index 79028c84d5..b965517585 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Instant.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Instant.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Integer.cs b/src/Hl7.Fhir.Base/Model/Generated/Integer.cs
index 0de52b51b2..5321fba8f8 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Integer.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Integer.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Integer64.cs b/src/Hl7.Fhir.Base/Model/Generated/Integer64.cs
index fa06115526..c6fe05b6ea 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Integer64.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Integer64.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Markdown.cs b/src/Hl7.Fhir.Base/Model/Generated/Markdown.cs
index d795f61be4..a6f06ee179 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Markdown.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Markdown.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class Markdown : PrimitiveType, IValue
/// Must conform to the pattern "^[\s\S]+$"
public const string PATTERN = @"^[\s\S]+$";
- public Markdown(string value)
+ public Markdown(string? value)
{
Value = value;
}
- public Markdown(): this((string)null) {}
+ public Markdown(): this((string?)null) {}
///
/// Primitive value of the element
@@ -76,9 +79,9 @@ public Markdown(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[StringPattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs
index e3e628bd03..dd45403636 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -64,28 +67,25 @@ public partial class Meta : Hl7.Fhir.Model.DataType
///
[FhirElement("versionId", InSummary=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.Id VersionIdElement
+ public Hl7.Fhir.Model.Id? VersionIdElement
{
get { return _VersionIdElement; }
set { _VersionIdElement = value; OnPropertyChanged("VersionIdElement"); }
}
- private Hl7.Fhir.Model.Id _VersionIdElement;
+ private Hl7.Fhir.Model.Id? _VersionIdElement;
///
/// Version specific identifier
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string VersionId
+ public string? VersionId
{
- get { return VersionIdElement != null ? VersionIdElement.Value : null; }
+ get => _VersionIdElement?.Value;
set
{
- if (value == null)
- VersionIdElement = null;
- else
- VersionIdElement = new Hl7.Fhir.Model.Id(value);
+ VersionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value);
OnPropertyChanged("VersionId");
}
}
@@ -95,13 +95,13 @@ public string VersionId
///
[FhirElement("lastUpdated", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.Instant LastUpdatedElement
+ public Hl7.Fhir.Model.Instant? LastUpdatedElement
{
get { return _LastUpdatedElement; }
set { _LastUpdatedElement = value; OnPropertyChanged("LastUpdatedElement"); }
}
- private Hl7.Fhir.Model.Instant _LastUpdatedElement;
+ private Hl7.Fhir.Model.Instant? _LastUpdatedElement;
///
/// When the resource version last changed
@@ -110,13 +110,10 @@ public Hl7.Fhir.Model.Instant LastUpdatedElement
[IgnoreDataMember]
public DateTimeOffset? LastUpdated
{
- get { return LastUpdatedElement != null ? LastUpdatedElement.Value : null; }
+ get => _LastUpdatedElement?.Value;
set
{
- if (value == null)
- LastUpdatedElement = null;
- else
- LastUpdatedElement = new Hl7.Fhir.Model.Instant(value);
+ LastUpdatedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value);
OnPropertyChanged("LastUpdated");
}
}
@@ -129,28 +126,25 @@ public DateTimeOffset? LastUpdated
///
[FhirElement("source", InSummary=true, Order=50, Since=FhirRelease.R4)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri SourceElement
+ public Hl7.Fhir.Model.FhirUri? SourceElement
{
get { return _SourceElement; }
set { _SourceElement = value; OnPropertyChanged("SourceElement"); }
}
- private Hl7.Fhir.Model.FhirUri _SourceElement;
+ private Hl7.Fhir.Model.FhirUri? _SourceElement;
///
/// Identifies where the resource comes from
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Source
+ public string? Source
{
- get { return SourceElement != null ? SourceElement.Value : null; }
+ get => _SourceElement?.Value;
set
{
- if (value == null)
- SourceElement = null;
- else
- SourceElement = new Hl7.Fhir.Model.FhirUri(value);
+ SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("Source");
}
}
@@ -173,24 +167,24 @@ public string Source
[DataMember]
public List ProfileElement
{
- get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; }
+ get => _ProfileElement ??= [];
set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); }
}
- private List _ProfileElement;
+ private List? _ProfileElement;
///
/// Profiles this resource claims to conform to. Use this property in STU3.
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable ProfileUri
+ public IEnumerable ProfileUri
{
- get { return ProfileElement != null ? ProfileElement.Cast>().Select(elem => elem.Value) : null; }
+ get => _ProfileElement?.Cast>()?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- ProfileElement = null;
+ ProfileElement = null!;
else
ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem)));
OnPropertyChanged("ProfileUri");
@@ -202,13 +196,13 @@ public IEnumerable ProfileUri
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable Profile
+ public IEnumerable Profile
{
- get { return ProfileElement != null ? ProfileElement.Cast>().Select(elem => elem.Value) : null; }
+ get => _ProfileElement?.Cast>()?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- ProfileElement = null;
+ ProfileElement = null!;
else
ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem)));
OnPropertyChanged("Profile");
@@ -224,11 +218,11 @@ public IEnumerable Profile
[DataMember]
public List Security
{
- get { if(_Security==null) _Security = new List(); return _Security; }
+ get => _Security ??= [];
set { _Security = value; OnPropertyChanged("Security"); }
}
- private List _Security;
+ private List? _Security;
///
/// Tags applied to this resource.
@@ -239,28 +233,24 @@ public List Security
[DataMember]
public List Tag
{
- get { if(_Tag==null) _Tag = new List(); return _Tag; }
+ get => _Tag ??= [];
set { _Tag = value; OnPropertyChanged("Tag"); }
}
- private List _Tag;
+ private List? _Tag;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Meta;
-
- if (dest == null)
- {
+ if(other is not Meta dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(VersionIdElement != null) dest.VersionIdElement = (Hl7.Fhir.Model.Id)VersionIdElement.DeepCopyInternal();
- if(LastUpdatedElement != null) dest.LastUpdatedElement = (Hl7.Fhir.Model.Instant)LastUpdatedElement.DeepCopyInternal();
- if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal();
- if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal());
- if(Security.Any()) dest.Security = new List(Security.DeepCopyInternal());
- if(Tag.Any()) dest.Tag = new List(Tag.DeepCopyInternal());
+ if(_VersionIdElement is not null) dest.VersionIdElement = (Hl7.Fhir.Model.Id)_VersionIdElement.DeepCopyInternal();
+ if(_LastUpdatedElement is not null) dest.LastUpdatedElement = (Hl7.Fhir.Model.Instant)_LastUpdatedElement.DeepCopyInternal();
+ if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal();
+ if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal());
+ if(_Security is not null) dest.Security = new List(_Security.DeepCopyInternal());
+ if(_Tag is not null) dest.Tag = new List(_Tag.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -272,69 +262,70 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Meta;
- if(otherT == null) return false;
+ if(other is not Meta otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(VersionIdElement, otherT.VersionIdElement)) return false;
- if(!comparer.Equals(LastUpdatedElement, otherT.LastUpdatedElement)) return false;
- if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false;
- if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false;
- if(!comparer.ListEquals(Security, otherT.Security)) return false;
- if(!comparer.ListEquals(Tag, otherT.Tag)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false;
+ if(!comparer.Equals(_LastUpdatedElement, otherT._LastUpdatedElement)) return false;
+ if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false;
+ if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false;
+ if(!comparer.ListEquals(_Security, otherT._Security)) return false;
+ if(!comparer.ListEquals(_Tag, otherT._Tag)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "versionId":
- value = VersionIdElement;
- return VersionIdElement is not null;
+ value = _VersionIdElement;
+ return _VersionIdElement is not null;
case "lastUpdated":
- value = LastUpdatedElement;
- return LastUpdatedElement is not null;
+ value = _LastUpdatedElement;
+ return _LastUpdatedElement is not null;
case "source":
- value = SourceElement;
- return SourceElement is not null;
+ value = _SourceElement;
+ return _SourceElement is not null;
case "profile":
- value = ProfileElement;
- return ProfileElement?.Any() == true;
+ value = _ProfileElement;
+ return _ProfileElement?.Any() == true;
case "security":
- value = Security;
- return Security?.Any() == true;
+ value = _Security;
+ return _Security?.Any() == true;
case "tag":
- value = Tag;
- return Tag?.Any() == true;
+ value = _Tag;
+ return _Tag?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "versionId":
- VersionIdElement = (Hl7.Fhir.Model.Id)value;
+ VersionIdElement = (Hl7.Fhir.Model.Id?)value;
return this;
case "lastUpdated":
- LastUpdatedElement = (Hl7.Fhir.Model.Instant)value;
+ LastUpdatedElement = (Hl7.Fhir.Model.Instant?)value;
return this;
case "source":
- SourceElement = (Hl7.Fhir.Model.FhirUri)value;
+ SourceElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "profile":
- ProfileElement = (List)value;
+ ProfileElement = (List?)value!;
return this;
case "security":
- Security = (List)value;
+ Security = (List?)value!;
return this;
case "tag":
- Tag = (List)value;
+ Tag = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -345,12 +336,12 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (VersionIdElement is not null) yield return new KeyValuePair("versionId",VersionIdElement);
- if (LastUpdatedElement is not null) yield return new KeyValuePair("lastUpdated",LastUpdatedElement);
- if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement);
- if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement);
- if (Security?.Any() == true) yield return new KeyValuePair("security",Security);
- if (Tag?.Any() == true) yield return new KeyValuePair("tag",Tag);
+ if (_VersionIdElement is not null) yield return new KeyValuePair("versionId",_VersionIdElement);
+ if (_LastUpdatedElement is not null) yield return new KeyValuePair("lastUpdated",_LastUpdatedElement);
+ if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement);
+ if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement);
+ if (_Security?.Any() == true) yield return new KeyValuePair("security",_Security);
+ if (_Tag?.Any() == true) yield return new KeyValuePair("tag",_Tag);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs b/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs
index 71e0fbc1bc..7afca62de6 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -101,13 +104,13 @@ public enum NarrativeStatus
[Binding("NarrativeStatus")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code StatusElement
+ public Code? StatusElement
{
get { return _StatusElement; }
set { _StatusElement = value; OnPropertyChanged("StatusElement"); }
}
- private Code _StatusElement;
+ private Code? _StatusElement;
///
/// generated | extensions | additional | empty
@@ -116,13 +119,10 @@ public Code StatusElement
[IgnoreDataMember]
public Hl7.Fhir.Model.Narrative.NarrativeStatus? Status
{
- get { return StatusElement != null ? StatusElement.Value : null; }
+ get => _StatusElement?.Value;
set
{
- if (value == null)
- StatusElement = null;
- else
- StatusElement = new Code(value);
+ StatusElement = value is null ? null : new Code(value);
OnPropertyChanged("Status");
}
}
@@ -133,44 +133,37 @@ public Hl7.Fhir.Model.Narrative.NarrativeStatus? Status
[FhirElement("div", XmlSerialization = XmlRepresentation.XHtml, Order=40)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.XHtml DivElement
+ public Hl7.Fhir.Model.XHtml? DivElement
{
get { return _DivElement; }
set { _DivElement = value; OnPropertyChanged("DivElement"); }
}
- private Hl7.Fhir.Model.XHtml _DivElement;
+ private Hl7.Fhir.Model.XHtml? _DivElement;
///
/// Limited xhtml content
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Div
+ public string? Div
{
- get { return DivElement != null ? DivElement.Value : null; }
+ get => _DivElement?.Value;
set
{
- if (value == null)
- DivElement = null;
- else
- DivElement = new Hl7.Fhir.Model.XHtml(value);
+ DivElement = value is null ? null : new Hl7.Fhir.Model.XHtml(value);
OnPropertyChanged("Div");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Narrative;
-
- if (dest == null)
- {
+ if(other is not Narrative dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal();
- if(DivElement != null) dest.DivElement = (Hl7.Fhir.Model.XHtml)DivElement.DeepCopyInternal();
+ if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal();
+ if(_DivElement is not null) dest.DivElement = (Hl7.Fhir.Model.XHtml)_DivElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -182,41 +175,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Narrative;
- if(otherT == null) return false;
+ if(other is not Narrative otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false;
- if(!comparer.Equals(DivElement, otherT.DivElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false;
+ if(!comparer.Equals(_DivElement, otherT._DivElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "status":
- value = StatusElement;
- return StatusElement is not null;
+ value = _StatusElement;
+ return _StatusElement is not null;
case "div":
- value = DivElement;
- return DivElement is not null;
+ value = _DivElement;
+ return _DivElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "status":
- StatusElement = (Code)value;
+ StatusElement = (Code?)value;
return this;
case "div":
- DivElement = (Hl7.Fhir.Model.XHtml)value;
+ DivElement = (Hl7.Fhir.Model.XHtml?)value;
return this;
default:
return base.SetValue(key, value);
@@ -227,8 +221,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement);
- if (DivElement is not null) yield return new KeyValuePair("div",DivElement);
+ if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement);
+ if (_DivElement is not null) yield return new KeyValuePair("div",_DivElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Oid.cs b/src/Hl7.Fhir.Base/Model/Generated/Oid.cs
index 70f7baf49b..6aa8f1862d 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Oid.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Oid.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class Oid : PrimitiveType, IValue
/// Must conform to the pattern "urn:oid:[0-2](\.(0|[1-9][0-9]*))+"
public const string PATTERN = @"urn:oid:[0-2](\.(0|[1-9][0-9]*))+";
- public Oid(string value)
+ public Oid(string? value)
{
Value = value;
}
- public Oid(): this((string)null) {}
+ public Oid(): this((string?)null) {}
///
/// Primitive value of the element
@@ -76,9 +79,9 @@ public Oid(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[OidPattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs
index 41e8a59a5a..e8d39db076 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -333,13 +336,13 @@ public partial class IssueComponent : Hl7.Fhir.Model.BackboneElement
[Binding("IssueSeverity")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code SeverityElement
+ public Code? SeverityElement
{
get { return _SeverityElement; }
set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); }
}
- private Code _SeverityElement;
+ private Code? _SeverityElement;
///
/// fatal | error | warning | information | success
@@ -348,13 +351,10 @@ public Code SeverityElement
[IgnoreDataMember]
public Hl7.Fhir.Model.OperationOutcome.IssueSeverity? Severity
{
- get { return SeverityElement != null ? SeverityElement.Value : null; }
+ get => _SeverityElement?.Value;
set
{
- if (value == null)
- SeverityElement = null;
- else
- SeverityElement = new Code(value);
+ SeverityElement = value is null ? null : new Code(value);
OnPropertyChanged("Severity");
}
}
@@ -367,13 +367,13 @@ public Hl7.Fhir.Model.OperationOutcome.IssueSeverity? Severity
[Binding("IssueType")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code CodeElement
+ public Code? CodeElement
{
get { return _CodeElement; }
set { _CodeElement = value; OnPropertyChanged("CodeElement"); }
}
- private Code _CodeElement;
+ private Code? _CodeElement;
///
/// Error or warning code
@@ -382,13 +382,10 @@ public Code CodeElement
[IgnoreDataMember]
public Hl7.Fhir.Model.OperationOutcome.IssueType? Code
{
- get { return CodeElement != null ? CodeElement.Value : null; }
+ get => _CodeElement?.Value;
set
{
- if (value == null)
- CodeElement = null;
- else
- CodeElement = new Code(value);
+ CodeElement = value is null ? null : new Code(value);
OnPropertyChanged("Code");
}
}
@@ -399,41 +396,38 @@ public Hl7.Fhir.Model.OperationOutcome.IssueType? Code
[FhirElement("details", InSummary=true, Order=60)]
[Binding("IssueDetails")]
[DataMember]
- public Hl7.Fhir.Model.CodeableConcept Details
+ public Hl7.Fhir.Model.CodeableConcept? Details
{
get { return _Details; }
set { _Details = value; OnPropertyChanged("Details"); }
}
- private Hl7.Fhir.Model.CodeableConcept _Details;
+ private Hl7.Fhir.Model.CodeableConcept? _Details;
///
/// Additional diagnostic information about the issue.
///
[FhirElement("diagnostics", InSummary=true, Order=70)]
[DataMember]
- public Hl7.Fhir.Model.FhirString DiagnosticsElement
+ public Hl7.Fhir.Model.FhirString? DiagnosticsElement
{
get { return _DiagnosticsElement; }
set { _DiagnosticsElement = value; OnPropertyChanged("DiagnosticsElement"); }
}
- private Hl7.Fhir.Model.FhirString _DiagnosticsElement;
+ private Hl7.Fhir.Model.FhirString? _DiagnosticsElement;
///
/// Additional diagnostic information about the issue
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Diagnostics
+ public string? Diagnostics
{
- get { return DiagnosticsElement != null ? DiagnosticsElement.Value : null; }
+ get => _DiagnosticsElement?.Value;
set
{
- if (value == null)
- DiagnosticsElement = null;
- else
- DiagnosticsElement = new Hl7.Fhir.Model.FhirString(value);
+ DiagnosticsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Diagnostics");
}
}
@@ -446,24 +440,24 @@ public string Diagnostics
[DataMember]
public List LocationElement
{
- get { if(_LocationElement==null) _LocationElement = new List(); return _LocationElement; }
+ get => _LocationElement ??= [];
set { _LocationElement = value; OnPropertyChanged("LocationElement"); }
}
- private List _LocationElement;
+ private List? _LocationElement;
///
/// Deprecated: Path of element(s) related to issue
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable Location
+ public IEnumerable Location
{
- get { return LocationElement != null ? LocationElement.Select(elem => elem.Value) : null; }
+ get => _LocationElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- LocationElement = null;
+ LocationElement = null!;
else
LocationElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem)));
OnPropertyChanged("Location");
@@ -478,24 +472,24 @@ public IEnumerable Location
[DataMember]
public List ExpressionElement
{
- get { if(_ExpressionElement==null) _ExpressionElement = new List(); return _ExpressionElement; }
+ get => _ExpressionElement ??= [];
set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); }
}
- private List _ExpressionElement;
+ private List? _ExpressionElement;
///
/// FHIRPath of element(s) related to issue
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable Expression
+ public IEnumerable Expression
{
- get { return ExpressionElement != null ? ExpressionElement.Select(elem => elem.Value) : null; }
+ get => _ExpressionElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- ExpressionElement = null;
+ ExpressionElement = null!;
else
ExpressionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem)));
OnPropertyChanged("Expression");
@@ -504,20 +498,16 @@ public IEnumerable Expression
protected internal override void CopyToInternal(Base other)
{
- var dest = other as IssueComponent;
-
- if (dest == null)
- {
+ if(other is not IssueComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal();
- if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal();
- if(Details != null) dest.Details = (Hl7.Fhir.Model.CodeableConcept)Details.DeepCopyInternal();
- if(DiagnosticsElement != null) dest.DiagnosticsElement = (Hl7.Fhir.Model.FhirString)DiagnosticsElement.DeepCopyInternal();
- if(LocationElement.Any()) dest.LocationElement = new List(LocationElement.DeepCopyInternal());
- if(ExpressionElement.Any()) dest.ExpressionElement = new List(ExpressionElement.DeepCopyInternal());
+ if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal();
+ if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal();
+ if(_Details is not null) dest.Details = (Hl7.Fhir.Model.CodeableConcept)_Details.DeepCopyInternal();
+ if(_DiagnosticsElement is not null) dest.DiagnosticsElement = (Hl7.Fhir.Model.FhirString)_DiagnosticsElement.DeepCopyInternal();
+ if(_LocationElement is not null) dest.LocationElement = new List(_LocationElement.DeepCopyInternal());
+ if(_ExpressionElement is not null) dest.ExpressionElement = new List(_ExpressionElement.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -529,69 +519,70 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as IssueComponent;
- if(otherT == null) return false;
+ if(other is not IssueComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false;
- if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false;
- if(!comparer.Equals(Details, otherT.Details)) return false;
- if(!comparer.Equals(DiagnosticsElement, otherT.DiagnosticsElement)) return false;
- if(!comparer.ListEquals(LocationElement, otherT.LocationElement)) return false;
- if(!comparer.ListEquals(ExpressionElement, otherT.ExpressionElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false;
+ if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false;
+ if(!comparer.Equals(_Details, otherT._Details)) return false;
+ if(!comparer.Equals(_DiagnosticsElement, otherT._DiagnosticsElement)) return false;
+ if(!comparer.ListEquals(_LocationElement, otherT._LocationElement)) return false;
+ if(!comparer.ListEquals(_ExpressionElement, otherT._ExpressionElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "severity":
- value = SeverityElement;
- return SeverityElement is not null;
+ value = _SeverityElement;
+ return _SeverityElement is not null;
case "code":
- value = CodeElement;
- return CodeElement is not null;
+ value = _CodeElement;
+ return _CodeElement is not null;
case "details":
- value = Details;
- return Details is not null;
+ value = _Details;
+ return _Details is not null;
case "diagnostics":
- value = DiagnosticsElement;
- return DiagnosticsElement is not null;
+ value = _DiagnosticsElement;
+ return _DiagnosticsElement is not null;
case "location":
- value = LocationElement;
- return LocationElement?.Any() == true;
+ value = _LocationElement;
+ return _LocationElement?.Any() == true;
case "expression":
- value = ExpressionElement;
- return ExpressionElement?.Any() == true;
+ value = _ExpressionElement;
+ return _ExpressionElement?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "severity":
- SeverityElement = (Code)value;
+ SeverityElement = (Code?)value;
return this;
case "code":
- CodeElement = (Code)value;
+ CodeElement = (Code?)value;
return this;
case "details":
- Details = (Hl7.Fhir.Model.CodeableConcept)value;
+ Details = (Hl7.Fhir.Model.CodeableConcept?)value;
return this;
case "diagnostics":
- DiagnosticsElement = (Hl7.Fhir.Model.FhirString)value;
+ DiagnosticsElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "location":
- LocationElement = (List)value;
+ LocationElement = (List?)value!;
return this;
case "expression":
- ExpressionElement = (List)value;
+ ExpressionElement = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -602,12 +593,12 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement);
- if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement);
- if (Details is not null) yield return new KeyValuePair("details",Details);
- if (DiagnosticsElement is not null) yield return new KeyValuePair("diagnostics",DiagnosticsElement);
- if (LocationElement?.Any() == true) yield return new KeyValuePair("location",LocationElement);
- if (ExpressionElement?.Any() == true) yield return new KeyValuePair("expression",ExpressionElement);
+ if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement);
+ if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement);
+ if (_Details is not null) yield return new KeyValuePair("details",_Details);
+ if (_DiagnosticsElement is not null) yield return new KeyValuePair("diagnostics",_DiagnosticsElement);
+ if (_LocationElement?.Any() == true) yield return new KeyValuePair("location",_LocationElement);
+ if (_ExpressionElement?.Any() == true) yield return new KeyValuePair("expression",_ExpressionElement);
}
}
@@ -620,23 +611,19 @@ public override IEnumerable> EnumerateElements()
[DataMember]
public List Issue
{
- get { if(_Issue==null) _Issue = new List(); return _Issue; }
+ get => _Issue ??= [];
set { _Issue = value; OnPropertyChanged("Issue"); }
}
- private List _Issue;
+ private List? _Issue;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as OperationOutcome;
-
- if (dest == null)
- {
+ if(other is not OperationOutcome dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Issue.Any()) dest.Issue = new List(Issue.DeepCopyInternal());
+ if(_Issue is not null) dest.Issue = new List(_Issue.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -648,34 +635,35 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as OperationOutcome;
- if(otherT == null) return false;
+ if(other is not OperationOutcome otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.ListEquals(Issue, otherT.Issue)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.ListEquals(_Issue, otherT._Issue)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "issue":
- value = Issue;
- return Issue?.Any() == true;
+ value = _Issue;
+ return _Issue?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "issue":
- Issue = (List)value;
+ Issue = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -686,7 +674,7 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Issue?.Any() == true) yield return new KeyValuePair("issue",Issue);
+ if (_Issue?.Any() == true) yield return new KeyValuePair("issue",_Issue);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs
index 414d6b4a36..3a07dd6da6 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -82,28 +85,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement
[FhirElement("name", InSummary=true, Order=40)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirString NameElement
+ public Hl7.Fhir.Model.FhirString? NameElement
{
get { return _NameElement; }
set { _NameElement = value; OnPropertyChanged("NameElement"); }
}
- private Hl7.Fhir.Model.FhirString _NameElement;
+ private Hl7.Fhir.Model.FhirString? _NameElement;
///
/// Name from the definition
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Name
+ public string? Name
{
- get { return NameElement != null ? NameElement.Value : null; }
+ get => _NameElement?.Value;
set
{
- if (value == null)
- NameElement = null;
- else
- NameElement = new Hl7.Fhir.Model.FhirString(value);
+ NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Name");
}
}
@@ -113,13 +113,13 @@ public string Name
///
[FhirElement("value", InSummary=true, Order=50, Choice=ChoiceType.DatatypeChoice)]
[DataMember]
- public Hl7.Fhir.Model.DataType Value
+ public Hl7.Fhir.Model.DataType? Value
{
get { return _Value; }
set { _Value = value; OnPropertyChanged("Value"); }
}
- private Hl7.Fhir.Model.DataType _Value;
+ private Hl7.Fhir.Model.DataType? _Value;
///
/// If parameter is a whole resource.
@@ -128,13 +128,13 @@ public Hl7.Fhir.Model.DataType Value
[CLSCompliant(false)]
[AllowedTypes(typeof(Hl7.Fhir.Model.Resource))]
[DataMember]
- public Hl7.Fhir.Model.Resource Resource
+ public Hl7.Fhir.Model.Resource? Resource
{
get { return _Resource; }
set { _Resource = value; OnPropertyChanged("Resource"); }
}
- private Hl7.Fhir.Model.Resource _Resource;
+ private Hl7.Fhir.Model.Resource? _Resource;
///
/// Named part of a multi-part parameter.
@@ -144,26 +144,22 @@ public Hl7.Fhir.Model.Resource Resource
[DataMember]
public List Part
{
- get { if(_Part==null) _Part = new List(); return _Part; }
+ get => _Part ??= [];
set { _Part = value; OnPropertyChanged("Part"); }
}
- private List _Part;
+ private List? _Part;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as ParameterComponent;
-
- if (dest == null)
- {
+ if(other is not ParameterComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal();
- if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal();
- if(Resource != null) dest.Resource = (Hl7.Fhir.Model.Resource)Resource.DeepCopyInternal();
- if(Part.Any()) dest.Part = new List(Part.DeepCopyInternal());
+ if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal();
+ if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal();
+ if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.Resource)_Resource.DeepCopyInternal();
+ if(_Part is not null) dest.Part = new List(_Part.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -175,55 +171,56 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as ParameterComponent;
- if(otherT == null) return false;
+ if(other is not ParameterComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(NameElement, otherT.NameElement)) return false;
- if(!comparer.Equals(Value, otherT.Value)) return false;
- if(!comparer.Equals(Resource, otherT.Resource)) return false;
- if(!comparer.ListEquals(Part, otherT.Part)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_NameElement, otherT._NameElement)) return false;
+ if(!comparer.Equals(_Value, otherT._Value)) return false;
+ if(!comparer.Equals(_Resource, otherT._Resource)) return false;
+ if(!comparer.ListEquals(_Part, otherT._Part)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "name":
- value = NameElement;
- return NameElement is not null;
+ value = _NameElement;
+ return _NameElement is not null;
case "value":
- value = Value;
- return Value is not null;
+ value = _Value;
+ return _Value is not null;
case "resource":
- value = Resource;
- return Resource is not null;
+ value = _Resource;
+ return _Resource is not null;
case "part":
- value = Part;
- return Part?.Any() == true;
+ value = _Part;
+ return _Part?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "name":
- NameElement = (Hl7.Fhir.Model.FhirString)value;
+ NameElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "value":
- Value = (Hl7.Fhir.Model.DataType)value;
+ Value = (Hl7.Fhir.Model.DataType?)value;
return this;
case "resource":
- Resource = (Hl7.Fhir.Model.Resource)value;
+ Resource = (Hl7.Fhir.Model.Resource?)value;
return this;
case "part":
- Part = (List)value;
+ Part = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -234,10 +231,10 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (NameElement is not null) yield return new KeyValuePair("name",NameElement);
- if (Value is not null) yield return new KeyValuePair("value",Value);
- if (Resource is not null) yield return new KeyValuePair("resource",Resource);
- if (Part?.Any() == true) yield return new KeyValuePair("part",Part);
+ if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement);
+ if (_Value is not null) yield return new KeyValuePair("value",_Value);
+ if (_Resource is not null) yield return new KeyValuePair("resource",_Resource);
+ if (_Part?.Any() == true) yield return new KeyValuePair("part",_Part);
}
}
@@ -250,23 +247,19 @@ public override IEnumerable> EnumerateElements()
[DataMember]
public List Parameter
{
- get { if(_Parameter==null) _Parameter = new List(); return _Parameter; }
+ get => _Parameter ??= [];
set { _Parameter = value; OnPropertyChanged("Parameter"); }
}
- private List _Parameter;
+ private List? _Parameter;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Parameters;
-
- if (dest == null)
- {
+ if(other is not Parameters dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal());
+ if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -278,34 +271,35 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Parameters;
- if(otherT == null) return false;
+ if(other is not Parameters otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "parameter":
- value = Parameter;
- return Parameter?.Any() == true;
+ value = _Parameter;
+ return _Parameter?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "parameter":
- Parameter = (List)value;
+ Parameter = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -316,7 +310,7 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter);
+ if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Period.cs b/src/Hl7.Fhir.Base/Model/Generated/Period.cs
index 78663099fa..4ad3061204 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Period.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Period.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -66,28 +69,25 @@ public partial class Period : Hl7.Fhir.Model.DataType
///
[FhirElement("start", InSummary=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.FhirDateTime StartElement
+ public Hl7.Fhir.Model.FhirDateTime? StartElement
{
get { return _StartElement; }
set { _StartElement = value; OnPropertyChanged("StartElement"); }
}
- private Hl7.Fhir.Model.FhirDateTime _StartElement;
+ private Hl7.Fhir.Model.FhirDateTime? _StartElement;
///
/// Starting time with inclusive boundary
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Start
+ public string? Start
{
- get { return StartElement != null ? StartElement.Value : null; }
+ get => _StartElement?.Value;
set
{
- if (value == null)
- StartElement = null;
- else
- StartElement = new Hl7.Fhir.Model.FhirDateTime(value);
+ StartElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value);
OnPropertyChanged("Start");
}
}
@@ -97,44 +97,37 @@ public string Start
///
[FhirElement("end", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.FhirDateTime EndElement
+ public Hl7.Fhir.Model.FhirDateTime? EndElement
{
get { return _EndElement; }
set { _EndElement = value; OnPropertyChanged("EndElement"); }
}
- private Hl7.Fhir.Model.FhirDateTime _EndElement;
+ private Hl7.Fhir.Model.FhirDateTime? _EndElement;
///
/// End time with inclusive boundary, if not ongoing
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string End
+ public string? End
{
- get { return EndElement != null ? EndElement.Value : null; }
+ get => _EndElement?.Value;
set
{
- if (value == null)
- EndElement = null;
- else
- EndElement = new Hl7.Fhir.Model.FhirDateTime(value);
+ EndElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value);
OnPropertyChanged("End");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Period;
-
- if (dest == null)
- {
+ if(other is not Period dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.FhirDateTime)StartElement.DeepCopyInternal();
- if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.FhirDateTime)EndElement.DeepCopyInternal();
+ if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.FhirDateTime)_StartElement.DeepCopyInternal();
+ if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.FhirDateTime)_EndElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -146,41 +139,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Period;
- if(otherT == null) return false;
+ if(other is not Period otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(StartElement, otherT.StartElement)) return false;
- if(!comparer.Equals(EndElement, otherT.EndElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_StartElement, otherT._StartElement)) return false;
+ if(!comparer.Equals(_EndElement, otherT._EndElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "start":
- value = StartElement;
- return StartElement is not null;
+ value = _StartElement;
+ return _StartElement is not null;
case "end":
- value = EndElement;
- return EndElement is not null;
+ value = _EndElement;
+ return _EndElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "start":
- StartElement = (Hl7.Fhir.Model.FhirDateTime)value;
+ StartElement = (Hl7.Fhir.Model.FhirDateTime?)value;
return this;
case "end":
- EndElement = (Hl7.Fhir.Model.FhirDateTime)value;
+ EndElement = (Hl7.Fhir.Model.FhirDateTime?)value;
return this;
default:
return base.SetValue(key, value);
@@ -191,8 +185,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (StartElement is not null) yield return new KeyValuePair("start",StartElement);
- if (EndElement is not null) yield return new KeyValuePair("end",EndElement);
+ if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement);
+ if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/PositiveInt.cs b/src/Hl7.Fhir.Base/Model/Generated/PositiveInt.cs
index 66bb2846e8..6df68dac6c 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/PositiveInt.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/PositiveInt.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
diff --git a/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs b/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs
index 402e4ec8e4..e4169ed41e 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -56,12 +59,8 @@ public abstract partial class PrimitiveType : Hl7.Fhir.Model.DataType
{
protected internal override void CopyToInternal(Base other)
{
- var dest = other as PrimitiveType;
-
- if (dest == null)
- {
+ if(other is not PrimitiveType dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
if (ObjectValue != null) dest.ObjectValue = ObjectValue;
@@ -69,10 +68,11 @@ protected internal override void CopyToInternal(Base other)
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as PrimitiveType;
- if(otherT == null) return false;
+ if(other is not PrimitiveType otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ #pragma warning restore CS8604 // Possible null reference argument.
return Equals(ObjectValue, otherT.ObjectValue);
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs b/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs
index 32a139214f..977b7121c9 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -105,13 +108,13 @@ public enum QuantityComparator
///
[FhirElement("value", InSummary=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.FhirDecimal ValueElement
+ public Hl7.Fhir.Model.FhirDecimal? ValueElement
{
get { return _ValueElement; }
set { _ValueElement = value; OnPropertyChanged("ValueElement"); }
}
- private Hl7.Fhir.Model.FhirDecimal _ValueElement;
+ private Hl7.Fhir.Model.FhirDecimal? _ValueElement;
///
/// Numerical value (with implicit precision)
@@ -120,13 +123,10 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement
[IgnoreDataMember]
public decimal? Value
{
- get { return ValueElement != null ? ValueElement.Value : null; }
+ get => _ValueElement?.Value;
set
{
- if (value == null)
- ValueElement = null;
- else
- ValueElement = new Hl7.Fhir.Model.FhirDecimal(value);
+ ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value);
OnPropertyChanged("Value");
}
}
@@ -138,13 +138,13 @@ public decimal? Value
[DeclaredType(Type = typeof(Code))]
[Binding("QuantityComparator")]
[DataMember]
- public Code ComparatorElement
+ public Code? ComparatorElement
{
get { return _ComparatorElement; }
set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); }
}
- private Code _ComparatorElement;
+ private Code? _ComparatorElement;
///
/// < | <= | >= | > | ad - how to understand the value
@@ -153,13 +153,10 @@ public Code ComparatorElement
[IgnoreDataMember]
public Hl7.Fhir.Model.Quantity.QuantityComparator? Comparator
{
- get { return ComparatorElement != null ? ComparatorElement.Value : null; }
+ get => _ComparatorElement?.Value;
set
{
- if (value == null)
- ComparatorElement = null;
- else
- ComparatorElement = new Code(value);
+ ComparatorElement = value is null ? null : new Code(value);
OnPropertyChanged("Comparator");
}
}
@@ -169,28 +166,25 @@ public Hl7.Fhir.Model.Quantity.QuantityComparator? Comparator
///
[FhirElement("unit", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.FhirString UnitElement
+ public Hl7.Fhir.Model.FhirString? UnitElement
{
get { return _UnitElement; }
set { _UnitElement = value; OnPropertyChanged("UnitElement"); }
}
- private Hl7.Fhir.Model.FhirString _UnitElement;
+ private Hl7.Fhir.Model.FhirString? _UnitElement;
///
/// Unit representation
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Unit
+ public string? Unit
{
- get { return UnitElement != null ? UnitElement.Value : null; }
+ get => _UnitElement?.Value;
set
{
- if (value == null)
- UnitElement = null;
- else
- UnitElement = new Hl7.Fhir.Model.FhirString(value);
+ UnitElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Unit");
}
}
@@ -200,28 +194,25 @@ public string Unit
///
[FhirElement("system", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri SystemElement
+ public Hl7.Fhir.Model.FhirUri? SystemElement
{
get { return _SystemElement; }
set { _SystemElement = value; OnPropertyChanged("SystemElement"); }
}
- private Hl7.Fhir.Model.FhirUri _SystemElement;
+ private Hl7.Fhir.Model.FhirUri? _SystemElement;
///
/// System that defines coded unit form
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string System
+ public string? System
{
- get { return SystemElement != null ? SystemElement.Value : null; }
+ get => _SystemElement?.Value;
set
{
- if (value == null)
- SystemElement = null;
- else
- SystemElement = new Hl7.Fhir.Model.FhirUri(value);
+ SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("System");
}
}
@@ -231,47 +222,40 @@ public string System
///
[FhirElement("code", InSummary=true, Order=70)]
[DataMember]
- public Hl7.Fhir.Model.Code CodeElement
+ public Hl7.Fhir.Model.Code? CodeElement
{
get { return _CodeElement; }
set { _CodeElement = value; OnPropertyChanged("CodeElement"); }
}
- private Hl7.Fhir.Model.Code _CodeElement;
+ private Hl7.Fhir.Model.Code? _CodeElement;
///
/// Coded form of the unit
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Code
+ public string? Code
{
- get { return CodeElement != null ? CodeElement.Value : null; }
+ get => _CodeElement?.Value;
set
{
- if (value == null)
- CodeElement = null;
- else
- CodeElement = new Hl7.Fhir.Model.Code(value);
+ CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("Code");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Quantity;
-
- if (dest == null)
- {
+ if(other is not Quantity dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal();
- if(ComparatorElement != null) dest.ComparatorElement = (Code)ComparatorElement.DeepCopyInternal();
- if(UnitElement != null) dest.UnitElement = (Hl7.Fhir.Model.FhirString)UnitElement.DeepCopyInternal();
- if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal();
- if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal();
+ if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal();
+ if(_ComparatorElement is not null) dest.ComparatorElement = (Code)_ComparatorElement.DeepCopyInternal();
+ if(_UnitElement is not null) dest.UnitElement = (Hl7.Fhir.Model.FhirString)_UnitElement.DeepCopyInternal();
+ if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal();
+ if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -283,62 +267,63 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Quantity;
- if(otherT == null) return false;
+ if(other is not Quantity otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false;
- if(!comparer.Equals(ComparatorElement, otherT.ComparatorElement)) return false;
- if(!comparer.Equals(UnitElement, otherT.UnitElement)) return false;
- if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false;
- if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false;
+ if(!comparer.Equals(_ComparatorElement, otherT._ComparatorElement)) return false;
+ if(!comparer.Equals(_UnitElement, otherT._UnitElement)) return false;
+ if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false;
+ if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "value":
- value = ValueElement;
- return ValueElement is not null;
+ value = _ValueElement;
+ return _ValueElement is not null;
case "comparator":
- value = ComparatorElement;
- return ComparatorElement is not null;
+ value = _ComparatorElement;
+ return _ComparatorElement is not null;
case "unit":
- value = UnitElement;
- return UnitElement is not null;
+ value = _UnitElement;
+ return _UnitElement is not null;
case "system":
- value = SystemElement;
- return SystemElement is not null;
+ value = _SystemElement;
+ return _SystemElement is not null;
case "code":
- value = CodeElement;
- return CodeElement is not null;
+ value = _CodeElement;
+ return _CodeElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "value":
- ValueElement = (Hl7.Fhir.Model.FhirDecimal)value;
+ ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value;
return this;
case "comparator":
- ComparatorElement = (Code)value;
+ ComparatorElement = (Code?)value;
return this;
case "unit":
- UnitElement = (Hl7.Fhir.Model.FhirString)value;
+ UnitElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "system":
- SystemElement = (Hl7.Fhir.Model.FhirUri)value;
+ SystemElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "code":
- CodeElement = (Hl7.Fhir.Model.Code)value;
+ CodeElement = (Hl7.Fhir.Model.Code?)value;
return this;
default:
return base.SetValue(key, value);
@@ -349,11 +334,11 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement);
- if (ComparatorElement is not null) yield return new KeyValuePair("comparator",ComparatorElement);
- if (UnitElement is not null) yield return new KeyValuePair("unit",UnitElement);
- if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement);
- if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement);
+ if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement);
+ if (_ComparatorElement is not null) yield return new KeyValuePair("comparator",_ComparatorElement);
+ if (_UnitElement is not null) yield return new KeyValuePair("unit",_UnitElement);
+ if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement);
+ if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Range.cs b/src/Hl7.Fhir.Base/Model/Generated/Range.cs
index 4fa7f408f7..5d3f256c75 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Range.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Range.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -65,39 +68,35 @@ public partial class Range : Hl7.Fhir.Model.DataType
///
[FhirElement("low", InSummary=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.Quantity Low
+ public Hl7.Fhir.Model.Quantity? Low
{
get { return _Low; }
set { _Low = value; OnPropertyChanged("Low"); }
}
- private Hl7.Fhir.Model.Quantity _Low;
+ private Hl7.Fhir.Model.Quantity? _Low;
///
/// High limit.
///
[FhirElement("high", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.Quantity High
+ public Hl7.Fhir.Model.Quantity? High
{
get { return _High; }
set { _High = value; OnPropertyChanged("High"); }
}
- private Hl7.Fhir.Model.Quantity _High;
+ private Hl7.Fhir.Model.Quantity? _High;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Range;
-
- if (dest == null)
- {
+ if(other is not Range dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Low != null) dest.Low = (Hl7.Fhir.Model.Quantity)Low.DeepCopyInternal();
- if(High != null) dest.High = (Hl7.Fhir.Model.Quantity)High.DeepCopyInternal();
+ if(_Low is not null) dest.Low = (Hl7.Fhir.Model.Quantity)_Low.DeepCopyInternal();
+ if(_High is not null) dest.High = (Hl7.Fhir.Model.Quantity)_High.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -109,41 +108,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Range;
- if(otherT == null) return false;
+ if(other is not Range otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(Low, otherT.Low)) return false;
- if(!comparer.Equals(High, otherT.High)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_Low, otherT._Low)) return false;
+ if(!comparer.Equals(_High, otherT._High)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "low":
- value = Low;
- return Low is not null;
+ value = _Low;
+ return _Low is not null;
case "high":
- value = High;
- return High is not null;
+ value = _High;
+ return _High is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "low":
- Low = (Hl7.Fhir.Model.Quantity)value;
+ Low = (Hl7.Fhir.Model.Quantity?)value;
return this;
case "high":
- High = (Hl7.Fhir.Model.Quantity)value;
+ High = (Hl7.Fhir.Model.Quantity?)value;
return this;
default:
return base.SetValue(key, value);
@@ -154,8 +154,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Low is not null) yield return new KeyValuePair("low",Low);
- if (High is not null) yield return new KeyValuePair("high",High);
+ if (_Low is not null) yield return new KeyValuePair("low",_Low);
+ if (_High is not null) yield return new KeyValuePair("high",_High);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Resource.cs b/src/Hl7.Fhir.Base/Model/Generated/Resource.cs
index f2bb8c35f4..ef73884a23 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Resource.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Resource.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -59,28 +62,25 @@ public abstract partial class Resource : Hl7.Fhir.Model.Base
///
[FhirElement("id", InSummary=true, Order=10)]
[DataMember]
- public Hl7.Fhir.Model.Id IdElement
+ public Hl7.Fhir.Model.Id? IdElement
{
get { return _IdElement; }
set { _IdElement = value; OnPropertyChanged("IdElement"); }
}
- private Hl7.Fhir.Model.Id _IdElement;
+ private Hl7.Fhir.Model.Id? _IdElement;
///
/// Logical id of this artifact
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Id
+ public string? Id
{
- get { return IdElement != null ? IdElement.Value : null; }
+ get => _IdElement?.Value;
set
{
- if (value == null)
- IdElement = null;
- else
- IdElement = new Hl7.Fhir.Model.Id(value);
+ IdElement = value is null ? null : new Hl7.Fhir.Model.Id(value);
OnPropertyChanged("Id");
}
}
@@ -90,41 +90,38 @@ public string Id
///
[FhirElement("meta", InSummary=true, Order=20)]
[DataMember]
- public Hl7.Fhir.Model.Meta Meta
+ public Hl7.Fhir.Model.Meta? Meta
{
get { return _Meta; }
set { _Meta = value; OnPropertyChanged("Meta"); }
}
- private Hl7.Fhir.Model.Meta _Meta;
+ private Hl7.Fhir.Model.Meta? _Meta;
///
/// A set of rules under which this content was created.
///
[FhirElement("implicitRules", InSummary=true, IsModifier=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.FhirUri ImplicitRulesElement
+ public Hl7.Fhir.Model.FhirUri? ImplicitRulesElement
{
get { return _ImplicitRulesElement; }
set { _ImplicitRulesElement = value; OnPropertyChanged("ImplicitRulesElement"); }
}
- private Hl7.Fhir.Model.FhirUri _ImplicitRulesElement;
+ private Hl7.Fhir.Model.FhirUri? _ImplicitRulesElement;
///
/// A set of rules under which this content was created
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string ImplicitRules
+ public string? ImplicitRules
{
- get { return ImplicitRulesElement != null ? ImplicitRulesElement.Value : null; }
+ get => _ImplicitRulesElement?.Value;
set
{
- if (value == null)
- ImplicitRulesElement = null;
- else
- ImplicitRulesElement = new Hl7.Fhir.Model.FhirUri(value);
+ ImplicitRulesElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("ImplicitRules");
}
}
@@ -135,99 +132,93 @@ public string ImplicitRules
[FhirElement("language", Order=40)]
[Binding("Language")]
[DataMember]
- public Hl7.Fhir.Model.Code LanguageElement
+ public Hl7.Fhir.Model.Code? LanguageElement
{
get { return _LanguageElement; }
set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); }
}
- private Hl7.Fhir.Model.Code _LanguageElement;
+ private Hl7.Fhir.Model.Code? _LanguageElement;
///
/// Language of the resource content
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Language
+ public string? Language
{
- get { return LanguageElement != null ? LanguageElement.Value : null; }
+ get => _LanguageElement?.Value;
set
{
- if (value == null)
- LanguageElement = null;
- else
- LanguageElement = new Hl7.Fhir.Model.Code(value);
+ LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("Language");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Resource;
-
- if (dest == null)
- {
+ if(other is not Resource dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(IdElement != null) dest.IdElement = (Hl7.Fhir.Model.Id)IdElement.DeepCopyInternal();
- if(Meta != null) dest.Meta = (Hl7.Fhir.Model.Meta)Meta.DeepCopyInternal();
- if(ImplicitRulesElement != null) dest.ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri)ImplicitRulesElement.DeepCopyInternal();
- if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal();
+ if(_IdElement is not null) dest.IdElement = (Hl7.Fhir.Model.Id)_IdElement.DeepCopyInternal();
+ if(_Meta is not null) dest.Meta = (Hl7.Fhir.Model.Meta)_Meta.DeepCopyInternal();
+ if(_ImplicitRulesElement is not null) dest.ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri)_ImplicitRulesElement.DeepCopyInternal();
+ if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal();
}
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Resource;
- if(otherT == null) return false;
+ if(other is not Resource otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(IdElement, otherT.IdElement)) return false;
- if(!comparer.Equals(Meta, otherT.Meta)) return false;
- if(!comparer.Equals(ImplicitRulesElement, otherT.ImplicitRulesElement)) return false;
- if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_IdElement, otherT._IdElement)) return false;
+ if(!comparer.Equals(_Meta, otherT._Meta)) return false;
+ if(!comparer.Equals(_ImplicitRulesElement, otherT._ImplicitRulesElement)) return false;
+ if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "id":
- value = IdElement;
- return IdElement is not null;
+ value = _IdElement;
+ return _IdElement is not null;
case "meta":
- value = Meta;
- return Meta is not null;
+ value = _Meta;
+ return _Meta is not null;
case "implicitRules":
- value = ImplicitRulesElement;
- return ImplicitRulesElement is not null;
+ value = _ImplicitRulesElement;
+ return _ImplicitRulesElement is not null;
case "language":
- value = LanguageElement;
- return LanguageElement is not null;
+ value = _LanguageElement;
+ return _LanguageElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "id":
- IdElement = (Hl7.Fhir.Model.Id)value;
+ IdElement = (Hl7.Fhir.Model.Id?)value;
return this;
case "meta":
- Meta = (Hl7.Fhir.Model.Meta)value;
+ Meta = (Hl7.Fhir.Model.Meta?)value;
return this;
case "implicitRules":
- ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri)value;
+ ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "language":
- LanguageElement = (Hl7.Fhir.Model.Code)value;
+ LanguageElement = (Hl7.Fhir.Model.Code?)value;
return this;
default:
return base.SetValue(key, value);
@@ -238,10 +229,10 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (IdElement is not null) yield return new KeyValuePair("id",IdElement);
- if (Meta is not null) yield return new KeyValuePair("meta",Meta);
- if (ImplicitRulesElement is not null) yield return new KeyValuePair("implicitRules",ImplicitRulesElement);
- if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement);
+ if (_IdElement is not null) yield return new KeyValuePair("id",_IdElement);
+ if (_Meta is not null) yield return new KeyValuePair("meta",_Meta);
+ if (_ImplicitRulesElement is not null) yield return new KeyValuePair("implicitRules",_ImplicitRulesElement);
+ if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs b/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs
index d6b157a029..be742e81be 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -64,28 +67,25 @@ public partial class ResourceReference : Hl7.Fhir.Model.DataType
///
[FhirElement("reference", InSummary=true, Order=30)]
[DataMember]
- public Hl7.Fhir.Model.FhirString ReferenceElement
+ public Hl7.Fhir.Model.FhirString? ReferenceElement
{
get { return _ReferenceElement; }
set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); }
}
- private Hl7.Fhir.Model.FhirString _ReferenceElement;
+ private Hl7.Fhir.Model.FhirString? _ReferenceElement;
///
/// Literal reference, Relative, internal or absolute URL
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Reference
+ public string? Reference
{
- get { return ReferenceElement != null ? ReferenceElement.Value : null; }
+ get => _ReferenceElement?.Value;
set
{
- if (value == null)
- ReferenceElement = null;
- else
- ReferenceElement = new Hl7.Fhir.Model.FhirString(value);
+ ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Reference");
}
}
@@ -99,28 +99,25 @@ public string Reference
[FhirElement("type", InSummary=true, Order=40, Since=FhirRelease.R4)]
[Binding("FHIRResourceTypeExt")]
[DataMember]
- public Hl7.Fhir.Model.FhirUri TypeElement
+ public Hl7.Fhir.Model.FhirUri? TypeElement
{
get { return _TypeElement; }
set { _TypeElement = value; OnPropertyChanged("TypeElement"); }
}
- private Hl7.Fhir.Model.FhirUri _TypeElement;
+ private Hl7.Fhir.Model.FhirUri? _TypeElement;
///
/// Type the reference refers to (e.g. "Patient") - must be a resource in resources
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Type
+ public string? Type
{
- get { return TypeElement != null ? TypeElement.Value : null; }
+ get => _TypeElement?.Value;
set
{
- if (value == null)
- TypeElement = null;
- else
- TypeElement = new Hl7.Fhir.Model.FhirUri(value);
+ TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("Type");
}
}
@@ -130,59 +127,52 @@ public string Type
///
[FhirElement("identifier", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Identifier Identifier
+ public Hl7.Fhir.Model.Identifier? Identifier
{
get { return _Identifier; }
set { _Identifier = value; OnPropertyChanged("Identifier"); }
}
- private Hl7.Fhir.Model.Identifier _Identifier;
+ private Hl7.Fhir.Model.Identifier? _Identifier;
///
/// Text alternative for the resource.
///
[FhirElement("display", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.FhirString DisplayElement
+ public Hl7.Fhir.Model.FhirString? DisplayElement
{
get { return _DisplayElement; }
set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); }
}
- private Hl7.Fhir.Model.FhirString _DisplayElement;
+ private Hl7.Fhir.Model.FhirString? _DisplayElement;
///
/// Text alternative for the resource
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Display
+ public string? Display
{
- get { return DisplayElement != null ? DisplayElement.Value : null; }
+ get => _DisplayElement?.Value;
set
{
- if (value == null)
- DisplayElement = null;
- else
- DisplayElement = new Hl7.Fhir.Model.FhirString(value);
+ DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Display");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as ResourceReference;
-
- if (dest == null)
- {
+ if(other is not ResourceReference dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirString)ReferenceElement.DeepCopyInternal();
- if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirUri)TypeElement.DeepCopyInternal();
- if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal();
- if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal();
+ if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirString)_ReferenceElement.DeepCopyInternal();
+ if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirUri)_TypeElement.DeepCopyInternal();
+ if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal();
+ if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -194,55 +184,56 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as ResourceReference;
- if(otherT == null) return false;
+ if(other is not ResourceReference otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false;
- if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false;
- if(!comparer.Equals(Identifier, otherT.Identifier)) return false;
- if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false;
+ if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false;
+ if(!comparer.Equals(_Identifier, otherT._Identifier)) return false;
+ if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "reference":
- value = ReferenceElement;
- return ReferenceElement is not null;
+ value = _ReferenceElement;
+ return _ReferenceElement is not null;
case "type":
- value = TypeElement;
- return TypeElement is not null;
+ value = _TypeElement;
+ return _TypeElement is not null;
case "identifier":
- value = Identifier;
- return Identifier is not null;
+ value = _Identifier;
+ return _Identifier is not null;
case "display":
- value = DisplayElement;
- return DisplayElement is not null;
+ value = _DisplayElement;
+ return _DisplayElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "reference":
- ReferenceElement = (Hl7.Fhir.Model.FhirString)value;
+ ReferenceElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "type":
- TypeElement = (Hl7.Fhir.Model.FhirUri)value;
+ TypeElement = (Hl7.Fhir.Model.FhirUri?)value;
return this;
case "identifier":
- Identifier = (Hl7.Fhir.Model.Identifier)value;
+ Identifier = (Hl7.Fhir.Model.Identifier?)value;
return this;
case "display":
- DisplayElement = (Hl7.Fhir.Model.FhirString)value;
+ DisplayElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
default:
return base.SetValue(key, value);
@@ -253,10 +244,10 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement);
- if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement);
- if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier);
- if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement);
+ if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement);
+ if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement);
+ if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier);
+ if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs
index e14001a326..12d0e6be63 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -72,11 +75,11 @@ public partial class Signature : Hl7.Fhir.Model.DataType
[DataMember]
public List Type
{
- get { if(_Type==null) _Type = new List(); return _Type; }
+ get => _Type ??= [];
set { _Type = value; OnPropertyChanged("Type"); }
}
- private List _Type;
+ private List? _Type;
///
/// When the signature was created.
@@ -86,13 +89,13 @@ public List Type
///
[FhirElement("when", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.Instant WhenElement
+ public Hl7.Fhir.Model.Instant? WhenElement
{
get { return _WhenElement; }
set { _WhenElement = value; OnPropertyChanged("WhenElement"); }
}
- private Hl7.Fhir.Model.Instant _WhenElement;
+ private Hl7.Fhir.Model.Instant? _WhenElement;
///
/// When the signature was created
@@ -101,13 +104,10 @@ public Hl7.Fhir.Model.Instant WhenElement
[IgnoreDataMember]
public DateTimeOffset? When
{
- get { return WhenElement != null ? WhenElement.Value : null; }
+ get => _WhenElement?.Value;
set
{
- if (value == null)
- WhenElement = null;
- else
- WhenElement = new Hl7.Fhir.Model.Instant(value);
+ WhenElement = value is null ? null : new Hl7.Fhir.Model.Instant(value);
OnPropertyChanged("When");
}
}
@@ -127,13 +127,13 @@ public DateTimeOffset? When
[References("Practitioner","PractitionerRole","RelatedPerson","Patient","Device","Organization", Since=FhirRelease.R4)]
[AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirUri))]
[DataMember]
- public Hl7.Fhir.Model.DataType Who
+ public Hl7.Fhir.Model.DataType? Who
{
get { return _Who; }
set { _Who = value; OnPropertyChanged("Who"); }
}
- private Hl7.Fhir.Model.DataType _Who;
+ private Hl7.Fhir.Model.DataType? _Who;
///
/// The party represented.
@@ -149,13 +149,13 @@ public Hl7.Fhir.Model.DataType Who
[References("Practitioner","PractitionerRole","RelatedPerson","Patient","Device","Organization", Since=FhirRelease.R4)]
[AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirUri))]
[DataMember]
- public Hl7.Fhir.Model.DataType OnBehalfOf
+ public Hl7.Fhir.Model.DataType? OnBehalfOf
{
get { return _OnBehalfOf; }
set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); }
}
- private Hl7.Fhir.Model.DataType _OnBehalfOf;
+ private Hl7.Fhir.Model.DataType? _OnBehalfOf;
///
/// The technical format of the signature.
@@ -167,28 +167,25 @@ public Hl7.Fhir.Model.DataType OnBehalfOf
[NotMapped(Since=FhirRelease.R4)]
[Binding("MimeType")]
[DataMember]
- public Hl7.Fhir.Model.Code ContentTypeElement
+ public Hl7.Fhir.Model.Code? ContentTypeElement
{
get { return _ContentTypeElement; }
set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); }
}
- private Hl7.Fhir.Model.Code _ContentTypeElement;
+ private Hl7.Fhir.Model.Code? _ContentTypeElement;
///
/// The technical format of the signature
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string ContentType
+ public string? ContentType
{
- get { return ContentTypeElement != null ? ContentTypeElement.Value : null; }
+ get => _ContentTypeElement?.Value;
set
{
- if (value == null)
- ContentTypeElement = null;
- else
- ContentTypeElement = new Hl7.Fhir.Model.Code(value);
+ ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("ContentType");
}
}
@@ -202,28 +199,25 @@ public string ContentType
[FhirElement("targetFormat", Order=70, Since=FhirRelease.R4)]
[Binding("MimeType")]
[DataMember]
- public Hl7.Fhir.Model.Code TargetFormatElement
+ public Hl7.Fhir.Model.Code? TargetFormatElement
{
get { return _TargetFormatElement; }
set { _TargetFormatElement = value; OnPropertyChanged("TargetFormatElement"); }
}
- private Hl7.Fhir.Model.Code _TargetFormatElement;
+ private Hl7.Fhir.Model.Code? _TargetFormatElement;
///
/// The technical format of the signed resources
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string TargetFormat
+ public string? TargetFormat
{
- get { return TargetFormatElement != null ? TargetFormatElement.Value : null; }
+ get => _TargetFormatElement?.Value;
set
{
- if (value == null)
- TargetFormatElement = null;
- else
- TargetFormatElement = new Hl7.Fhir.Model.Code(value);
+ TargetFormatElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("TargetFormat");
}
}
@@ -237,28 +231,25 @@ public string TargetFormat
[FhirElement("sigFormat", Order=80, Since=FhirRelease.R4)]
[Binding("MimeType")]
[DataMember]
- public Hl7.Fhir.Model.Code SigFormatElement
+ public Hl7.Fhir.Model.Code? SigFormatElement
{
get { return _SigFormatElement; }
set { _SigFormatElement = value; OnPropertyChanged("SigFormatElement"); }
}
- private Hl7.Fhir.Model.Code _SigFormatElement;
+ private Hl7.Fhir.Model.Code? _SigFormatElement;
///
/// The technical format of the signature
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string SigFormat
+ public string? SigFormat
{
- get { return SigFormatElement != null ? SigFormatElement.Value : null; }
+ get => _SigFormatElement?.Value;
set
{
- if (value == null)
- SigFormatElement = null;
- else
- SigFormatElement = new Hl7.Fhir.Model.Code(value);
+ SigFormatElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("SigFormat");
}
}
@@ -272,28 +263,25 @@ public string SigFormat
[FhirElement("blob", Order=90)]
[NotMapped(Since=FhirRelease.R4)]
[DataMember]
- public Hl7.Fhir.Model.Base64Binary BlobElement
+ public Hl7.Fhir.Model.Base64Binary? BlobElement
{
get { return _BlobElement; }
set { _BlobElement = value; OnPropertyChanged("BlobElement"); }
}
- private Hl7.Fhir.Model.Base64Binary _BlobElement;
+ private Hl7.Fhir.Model.Base64Binary? _BlobElement;
///
/// The actual signature content (XML DigSig. JWS, picture, etc.)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public byte[] Blob
+ public byte[]? Blob
{
- get { return BlobElement != null ? BlobElement.Value : null; }
+ get => _BlobElement?.Value;
set
{
- if (value == null)
- BlobElement = null;
- else
- BlobElement = new Hl7.Fhir.Model.Base64Binary(value);
+ BlobElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value);
OnPropertyChanged("Blob");
}
}
@@ -306,51 +294,44 @@ public byte[] Blob
///
[FhirElement("data", Order=90, Since=FhirRelease.R4)]
[DataMember]
- public Hl7.Fhir.Model.Base64Binary DataElement
+ public Hl7.Fhir.Model.Base64Binary? DataElement
{
get { return _DataElement; }
set { _DataElement = value; OnPropertyChanged("DataElement"); }
}
- private Hl7.Fhir.Model.Base64Binary _DataElement;
+ private Hl7.Fhir.Model.Base64Binary? _DataElement;
///
/// The actual signature content (XML DigSig. JWS, picture, etc.)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public byte[] Data
+ public byte[]? Data
{
- get { return DataElement != null ? DataElement.Value : null; }
+ get => _DataElement?.Value;
set
{
- if (value == null)
- DataElement = null;
- else
- DataElement = new Hl7.Fhir.Model.Base64Binary(value);
+ DataElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value);
OnPropertyChanged("Data");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as Signature;
-
- if (dest == null)
- {
+ if(other is not Signature dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal());
- if(WhenElement != null) dest.WhenElement = (Hl7.Fhir.Model.Instant)WhenElement.DeepCopyInternal();
- if(Who != null) dest.Who = (Hl7.Fhir.Model.DataType)Who.DeepCopyInternal();
- if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.DataType)OnBehalfOf.DeepCopyInternal();
- if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal();
- if(TargetFormatElement != null) dest.TargetFormatElement = (Hl7.Fhir.Model.Code)TargetFormatElement.DeepCopyInternal();
- if(SigFormatElement != null) dest.SigFormatElement = (Hl7.Fhir.Model.Code)SigFormatElement.DeepCopyInternal();
- if(BlobElement != null) dest.BlobElement = (Hl7.Fhir.Model.Base64Binary)BlobElement.DeepCopyInternal();
- if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)DataElement.DeepCopyInternal();
+ if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal());
+ if(_WhenElement is not null) dest.WhenElement = (Hl7.Fhir.Model.Instant)_WhenElement.DeepCopyInternal();
+ if(_Who is not null) dest.Who = (Hl7.Fhir.Model.DataType)_Who.DeepCopyInternal();
+ if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.DataType)_OnBehalfOf.DeepCopyInternal();
+ if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal();
+ if(_TargetFormatElement is not null) dest.TargetFormatElement = (Hl7.Fhir.Model.Code)_TargetFormatElement.DeepCopyInternal();
+ if(_SigFormatElement is not null) dest.SigFormatElement = (Hl7.Fhir.Model.Code)_SigFormatElement.DeepCopyInternal();
+ if(_BlobElement is not null) dest.BlobElement = (Hl7.Fhir.Model.Base64Binary)_BlobElement.DeepCopyInternal();
+ if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)_DataElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -362,90 +343,91 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as Signature;
- if(otherT == null) return false;
+ if(other is not Signature otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.ListEquals(Type, otherT.Type)) return false;
- if(!comparer.Equals(WhenElement, otherT.WhenElement)) return false;
- if(!comparer.Equals(Who, otherT.Who)) return false;
- if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false;
- if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false;
- if(!comparer.Equals(TargetFormatElement, otherT.TargetFormatElement)) return false;
- if(!comparer.Equals(SigFormatElement, otherT.SigFormatElement)) return false;
- if(!comparer.Equals(BlobElement, otherT.BlobElement)) return false;
- if(!comparer.Equals(DataElement, otherT.DataElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.ListEquals(_Type, otherT._Type)) return false;
+ if(!comparer.Equals(_WhenElement, otherT._WhenElement)) return false;
+ if(!comparer.Equals(_Who, otherT._Who)) return false;
+ if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false;
+ if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false;
+ if(!comparer.Equals(_TargetFormatElement, otherT._TargetFormatElement)) return false;
+ if(!comparer.Equals(_SigFormatElement, otherT._SigFormatElement)) return false;
+ if(!comparer.Equals(_BlobElement, otherT._BlobElement)) return false;
+ if(!comparer.Equals(_DataElement, otherT._DataElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "type":
- value = Type;
- return Type?.Any() == true;
+ value = _Type;
+ return _Type?.Any() == true;
case "when":
- value = WhenElement;
- return WhenElement is not null;
+ value = _WhenElement;
+ return _WhenElement is not null;
case "who":
- value = Who;
- return Who is not null;
+ value = _Who;
+ return _Who is not null;
case "onBehalfOf":
- value = OnBehalfOf;
- return OnBehalfOf is not null;
+ value = _OnBehalfOf;
+ return _OnBehalfOf is not null;
case "contentType":
- value = ContentTypeElement;
- return ContentTypeElement is not null;
+ value = _ContentTypeElement;
+ return _ContentTypeElement is not null;
case "targetFormat":
- value = TargetFormatElement;
- return TargetFormatElement is not null;
+ value = _TargetFormatElement;
+ return _TargetFormatElement is not null;
case "sigFormat":
- value = SigFormatElement;
- return SigFormatElement is not null;
+ value = _SigFormatElement;
+ return _SigFormatElement is not null;
case "blob":
- value = BlobElement;
- return BlobElement is not null;
+ value = _BlobElement;
+ return _BlobElement is not null;
case "data":
- value = DataElement;
- return DataElement is not null;
+ value = _DataElement;
+ return _DataElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "type":
- Type = (List)value;
+ Type = (List?)value!;
return this;
case "when":
- WhenElement = (Hl7.Fhir.Model.Instant)value;
+ WhenElement = (Hl7.Fhir.Model.Instant?)value;
return this;
case "who":
- Who = (Hl7.Fhir.Model.DataType)value;
+ Who = (Hl7.Fhir.Model.DataType?)value;
return this;
case "onBehalfOf":
- OnBehalfOf = (Hl7.Fhir.Model.DataType)value;
+ OnBehalfOf = (Hl7.Fhir.Model.DataType?)value;
return this;
case "contentType":
- ContentTypeElement = (Hl7.Fhir.Model.Code)value;
+ ContentTypeElement = (Hl7.Fhir.Model.Code?)value;
return this;
case "targetFormat":
- TargetFormatElement = (Hl7.Fhir.Model.Code)value;
+ TargetFormatElement = (Hl7.Fhir.Model.Code?)value;
return this;
case "sigFormat":
- SigFormatElement = (Hl7.Fhir.Model.Code)value;
+ SigFormatElement = (Hl7.Fhir.Model.Code?)value;
return this;
case "blob":
- BlobElement = (Hl7.Fhir.Model.Base64Binary)value;
+ BlobElement = (Hl7.Fhir.Model.Base64Binary?)value;
return this;
case "data":
- DataElement = (Hl7.Fhir.Model.Base64Binary)value;
+ DataElement = (Hl7.Fhir.Model.Base64Binary?)value;
return this;
default:
return base.SetValue(key, value);
@@ -456,15 +438,15 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Type?.Any() == true) yield return new KeyValuePair("type",Type);
- if (WhenElement is not null) yield return new KeyValuePair("when",WhenElement);
- if (Who is not null) yield return new KeyValuePair("who",Who);
- if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf);
- if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement);
- if (TargetFormatElement is not null) yield return new KeyValuePair("targetFormat",TargetFormatElement);
- if (SigFormatElement is not null) yield return new KeyValuePair("sigFormat",SigFormatElement);
- if (BlobElement is not null) yield return new KeyValuePair("blob",BlobElement);
- if (DataElement is not null) yield return new KeyValuePair("data",DataElement);
+ if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type);
+ if (_WhenElement is not null) yield return new KeyValuePair("when",_WhenElement);
+ if (_Who is not null) yield return new KeyValuePair("who",_Who);
+ if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf);
+ if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement);
+ if (_TargetFormatElement is not null) yield return new KeyValuePair("targetFormat",_TargetFormatElement);
+ if (_SigFormatElement is not null) yield return new KeyValuePair("sigFormat",_SigFormatElement);
+ if (_BlobElement is not null) yield return new KeyValuePair("blob",_BlobElement);
+ if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Time.cs b/src/Hl7.Fhir.Base/Model/Generated/Time.cs
index 5f910ae09f..33a6e4b6f1 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Time.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Time.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -59,12 +62,12 @@ public partial class Time : PrimitiveType, IValue
/// Must conform to the pattern "([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?"
public const string PATTERN = @"([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?";
- public Time(string value)
+ public Time(string? value)
{
Value = value;
}
- public Time(): this((string)null) {}
+ public Time(): this((string?)null) {}
///
/// Primitive value of the element
@@ -73,9 +76,9 @@ public Time(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.Time))]
[TimePattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/UnsignedInt.cs b/src/Hl7.Fhir.Base/Model/Generated/UnsignedInt.cs
index 3366bd7091..55a942abe2 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/UnsignedInt.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/UnsignedInt.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
diff --git a/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs b/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs
index 8d621423a0..ded38fcf58 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -66,13 +69,13 @@ public partial class UsageContext : Hl7.Fhir.Model.DataType
[Binding("UsageContextType")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.Coding Code
+ public Hl7.Fhir.Model.Coding? Code
{
get { return _Code; }
set { _Code = value; OnPropertyChanged("Code"); }
}
- private Hl7.Fhir.Model.Coding _Code;
+ private Hl7.Fhir.Model.Coding? _Code;
///
/// Value that defines the context.
@@ -84,26 +87,22 @@ public Hl7.Fhir.Model.Coding Code
[AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.ResourceReference))]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.DataType Value
+ public Hl7.Fhir.Model.DataType? Value
{
get { return _Value; }
set { _Value = value; OnPropertyChanged("Value"); }
}
- private Hl7.Fhir.Model.DataType _Value;
+ private Hl7.Fhir.Model.DataType? _Value;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as UsageContext;
-
- if (dest == null)
- {
+ if(other is not UsageContext dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Code != null) dest.Code = (Hl7.Fhir.Model.Coding)Code.DeepCopyInternal();
- if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal();
+ if(_Code is not null) dest.Code = (Hl7.Fhir.Model.Coding)_Code.DeepCopyInternal();
+ if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -115,41 +114,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as UsageContext;
- if(otherT == null) return false;
+ if(other is not UsageContext otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(Code, otherT.Code)) return false;
- if(!comparer.Equals(Value, otherT.Value)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_Code, otherT._Code)) return false;
+ if(!comparer.Equals(_Value, otherT._Value)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "code":
- value = Code;
- return Code is not null;
+ value = _Code;
+ return _Code is not null;
case "value":
- value = Value;
- return Value is not null;
+ value = _Value;
+ return _Value is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "code":
- Code = (Hl7.Fhir.Model.Coding)value;
+ Code = (Hl7.Fhir.Model.Coding?)value;
return this;
case "value":
- Value = (Hl7.Fhir.Model.DataType)value;
+ Value = (Hl7.Fhir.Model.DataType?)value;
return this;
default:
return base.SetValue(key, value);
@@ -160,8 +160,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Code is not null) yield return new KeyValuePair("code",Code);
- if (Value is not null) yield return new KeyValuePair("value",Value);
+ if (_Code is not null) yield return new KeyValuePair("code",_Code);
+ if (_Value is not null) yield return new KeyValuePair("value",_Value);
}
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/Uuid.cs b/src/Hl7.Fhir.Base/Model/Generated/Uuid.cs
index 5c0be7f55d..06733f0c00 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/Uuid.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/Uuid.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -62,12 +65,12 @@ public partial class Uuid : PrimitiveType, IValue
/// Must conform to the pattern "urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
public const string PATTERN = @"urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
- public Uuid(string value)
+ public Uuid(string? value)
{
Value = value;
}
- public Uuid(): this((string)null) {}
+ public Uuid(): this((string?)null) {}
///
/// Primitive value of the element
@@ -76,9 +79,9 @@ public Uuid(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[UuidPattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/Generated/XHtml.cs b/src/Hl7.Fhir.Base/Model/Generated/XHtml.cs
index a8804a160d..df15a08e70 100644
--- a/src/Hl7.Fhir.Base/Model/Generated/XHtml.cs
+++ b/src/Hl7.Fhir.Base/Model/Generated/XHtml.cs
@@ -7,9 +7,12 @@
using Hl7.Fhir.Introspection;
using Hl7.Fhir.Specification;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
using COVE=Hl7.Fhir.Validation.CodedValidationException;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -56,12 +59,12 @@ public partial class XHtml : PrimitiveType, IValue
///
public override string TypeName { get { return "xhtml"; } }
- public XHtml(string value)
+ public XHtml(string? value)
{
Value = value;
}
- public XHtml(): this((string)null) {}
+ public XHtml(): this((string?)null) {}
///
/// Primitive value of the element
@@ -70,9 +73,9 @@ public XHtml(): this((string)null) {}
[DeclaredType(Type = typeof(SystemPrimitive.String))]
[NarrativeXhtmlPattern]
[DataMember]
- public string Value
+ public string? Value
{
- get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
+ get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); }
set { ObjectValue = value; OnPropertyChanged("Value"); }
}
diff --git a/src/Hl7.Fhir.Base/Model/IPatient.cs b/src/Hl7.Fhir.Base/Model/IPatient.cs
index 73e6c36ba7..a00ad87368 100644
--- a/src/Hl7.Fhir.Base/Model/IPatient.cs
+++ b/src/Hl7.Fhir.Base/Model/IPatient.cs
@@ -16,7 +16,7 @@ namespace Hl7.Fhir.Model
///
public interface IPatient
{
- Date BirthDate { get; }
+ Date? BirthDate { get; }
}
}
#nullable restore
\ No newline at end of file
diff --git a/src/Hl7.Fhir.Base/Model/IValue.cs b/src/Hl7.Fhir.Base/Model/IValue.cs
index 2e5ff68385..1312151ad4 100644
--- a/src/Hl7.Fhir.Base/Model/IValue.cs
+++ b/src/Hl7.Fhir.Base/Model/IValue.cs
@@ -6,6 +6,8 @@
* available at https://raw.githubusercontent.com/FirelyTeam/firely-net-sdk/master/LICENSE
*/
+#nullable enable
+
namespace Hl7.Fhir.Model;
/// Common generic Value property interface.
@@ -13,9 +15,9 @@ namespace Hl7.Fhir.Model;
public interface IValue
{
/// Gets or sets the value
- T Value { get; set; }
+ T? Value { get; set; }
}
/// Common generic nullable value property interface.
/// The value type.
-public interface INullableValue : IValue where T : struct { }
\ No newline at end of file
+public interface INullableValue : IValue where T : struct;
\ No newline at end of file
diff --git a/src/Hl7.Fhir.Base/Model/OverflowEntry.cs b/src/Hl7.Fhir.Base/Model/OverflowEntry.cs
new file mode 100644
index 0000000000..a32393afc3
--- /dev/null
+++ b/src/Hl7.Fhir.Base/Model/OverflowEntry.cs
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025, Firely (info@fire.ly) and contributors
+ * See the file CONTRIBUTORS for details.
+ *
+ * This file is licensed under the BSD 3-Clause license
+ * available at https://raw.githubusercontent.com/FirelyTeam/firely-net-sdk/master/LICENSE
+ */
+
+#nullable enable
+
+using Hl7.Fhir.Validation;
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.Runtime.CompilerServices;
+
+namespace Hl7.Fhir.Model;
+
+///
+/// Contains both a value for an overflow and its nature.
+///
+/// Internal use only. This class keeps track of why an item appears in overflow so validation
+/// can provide the correct error message.
+public abstract record OverflowEntry(object Value)
+{
+ private readonly static object OVERFLOW_MARKER = new();
+
+ public static T GetOverflowMarker() where T:class => Unsafe.As(OVERFLOW_MARKER);
+ public static bool IsOverflow(object marker) => ReferenceEquals(marker, OVERFLOW_MARKER);
+
+ public virtual CodedValidationException? Validate(ValidationContext context) => null;
+}
+
+public record UnknownElementOverflow(object Value) : OverflowEntry(Value);
+
+public record IncorrectTypeOverflow(object Value, Type ExpectedType) : OverflowEntry(Value);
\ No newline at end of file
diff --git a/src/Hl7.Fhir.Base/Model/PocoEqualityComparisons.cs b/src/Hl7.Fhir.Base/Model/PocoEqualityComparisons.cs
index 5795b42876..a0f546cb10 100644
--- a/src/Hl7.Fhir.Base/Model/PocoEqualityComparisons.cs
+++ b/src/Hl7.Fhir.Base/Model/PocoEqualityComparisons.cs
@@ -89,12 +89,14 @@ public static class PocoEqualityComparisons
///
/// Is throw when the IEqualityComparer for Base does not
/// support comparing IEnumerable{Base}
- public static bool ListEquals(this IEqualityComparer comparer, IEnumerable a, IEnumerable b)
+ public static bool ListEquals(this IEqualityComparer comparer, IEnumerable? a, IEnumerable? b)
{
if (comparer is not IEqualityComparer> listComparer)
throw new ArgumentException("The comparer does not support list comparison", nameof(comparer));
+#pragma warning disable CS8604 // Possible null reference argument - incorrect signature in netstd2.1
return listComparer.Equals(a, b);
+#pragma warning restore CS8604 // Possible null reference argument.
}
///
diff --git a/src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs b/src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs
index 8b22f52d06..25c7abf979 100644
--- a/src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs
+++ b/src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs
@@ -107,7 +107,7 @@ public TransactionBuilder Get(string url, string? bundleEntryFullUrl = null)
public TransactionBuilder Read(string resourceType, string id, string? versionId = null, DateTimeOffset? ifModifiedSince = null, string? bundleEntryFullUrl = null)
{
var entry = newEntry(Bundle.HTTPVerb.GET, InteractionType.Read, bundleEntryFullUrl);
- entry.Request.IfNoneMatch = createIfMatchETag(versionId);
+ entry.Request!.IfNoneMatch = createIfMatchETag(versionId);
entry.Request.IfModifiedSince = ifModifiedSince;
var path = newRestUrl().AddPath(resourceType, id);
addEntry(entry, path);
@@ -148,7 +148,7 @@ public TransactionBuilder Update(string id, Resource body, string? versionId = n
{
var entry = newEntry(Bundle.HTTPVerb.PUT, InteractionType.Update, bundleEntryFullUrl);
entry.Resource = body;
- entry.Request.IfMatch = createIfMatchETag(versionId);
+ entry.Request!.IfMatch = createIfMatchETag(versionId);
var path = newRestUrl().AddPath(body.TypeName, id);
addEntry(entry, path);
@@ -167,7 +167,7 @@ public TransactionBuilder ConditionalUpdate(SearchParams condition, Resource bod
{
var entry = newEntry(Bundle.HTTPVerb.PUT, InteractionType.ConditionalUpdate, bundleEntryFullUrl);
entry.Resource = body;
- entry.Request.IfMatch = createIfMatchETag(versionId);
+ entry.Request!.IfMatch = createIfMatchETag(versionId);
var path = newRestUrl().AddPath(body.TypeName);
path.AddParams(condition.ToUriParamList());
addEntry(entry, path);
@@ -192,7 +192,7 @@ public TransactionBuilder Patch(string resourceType, string id, Parameters body,
{
var entry = newEntry(Bundle.HTTPVerb.PATCH, InteractionType.Patch, bundleEntryFullUrl);
entry.Resource = body;
- entry.Request.IfMatch = createIfMatchETag(versionId);
+ entry.Request!.IfMatch = createIfMatchETag(versionId);
var path = newRestUrl().AddPath(resourceType, id);
addEntry(entry, path);
@@ -212,7 +212,7 @@ public TransactionBuilder ConditionalPatch(string resourceType, SearchParams con
{
var entry = newEntry(Bundle.HTTPVerb.PATCH, InteractionType.ConditionalPatch, bundleEntryFullUrl);
entry.Resource = body;
- entry.Request.IfMatch = createIfMatchETag(versionId);
+ entry.Request!.IfMatch = createIfMatchETag(versionId);
var path = newRestUrl().AddPath(resourceType);
path.AddParams(condition.ToUriParamList());
addEntry(entry, path);
@@ -253,7 +253,7 @@ public TransactionBuilder ConditionalDeleteSingle(SearchParams condition, string
var entry = newEntry(Bundle.HTTPVerb.DELETE, InteractionType.ConditionalDeleteSingle, bundleEntryFullUrl);
var path = newRestUrl().AddPath(resourceType ?? "");
path.AddParams(condition.ToUriParamList());
- entry.Request.IfMatch = createIfMatchETag(versionId);
+ entry.Request!.IfMatch = createIfMatchETag(versionId);
addEntry(entry, path);
@@ -347,7 +347,7 @@ public TransactionBuilder ConditionalCreate(Resource body, SearchParams conditio
entry.Resource = body;
var path = newRestUrl().AddPath(body.TypeName);
- entry.Request.IfNoneExist = condition.ToUriParamList().ToQueryString();
+ entry.Request!.IfNoneExist = condition.ToUriParamList().ToQueryString();
addEntry(entry, path);
return this;
@@ -635,6 +635,8 @@ private static Bundle.EntryComponent newEntry(Bundle.HTTPVerb method, Interactio
private void addEntry(Bundle.EntryComponent newEntry, RestUrl path)
{
+ if(newEntry.Request is null) throw Error.InvalidOperation("Request component of the entry is not set.");
+
var url = HttpUtil.MakeRelativeFromBase(path.Uri, _baseUrl);
newEntry.Request.Url = url!.OriginalString;
_result.Entry.Add(newEntry);
diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs
index 29f1d42721..31eef3d217 100644
--- a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs
+++ b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs
@@ -10,8 +10,11 @@
using Hl7.Fhir.Specification;
using Hl7.Fhir.Utility;
using Hl7.Fhir.Validation;
+using System.Diagnostics.CodeAnalysis;
using SystemPrimitive = Hl7.Fhir.ElementModel.Types;
+#nullable enable
+
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@@ -376,28 +379,25 @@ public partial class SoftwareComponent : Hl7.Fhir.Model.BackboneElement
[FhirElement("name", InSummary=true, Order=40)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirString NameElement
+ public Hl7.Fhir.Model.FhirString? NameElement
{
get { return _NameElement; }
set { _NameElement = value; OnPropertyChanged("NameElement"); }
}
- private Hl7.Fhir.Model.FhirString _NameElement;
+ private Hl7.Fhir.Model.FhirString? _NameElement;
///
/// A name the software is known by
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Name
+ public string? Name
{
- get { return NameElement != null ? NameElement.Value : null; }
+ get => _NameElement?.Value;
set
{
- if (value == null)
- NameElement = null;
- else
- NameElement = new Hl7.Fhir.Model.FhirString(value);
+ NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Name");
}
}
@@ -407,28 +407,25 @@ public string Name
///
[FhirElement("version", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.FhirString VersionElement
+ public Hl7.Fhir.Model.FhirString? VersionElement
{
get { return _VersionElement; }
set { _VersionElement = value; OnPropertyChanged("VersionElement"); }
}
- private Hl7.Fhir.Model.FhirString _VersionElement;
+ private Hl7.Fhir.Model.FhirString? _VersionElement;
///
/// Version covered by this statement
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Version
+ public string? Version
{
- get { return VersionElement != null ? VersionElement.Value : null; }
+ get => _VersionElement?.Value;
set
{
- if (value == null)
- VersionElement = null;
- else
- VersionElement = new Hl7.Fhir.Model.FhirString(value);
+ VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Version");
}
}
@@ -438,45 +435,38 @@ public string Version
///
[FhirElement("releaseDate", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.FhirDateTime ReleaseDateElement
+ public Hl7.Fhir.Model.FhirDateTime? ReleaseDateElement
{
get { return _ReleaseDateElement; }
set { _ReleaseDateElement = value; OnPropertyChanged("ReleaseDateElement"); }
}
- private Hl7.Fhir.Model.FhirDateTime _ReleaseDateElement;
+ private Hl7.Fhir.Model.FhirDateTime? _ReleaseDateElement;
///
/// Date this version was released
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string ReleaseDate
+ public string? ReleaseDate
{
- get { return ReleaseDateElement != null ? ReleaseDateElement.Value : null; }
+ get => _ReleaseDateElement?.Value;
set
{
- if (value == null)
- ReleaseDateElement = null;
- else
- ReleaseDateElement = new Hl7.Fhir.Model.FhirDateTime(value);
+ ReleaseDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value);
OnPropertyChanged("ReleaseDate");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as SoftwareComponent;
-
- if (dest == null)
- {
+ if(other is not SoftwareComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal();
- if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal();
- if(ReleaseDateElement != null) dest.ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)ReleaseDateElement.DeepCopyInternal();
+ if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal();
+ if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal();
+ if(_ReleaseDateElement is not null) dest.ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)_ReleaseDateElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -488,48 +478,49 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as SoftwareComponent;
- if(otherT == null) return false;
+ if(other is not SoftwareComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(NameElement, otherT.NameElement)) return false;
- if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false;
- if(!comparer.Equals(ReleaseDateElement, otherT.ReleaseDateElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_NameElement, otherT._NameElement)) return false;
+ if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false;
+ if(!comparer.Equals(_ReleaseDateElement, otherT._ReleaseDateElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "name":
- value = NameElement;
- return NameElement is not null;
+ value = _NameElement;
+ return _NameElement is not null;
case "version":
- value = VersionElement;
- return VersionElement is not null;
+ value = _VersionElement;
+ return _VersionElement is not null;
case "releaseDate":
- value = ReleaseDateElement;
- return ReleaseDateElement is not null;
+ value = _ReleaseDateElement;
+ return _ReleaseDateElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "name":
- NameElement = (Hl7.Fhir.Model.FhirString)value;
+ NameElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "version":
- VersionElement = (Hl7.Fhir.Model.FhirString)value;
+ VersionElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "releaseDate":
- ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)value;
+ ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime?)value;
return this;
default:
return base.SetValue(key, value);
@@ -540,9 +531,9 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (NameElement is not null) yield return new KeyValuePair("name",NameElement);
- if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement);
- if (ReleaseDateElement is not null) yield return new KeyValuePair("releaseDate",ReleaseDateElement);
+ if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement);
+ if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement);
+ if (_ReleaseDateElement is not null) yield return new KeyValuePair("releaseDate",_ReleaseDateElement);
}
}
@@ -579,28 +570,25 @@ public partial class ImplementationComponent : Hl7.Fhir.Model.BackboneElement
[DeclaredType(Type = typeof(Hl7.Fhir.Model.Markdown), Since = FhirRelease.R5)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.PrimitiveType DescriptionElement
+ public Hl7.Fhir.Model.PrimitiveType? DescriptionElement
{
get { return _DescriptionElement; }
set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); }
}
- private Hl7.Fhir.Model.PrimitiveType _DescriptionElement;
+ private Hl7.Fhir.Model.PrimitiveType? _DescriptionElement;
///
/// Describes this specific instance. Use this property in STU3, R4 and R4B.
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string DescriptionString
+ public string? DescriptionString
{
- get { return DescriptionElement != null ? ((IValue)DescriptionElement).Value : null; }
+ get => ((IValue?)_DescriptionElement)?.Value;
set
{
- if (value == null)
- DescriptionElement = null;
- else
- DescriptionElement = new Hl7.Fhir.Model.FhirString(value);
+ DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("DescriptionString");
}
}
@@ -610,15 +598,12 @@ public string DescriptionString
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Description
+ public string? Description
{
- get { return DescriptionElement != null ? ((IValue)DescriptionElement).Value : null; }
+ get => ((IValue?)_DescriptionElement)?.Value;
set
{
- if (value == null)
- DescriptionElement = null;
- else
- DescriptionElement = new Hl7.Fhir.Model.Markdown(value);
+ DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Description");
}
}
@@ -628,28 +613,25 @@ public string Description
///
[FhirElement("url", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.FhirUrl UrlElement
+ public Hl7.Fhir.Model.FhirUrl? UrlElement
{
get { return _UrlElement; }
set { _UrlElement = value; OnPropertyChanged("UrlElement"); }
}
- private Hl7.Fhir.Model.FhirUrl _UrlElement;
+ private Hl7.Fhir.Model.FhirUrl? _UrlElement;
///
/// Base URL for the installation
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Url
+ public string? Url
{
- get { return UrlElement != null ? UrlElement.Value : null; }
+ get => _UrlElement?.Value;
set
{
- if (value == null)
- UrlElement = null;
- else
- UrlElement = new Hl7.Fhir.Model.FhirUrl(value);
+ UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value);
OnPropertyChanged("Url");
}
}
@@ -661,27 +643,23 @@ public string Url
[CLSCompliant(false)]
[References("Organization")]
[DataMember]
- public Hl7.Fhir.Model.ResourceReference Custodian
+ public Hl7.Fhir.Model.ResourceReference? Custodian
{
get { return _Custodian; }
set { _Custodian = value; OnPropertyChanged("Custodian"); }
}
- private Hl7.Fhir.Model.ResourceReference _Custodian;
+ private Hl7.Fhir.Model.ResourceReference? _Custodian;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as ImplementationComponent;
-
- if (dest == null)
- {
+ if(other is not ImplementationComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)DescriptionElement.DeepCopyInternal();
- if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal();
- if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal();
+ if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)_DescriptionElement.DeepCopyInternal();
+ if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal();
+ if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -693,48 +671,49 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as ImplementationComponent;
- if(otherT == null) return false;
+ if(other is not ImplementationComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false;
- if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false;
- if(!comparer.Equals(Custodian, otherT.Custodian)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false;
+ if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false;
+ if(!comparer.Equals(_Custodian, otherT._Custodian)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "description":
- value = DescriptionElement;
- return DescriptionElement is not null;
+ value = _DescriptionElement;
+ return _DescriptionElement is not null;
case "url":
- value = UrlElement;
- return UrlElement is not null;
+ value = _UrlElement;
+ return _UrlElement is not null;
case "custodian":
- value = Custodian;
- return Custodian is not null;
+ value = _Custodian;
+ return _Custodian is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "description":
- DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)value;
+ DescriptionElement = (Hl7.Fhir.Model.PrimitiveType?)value;
return this;
case "url":
- UrlElement = (Hl7.Fhir.Model.FhirUrl)value;
+ UrlElement = (Hl7.Fhir.Model.FhirUrl?)value;
return this;
case "custodian":
- Custodian = (Hl7.Fhir.Model.ResourceReference)value;
+ Custodian = (Hl7.Fhir.Model.ResourceReference?)value;
return this;
default:
return base.SetValue(key, value);
@@ -745,9 +724,9 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement);
- if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement);
- if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian);
+ if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement);
+ if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement);
+ if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian);
}
}
@@ -777,13 +756,13 @@ public partial class RestComponent : Hl7.Fhir.Model.BackboneElement
[Binding("RestfulCapabilityMode")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code ModeElement
+ public Code? ModeElement
{
get { return _ModeElement; }
set { _ModeElement = value; OnPropertyChanged("ModeElement"); }
}
- private Code _ModeElement;
+ private Code? _ModeElement;
///
/// client | server
@@ -792,13 +771,10 @@ public Code ModeElemen
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatement.RestfulCapabilityMode? Mode
{
- get { return ModeElement != null ? ModeElement.Value : null; }
+ get => _ModeElement?.Value;
set
{
- if (value == null)
- ModeElement = null;
- else
- ModeElement = new Code(value);
+ ModeElement = value is null ? null : new Code(value);
OnPropertyChanged("Mode");
}
}
@@ -808,28 +784,25 @@ public Hl7.Fhir.Model.CapabilityStatement.RestfulCapabilityMode? Mode
///
[FhirElement("documentation", Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DocumentationElement
+ public Hl7.Fhir.Model.Markdown? DocumentationElement
{
get { return _DocumentationElement; }
set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); }
}
- private Hl7.Fhir.Model.Markdown _DocumentationElement;
+ private Hl7.Fhir.Model.Markdown? _DocumentationElement;
///
/// General description of implementation
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Documentation
+ public string? Documentation
{
- get { return DocumentationElement != null ? DocumentationElement.Value : null; }
+ get => _DocumentationElement?.Value;
set
{
- if (value == null)
- DocumentationElement = null;
- else
- DocumentationElement = new Hl7.Fhir.Model.Markdown(value);
+ DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Documentation");
}
}
@@ -839,13 +812,13 @@ public string Documentation
///
[FhirElement("security", InSummary=true, Order=60)]
[DataMember]
- public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent Security
+ public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent? Security
{
get { return _Security; }
set { _Security = value; OnPropertyChanged("Security"); }
}
- private Hl7.Fhir.Model.CapabilityStatement.SecurityComponent _Security;
+ private Hl7.Fhir.Model.CapabilityStatement.SecurityComponent? _Security;
///
/// Resource served on the REST interface.
@@ -855,11 +828,11 @@ public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent Security
[DataMember]
public List Resource
{
- get { if(_Resource==null) _Resource = new List(); return _Resource; }
+ get => _Resource ??= [];
set { _Resource = value; OnPropertyChanged("Resource"); }
}
- private List _Resource;
+ private List? _Resource;
///
/// What operations are supported?.
@@ -869,11 +842,11 @@ public List Resource
[DataMember]
public List Interaction
{
- get { if(_Interaction==null) _Interaction = new List(); return _Interaction; }
+ get => _Interaction ??= [];
set { _Interaction = value; OnPropertyChanged("Interaction"); }
}
- private List _Interaction;
+ private List? _Interaction;
///
/// Search parameters for searching all resources.
@@ -883,11 +856,11 @@ public List Inter
[DataMember]
public List SearchParam
{
- get { if(_SearchParam==null) _SearchParam = new List(); return _SearchParam; }
+ get => _SearchParam ??= [];
set { _SearchParam = value; OnPropertyChanged("SearchParam"); }
}
- private List _SearchParam;
+ private List? _SearchParam;
///
/// Definition of a system level operation.
@@ -897,11 +870,11 @@ public List SearchParam
[DataMember]
public List Operation
{
- get { if(_Operation==null) _Operation = new List(); return _Operation; }
+ get => _Operation ??= [];
set { _Operation = value; OnPropertyChanged("Operation"); }
}
- private List _Operation;
+ private List? _Operation;
///
/// Compartments served/used by system.
@@ -911,24 +884,24 @@ public List Operation
[DataMember]
public List CompartmentElement
{
- get { if(_CompartmentElement==null) _CompartmentElement = new List(); return _CompartmentElement; }
+ get => _CompartmentElement ??= [];
set { _CompartmentElement = value; OnPropertyChanged("CompartmentElement"); }
}
- private List _CompartmentElement;
+ private List? _CompartmentElement;
///
/// Compartments served/used by system
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable Compartment
+ public IEnumerable Compartment
{
- get { return CompartmentElement != null ? CompartmentElement.Select(elem => elem.Value) : null; }
+ get => _CompartmentElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- CompartmentElement = null;
+ CompartmentElement = null!;
else
CompartmentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem)));
OnPropertyChanged("Compartment");
@@ -937,22 +910,18 @@ public IEnumerable Compartment
protected internal override void CopyToInternal(Base other)
{
- var dest = other as RestComponent;
-
- if (dest == null)
- {
+ if(other is not RestComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal();
- if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal();
- if(Security != null) dest.Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)Security.DeepCopyInternal();
- if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal());
- if(Interaction.Any()) dest.Interaction = new List(Interaction.DeepCopyInternal());
- if(SearchParam.Any()) dest.SearchParam = new List(SearchParam.DeepCopyInternal());
- if(Operation.Any()) dest.Operation = new List(Operation.DeepCopyInternal());
- if(CompartmentElement.Any()) dest.CompartmentElement = new List(CompartmentElement.DeepCopyInternal());
+ if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal();
+ if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal();
+ if(_Security is not null) dest.Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)_Security.DeepCopyInternal();
+ if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal());
+ if(_Interaction is not null) dest.Interaction = new List(_Interaction.DeepCopyInternal());
+ if(_SearchParam is not null) dest.SearchParam = new List(_SearchParam.DeepCopyInternal());
+ if(_Operation is not null) dest.Operation = new List(_Operation.DeepCopyInternal());
+ if(_CompartmentElement is not null) dest.CompartmentElement = new List(_CompartmentElement.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -964,83 +933,84 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as RestComponent;
- if(otherT == null) return false;
+ if(other is not RestComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false;
- if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false;
- if(!comparer.Equals(Security, otherT.Security)) return false;
- if(!comparer.ListEquals(Resource, otherT.Resource)) return false;
- if(!comparer.ListEquals(Interaction, otherT.Interaction)) return false;
- if(!comparer.ListEquals(SearchParam, otherT.SearchParam)) return false;
- if(!comparer.ListEquals(Operation, otherT.Operation)) return false;
- if(!comparer.ListEquals(CompartmentElement, otherT.CompartmentElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false;
+ if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false;
+ if(!comparer.Equals(_Security, otherT._Security)) return false;
+ if(!comparer.ListEquals(_Resource, otherT._Resource)) return false;
+ if(!comparer.ListEquals(_Interaction, otherT._Interaction)) return false;
+ if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false;
+ if(!comparer.ListEquals(_Operation, otherT._Operation)) return false;
+ if(!comparer.ListEquals(_CompartmentElement, otherT._CompartmentElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "mode":
- value = ModeElement;
- return ModeElement is not null;
+ value = _ModeElement;
+ return _ModeElement is not null;
case "documentation":
- value = DocumentationElement;
- return DocumentationElement is not null;
+ value = _DocumentationElement;
+ return _DocumentationElement is not null;
case "security":
- value = Security;
- return Security is not null;
+ value = _Security;
+ return _Security is not null;
case "resource":
- value = Resource;
- return Resource?.Any() == true;
+ value = _Resource;
+ return _Resource?.Any() == true;
case "interaction":
- value = Interaction;
- return Interaction?.Any() == true;
+ value = _Interaction;
+ return _Interaction?.Any() == true;
case "searchParam":
- value = SearchParam;
- return SearchParam?.Any() == true;
+ value = _SearchParam;
+ return _SearchParam?.Any() == true;
case "operation":
- value = Operation;
- return Operation?.Any() == true;
+ value = _Operation;
+ return _Operation?.Any() == true;
case "compartment":
- value = CompartmentElement;
- return CompartmentElement?.Any() == true;
+ value = _CompartmentElement;
+ return _CompartmentElement?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "mode":
- ModeElement = (Code)value;
+ ModeElement = (Code?)value;
return this;
case "documentation":
- DocumentationElement = (Hl7.Fhir.Model.Markdown)value;
+ DocumentationElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
case "security":
- Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)value;
+ Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent?)value;
return this;
case "resource":
- Resource = (List)value;
+ Resource = (List?)value!;
return this;
case "interaction":
- Interaction = (List)value;
+ Interaction = (List?)value!;
return this;
case "searchParam":
- SearchParam = (List)value;
+ SearchParam = (List?)value!;
return this;
case "operation":
- Operation = (List)value;
+ Operation = (List?)value!;
return this;
case "compartment":
- CompartmentElement = (List)value;
+ CompartmentElement = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -1051,14 +1021,14 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement);
- if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement);
- if (Security is not null) yield return new KeyValuePair("security",Security);
- if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource);
- if (Interaction?.Any() == true) yield return new KeyValuePair("interaction",Interaction);
- if (SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",SearchParam);
- if (Operation?.Any() == true) yield return new KeyValuePair("operation",Operation);
- if (CompartmentElement?.Any() == true) yield return new KeyValuePair("compartment",CompartmentElement);
+ if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement);
+ if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement);
+ if (_Security is not null) yield return new KeyValuePair("security",_Security);
+ if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource);
+ if (_Interaction?.Any() == true) yield return new KeyValuePair("interaction",_Interaction);
+ if (_SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",_SearchParam);
+ if (_Operation?.Any() == true) yield return new KeyValuePair("operation",_Operation);
+ if (_CompartmentElement?.Any() == true) yield return new KeyValuePair("compartment",_CompartmentElement);
}
}
@@ -1084,13 +1054,13 @@ public partial class SecurityComponent : Hl7.Fhir.Model.BackboneElement
///
[FhirElement("cors", InSummary=true, Order=40)]
[DataMember]
- public Hl7.Fhir.Model.FhirBoolean CorsElement
+ public Hl7.Fhir.Model.FhirBoolean? CorsElement
{
get { return _CorsElement; }
set { _CorsElement = value; OnPropertyChanged("CorsElement"); }
}
- private Hl7.Fhir.Model.FhirBoolean _CorsElement;
+ private Hl7.Fhir.Model.FhirBoolean? _CorsElement;
///
/// Adds CORS Headers (http://enable-cors.org/)
@@ -1099,13 +1069,10 @@ public Hl7.Fhir.Model.FhirBoolean CorsElement
[IgnoreDataMember]
public bool? Cors
{
- get { return CorsElement != null ? CorsElement.Value : null; }
+ get => _CorsElement?.Value;
set
{
- if (value == null)
- CorsElement = null;
- else
- CorsElement = new Hl7.Fhir.Model.FhirBoolean(value);
+ CorsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value);
OnPropertyChanged("Cors");
}
}
@@ -1119,56 +1086,49 @@ public bool? Cors
[DataMember]
public List Service
{
- get { if(_Service==null) _Service = new List(); return _Service; }
+ get => _Service ??= [];
set { _Service = value; OnPropertyChanged("Service"); }
}
- private List _Service;
+ private List? _Service;
///
/// General description of how security works.
///
[FhirElement("description", Order=60)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DescriptionElement
+ public Hl7.Fhir.Model.Markdown? DescriptionElement
{
get { return _DescriptionElement; }
set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); }
}
- private Hl7.Fhir.Model.Markdown _DescriptionElement;
+ private Hl7.Fhir.Model.Markdown? _DescriptionElement;
///
/// General description of how security works
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Description
+ public string? Description
{
- get { return DescriptionElement != null ? DescriptionElement.Value : null; }
+ get => _DescriptionElement?.Value;
set
{
- if (value == null)
- DescriptionElement = null;
- else
- DescriptionElement = new Hl7.Fhir.Model.Markdown(value);
+ DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Description");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as SecurityComponent;
-
- if (dest == null)
- {
+ if(other is not SecurityComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(CorsElement != null) dest.CorsElement = (Hl7.Fhir.Model.FhirBoolean)CorsElement.DeepCopyInternal();
- if(Service.Any()) dest.Service = new List(Service.DeepCopyInternal());
- if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal();
+ if(_CorsElement is not null) dest.CorsElement = (Hl7.Fhir.Model.FhirBoolean)_CorsElement.DeepCopyInternal();
+ if(_Service is not null) dest.Service = new List(_Service.DeepCopyInternal());
+ if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -1180,48 +1140,49 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as SecurityComponent;
- if(otherT == null) return false;
+ if(other is not SecurityComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(CorsElement, otherT.CorsElement)) return false;
- if(!comparer.ListEquals(Service, otherT.Service)) return false;
- if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false;
+ if(!comparer.ListEquals(_Service, otherT._Service)) return false;
+ if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "cors":
- value = CorsElement;
- return CorsElement is not null;
+ value = _CorsElement;
+ return _CorsElement is not null;
case "service":
- value = Service;
- return Service?.Any() == true;
+ value = _Service;
+ return _Service?.Any() == true;
case "description":
- value = DescriptionElement;
- return DescriptionElement is not null;
+ value = _DescriptionElement;
+ return _DescriptionElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "cors":
- CorsElement = (Hl7.Fhir.Model.FhirBoolean)value;
+ CorsElement = (Hl7.Fhir.Model.FhirBoolean?)value;
return this;
case "service":
- Service = (List)value;
+ Service = (List?)value!;
return this;
case "description":
- DescriptionElement = (Hl7.Fhir.Model.Markdown)value;
+ DescriptionElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
default:
return base.SetValue(key, value);
@@ -1232,9 +1193,9 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (CorsElement is not null) yield return new KeyValuePair("cors",CorsElement);
- if (Service?.Any() == true) yield return new KeyValuePair("service",Service);
- if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement);
+ if (_CorsElement is not null) yield return new KeyValuePair("cors",_CorsElement);
+ if (_Service?.Any() == true) yield return new KeyValuePair("service",_Service);
+ if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement);
}
}
@@ -1263,28 +1224,25 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement
[Binding("ResourceType")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.Code TypeElement
+ public Hl7.Fhir.Model.Code? TypeElement
{
get { return _TypeElement; }
set { _TypeElement = value; OnPropertyChanged("TypeElement"); }
}
- private Hl7.Fhir.Model.Code _TypeElement;
+ private Hl7.Fhir.Model.Code? _TypeElement;
///
/// A resource type that is supported
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Type
+ public string? Type
{
- get { return TypeElement != null ? TypeElement.Value : null; }
+ get => _TypeElement?.Value;
set
{
- if (value == null)
- TypeElement = null;
- else
- TypeElement = new Hl7.Fhir.Model.Code(value);
+ TypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value);
OnPropertyChanged("Type");
}
}
@@ -1294,28 +1252,25 @@ public string Type
///
[FhirElement("profile", InSummary=true, Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Canonical ProfileElement
+ public Hl7.Fhir.Model.Canonical? ProfileElement
{
get { return _ProfileElement; }
set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); }
}
- private Hl7.Fhir.Model.Canonical _ProfileElement;
+ private Hl7.Fhir.Model.Canonical? _ProfileElement;
///
/// System-wide profile
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Profile
+ public string? Profile
{
- get { return ProfileElement != null ? ProfileElement.Value : null; }
+ get => _ProfileElement?.Value;
set
{
- if (value == null)
- ProfileElement = null;
- else
- ProfileElement = new Hl7.Fhir.Model.Canonical(value);
+ ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value);
OnPropertyChanged("Profile");
}
}
@@ -1328,24 +1283,24 @@ public string Profile
[DataMember]
public List SupportedProfileElement
{
- get { if(_SupportedProfileElement==null) _SupportedProfileElement = new List(); return _SupportedProfileElement; }
+ get => _SupportedProfileElement ??= [];
set { _SupportedProfileElement = value; OnPropertyChanged("SupportedProfileElement"); }
}
- private List _SupportedProfileElement;
+ private List? _SupportedProfileElement;
///
/// Use-case specific profiles
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable SupportedProfile
+ public IEnumerable SupportedProfile
{
- get { return SupportedProfileElement != null ? SupportedProfileElement.Select(elem => elem.Value) : null; }
+ get => _SupportedProfileElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- SupportedProfileElement = null;
+ SupportedProfileElement = null!;
else
SupportedProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem)));
OnPropertyChanged("SupportedProfile");
@@ -1357,28 +1312,25 @@ public IEnumerable SupportedProfile
///
[FhirElement("documentation", Order=70)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DocumentationElement
+ public Hl7.Fhir.Model.Markdown? DocumentationElement
{
get { return _DocumentationElement; }
set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); }
}
- private Hl7.Fhir.Model.Markdown _DocumentationElement;
+ private Hl7.Fhir.Model.Markdown? _DocumentationElement;
///
/// Additional information about the use of the resource type
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Documentation
+ public string? Documentation
{
- get { return DocumentationElement != null ? DocumentationElement.Value : null; }
+ get => _DocumentationElement?.Value;
set
{
- if (value == null)
- DocumentationElement = null;
- else
- DocumentationElement = new Hl7.Fhir.Model.Markdown(value);
+ DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Documentation");
}
}
@@ -1391,11 +1343,11 @@ public string Documentation
[DataMember]
public List Interaction
{
- get { if(_Interaction==null) _Interaction = new List(); return _Interaction; }
+ get => _Interaction ??= [];
set { _Interaction = value; OnPropertyChanged("Interaction"); }
}
- private List _Interaction;
+ private List? _Interaction;
///
/// no-version | versioned | versioned-update.
@@ -1404,13 +1356,13 @@ public List Int
[DeclaredType(Type = typeof(Code))]
[Binding("ResourceVersionPolicy")]
[DataMember]
- public Code VersioningElement
+ public Code? VersioningElement
{
get { return _VersioningElement; }
set { _VersioningElement = value; OnPropertyChanged("VersioningElement"); }
}
- private Code _VersioningElement;
+ private Code? _VersioningElement;
///
/// no-version | versioned | versioned-update
@@ -1419,13 +1371,10 @@ public Code Versioning
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatement.ResourceVersionPolicy? Versioning
{
- get { return VersioningElement != null ? VersioningElement.Value : null; }
+ get => _VersioningElement?.Value;
set
{
- if (value == null)
- VersioningElement = null;
- else
- VersioningElement = new Code(value);
+ VersioningElement = value is null ? null : new Code(value);
OnPropertyChanged("Versioning");
}
}
@@ -1435,13 +1384,13 @@ public Hl7.Fhir.Model.CapabilityStatement.ResourceVersionPolicy? Versioning
///
[FhirElement("readHistory", Order=100)]
[DataMember]
- public Hl7.Fhir.Model.FhirBoolean ReadHistoryElement
+ public Hl7.Fhir.Model.FhirBoolean? ReadHistoryElement
{
get { return _ReadHistoryElement; }
set { _ReadHistoryElement = value; OnPropertyChanged("ReadHistoryElement"); }
}
- private Hl7.Fhir.Model.FhirBoolean _ReadHistoryElement;
+ private Hl7.Fhir.Model.FhirBoolean? _ReadHistoryElement;
///
/// Whether vRead can return past versions
@@ -1450,13 +1399,10 @@ public Hl7.Fhir.Model.FhirBoolean ReadHistoryElement
[IgnoreDataMember]
public bool? ReadHistory
{
- get { return ReadHistoryElement != null ? ReadHistoryElement.Value : null; }
+ get => _ReadHistoryElement?.Value;
set
{
- if (value == null)
- ReadHistoryElement = null;
- else
- ReadHistoryElement = new Hl7.Fhir.Model.FhirBoolean(value);
+ ReadHistoryElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value);
OnPropertyChanged("ReadHistory");
}
}
@@ -1466,13 +1412,13 @@ public bool? ReadHistory
///
[FhirElement("updateCreate", Order=110)]
[DataMember]
- public Hl7.Fhir.Model.FhirBoolean UpdateCreateElement
+ public Hl7.Fhir.Model.FhirBoolean? UpdateCreateElement
{
get { return _UpdateCreateElement; }
set { _UpdateCreateElement = value; OnPropertyChanged("UpdateCreateElement"); }
}
- private Hl7.Fhir.Model.FhirBoolean _UpdateCreateElement;
+ private Hl7.Fhir.Model.FhirBoolean? _UpdateCreateElement;
///
/// If update can commit to a new identity
@@ -1481,13 +1427,10 @@ public Hl7.Fhir.Model.FhirBoolean UpdateCreateElement
[IgnoreDataMember]
public bool? UpdateCreate
{
- get { return UpdateCreateElement != null ? UpdateCreateElement.Value : null; }
+ get => _UpdateCreateElement?.Value;
set
{
- if (value == null)
- UpdateCreateElement = null;
- else
- UpdateCreateElement = new Hl7.Fhir.Model.FhirBoolean(value);
+ UpdateCreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value);
OnPropertyChanged("UpdateCreate");
}
}
@@ -1497,13 +1440,13 @@ public bool? UpdateCreate
///
[FhirElement("conditionalCreate", Order=120)]
[DataMember]
- public Hl7.Fhir.Model.FhirBoolean ConditionalCreateElement
+ public Hl7.Fhir.Model.FhirBoolean? ConditionalCreateElement
{
get { return _ConditionalCreateElement; }
set { _ConditionalCreateElement = value; OnPropertyChanged("ConditionalCreateElement"); }
}
- private Hl7.Fhir.Model.FhirBoolean _ConditionalCreateElement;
+ private Hl7.Fhir.Model.FhirBoolean? _ConditionalCreateElement;
///
/// If allows/uses conditional create
@@ -1512,13 +1455,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalCreateElement
[IgnoreDataMember]
public bool? ConditionalCreate
{
- get { return ConditionalCreateElement != null ? ConditionalCreateElement.Value : null; }
+ get => _ConditionalCreateElement?.Value;
set
{
- if (value == null)
- ConditionalCreateElement = null;
- else
- ConditionalCreateElement = new Hl7.Fhir.Model.FhirBoolean(value);
+ ConditionalCreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value);
OnPropertyChanged("ConditionalCreate");
}
}
@@ -1530,13 +1470,13 @@ public bool? ConditionalCreate
[DeclaredType(Type = typeof(Code))]
[Binding("ConditionalReadStatus")]
[DataMember]
- public Code ConditionalReadElement
+ public Code? ConditionalReadElement
{
get { return _ConditionalReadElement; }
set { _ConditionalReadElement = value; OnPropertyChanged("ConditionalReadElement"); }
}
- private Code _ConditionalReadElement;
+ private Code? _ConditionalReadElement;
///
/// not-supported | modified-since | not-match | full-support
@@ -1545,13 +1485,10 @@ public Code Conditiona
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatement.ConditionalReadStatus? ConditionalRead
{
- get { return ConditionalReadElement != null ? ConditionalReadElement.Value : null; }
+ get => _ConditionalReadElement?.Value;
set
{
- if (value == null)
- ConditionalReadElement = null;
- else
- ConditionalReadElement = new Code(value);
+ ConditionalReadElement = value is null ? null : new Code(value);
OnPropertyChanged("ConditionalRead");
}
}
@@ -1561,13 +1498,13 @@ public Hl7.Fhir.Model.CapabilityStatement.ConditionalReadStatus? ConditionalRead
///
[FhirElement("conditionalUpdate", Order=140)]
[DataMember]
- public Hl7.Fhir.Model.FhirBoolean ConditionalUpdateElement
+ public Hl7.Fhir.Model.FhirBoolean? ConditionalUpdateElement
{
get { return _ConditionalUpdateElement; }
set { _ConditionalUpdateElement = value; OnPropertyChanged("ConditionalUpdateElement"); }
}
- private Hl7.Fhir.Model.FhirBoolean _ConditionalUpdateElement;
+ private Hl7.Fhir.Model.FhirBoolean? _ConditionalUpdateElement;
///
/// If allows/uses conditional update
@@ -1576,13 +1513,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalUpdateElement
[IgnoreDataMember]
public bool? ConditionalUpdate
{
- get { return ConditionalUpdateElement != null ? ConditionalUpdateElement.Value : null; }
+ get => _ConditionalUpdateElement?.Value;
set
{
- if (value == null)
- ConditionalUpdateElement = null;
- else
- ConditionalUpdateElement = new Hl7.Fhir.Model.FhirBoolean(value);
+ ConditionalUpdateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value);
OnPropertyChanged("ConditionalUpdate");
}
}
@@ -1595,13 +1529,13 @@ public bool? ConditionalUpdate
///
[FhirElement("conditionalPatch", Order=150, Since=FhirRelease.R5)]
[DataMember]
- public Hl7.Fhir.Model.FhirBoolean ConditionalPatchElement
+ public Hl7.Fhir.Model.FhirBoolean? ConditionalPatchElement
{
get { return _ConditionalPatchElement; }
set { _ConditionalPatchElement = value; OnPropertyChanged("ConditionalPatchElement"); }
}
- private Hl7.Fhir.Model.FhirBoolean _ConditionalPatchElement;
+ private Hl7.Fhir.Model.FhirBoolean? _ConditionalPatchElement;
///
/// If allows/uses conditional patch
@@ -1610,13 +1544,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalPatchElement
[IgnoreDataMember]
public bool? ConditionalPatch
{
- get { return ConditionalPatchElement != null ? ConditionalPatchElement.Value : null; }
+ get => _ConditionalPatchElement?.Value;
set
{
- if (value == null)
- ConditionalPatchElement = null;
- else
- ConditionalPatchElement = new Hl7.Fhir.Model.FhirBoolean(value);
+ ConditionalPatchElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value);
OnPropertyChanged("ConditionalPatch");
}
}
@@ -1628,13 +1559,13 @@ public bool? ConditionalPatch
[DeclaredType(Type = typeof(Code))]
[Binding("ConditionalDeleteStatus")]
[DataMember]
- public Code ConditionalDeleteElement
+ public Code? ConditionalDeleteElement
{
get { return _ConditionalDeleteElement; }
set { _ConditionalDeleteElement = value; OnPropertyChanged("ConditionalDeleteElement"); }
}
- private Code _ConditionalDeleteElement;
+ private Code? _ConditionalDeleteElement;
///
/// not-supported | single | multiple - how conditional delete is supported
@@ -1643,13 +1574,10 @@ public Code Conditio
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatement.ConditionalDeleteStatus? ConditionalDelete
{
- get { return ConditionalDeleteElement != null ? ConditionalDeleteElement.Value : null; }
+ get => _ConditionalDeleteElement?.Value;
set
{
- if (value == null)
- ConditionalDeleteElement = null;
- else
- ConditionalDeleteElement = new Code(value);
+ ConditionalDeleteElement = value is null ? null : new Code(value);
OnPropertyChanged("ConditionalDelete");
}
}
@@ -1664,11 +1592,11 @@ public Hl7.Fhir.Model.CapabilityStatement.ConditionalDeleteStatus? ConditionalDe
[DataMember]
public List> ReferencePolicyElement
{
- get { if(_ReferencePolicyElement==null) _ReferencePolicyElement = new List>(); return _ReferencePolicyElement; }
+ get => _ReferencePolicyElement ??= [];
set { _ReferencePolicyElement = value; OnPropertyChanged("ReferencePolicyElement"); }
}
- private List> _ReferencePolicyElement;
+ private List>? _ReferencePolicyElement;
///
/// literal | logical | resolves | enforced | local
@@ -1677,11 +1605,11 @@ public List> Re
[IgnoreDataMember]
public IEnumerable ReferencePolicy
{
- get { return ReferencePolicyElement != null ? ReferencePolicyElement.Select(elem => elem.Value) : null; }
+ get => _ReferencePolicyElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- ReferencePolicyElement = null;
+ ReferencePolicyElement = null!;
else
ReferencePolicyElement = new List>(value.Select(elem=>new Code(elem)));
OnPropertyChanged("ReferencePolicy");
@@ -1696,24 +1624,24 @@ public IEnumerable
[DataMember]
public List SearchIncludeElement
{
- get { if(_SearchIncludeElement==null) _SearchIncludeElement = new List(); return _SearchIncludeElement; }
+ get => _SearchIncludeElement ??= [];
set { _SearchIncludeElement = value; OnPropertyChanged("SearchIncludeElement"); }
}
- private List _SearchIncludeElement;
+ private List? _SearchIncludeElement;
///
/// _include values supported by the server
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable SearchInclude
+ public IEnumerable SearchInclude
{
- get { return SearchIncludeElement != null ? SearchIncludeElement.Select(elem => elem.Value) : null; }
+ get => _SearchIncludeElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- SearchIncludeElement = null;
+ SearchIncludeElement = null!;
else
SearchIncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem)));
OnPropertyChanged("SearchInclude");
@@ -1728,24 +1656,24 @@ public IEnumerable SearchInclude
[DataMember]
public List SearchRevIncludeElement
{
- get { if(_SearchRevIncludeElement==null) _SearchRevIncludeElement = new List(); return _SearchRevIncludeElement; }
+ get => _SearchRevIncludeElement ??= [];
set { _SearchRevIncludeElement = value; OnPropertyChanged("SearchRevIncludeElement"); }
}
- private List _SearchRevIncludeElement;
+ private List? _SearchRevIncludeElement;
///
/// _revinclude values supported by the server
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable SearchRevInclude
+ public IEnumerable SearchRevInclude
{
- get { return SearchRevIncludeElement != null ? SearchRevIncludeElement.Select(elem => elem.Value) : null; }
+ get => _SearchRevIncludeElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- SearchRevIncludeElement = null;
+ SearchRevIncludeElement = null!;
else
SearchRevIncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem)));
OnPropertyChanged("SearchRevInclude");
@@ -1760,11 +1688,11 @@ public IEnumerable SearchRevInclude
[DataMember]
public List SearchParam
{
- get { if(_SearchParam==null) _SearchParam = new List(); return _SearchParam; }
+ get => _SearchParam ??= [];
set { _SearchParam = value; OnPropertyChanged("SearchParam"); }
}
- private List _SearchParam;
+ private List? _SearchParam;
///
/// Definition of a resource operation.
@@ -1774,40 +1702,36 @@ public List SearchParam
[DataMember]
public List Operation
{
- get { if(_Operation==null) _Operation = new List(); return _Operation; }
+ get => _Operation ??= [];
set { _Operation = value; OnPropertyChanged("Operation"); }
}
- private List _Operation;
+ private List? _Operation;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as ResourceComponent;
-
- if (dest == null)
- {
+ if(other is not ResourceComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.Code)TypeElement.DeepCopyInternal();
- if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal();
- if(SupportedProfileElement.Any()) dest.SupportedProfileElement = new List(SupportedProfileElement.DeepCopyInternal());
- if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal();
- if(Interaction.Any()) dest.Interaction = new List(Interaction.DeepCopyInternal());
- if(VersioningElement != null) dest.VersioningElement = (Code)VersioningElement.DeepCopyInternal();
- if(ReadHistoryElement != null) dest.ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)ReadHistoryElement.DeepCopyInternal();
- if(UpdateCreateElement != null) dest.UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)UpdateCreateElement.DeepCopyInternal();
- if(ConditionalCreateElement != null) dest.ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalCreateElement.DeepCopyInternal();
- if(ConditionalReadElement != null) dest.ConditionalReadElement = (Code)ConditionalReadElement.DeepCopyInternal();
- if(ConditionalUpdateElement != null) dest.ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalUpdateElement.DeepCopyInternal();
- if(ConditionalPatchElement != null) dest.ConditionalPatchElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalPatchElement.DeepCopyInternal();
- if(ConditionalDeleteElement != null) dest.ConditionalDeleteElement = (Code)ConditionalDeleteElement.DeepCopyInternal();
- if(ReferencePolicyElement.Any()) dest.ReferencePolicyElement = new List>(ReferencePolicyElement.DeepCopyInternal());
- if(SearchIncludeElement.Any()) dest.SearchIncludeElement = new List(SearchIncludeElement.DeepCopyInternal());
- if(SearchRevIncludeElement.Any()) dest.SearchRevIncludeElement = new List(SearchRevIncludeElement.DeepCopyInternal());
- if(SearchParam.Any()) dest.SearchParam = new List(SearchParam.DeepCopyInternal());
- if(Operation.Any()) dest.Operation = new List(Operation.DeepCopyInternal());
+ if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.Code)_TypeElement.DeepCopyInternal();
+ if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal();
+ if(_SupportedProfileElement is not null) dest.SupportedProfileElement = new List(_SupportedProfileElement.DeepCopyInternal());
+ if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal();
+ if(_Interaction is not null) dest.Interaction = new List(_Interaction.DeepCopyInternal());
+ if(_VersioningElement is not null) dest.VersioningElement = (Code)_VersioningElement.DeepCopyInternal();
+ if(_ReadHistoryElement is not null) dest.ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)_ReadHistoryElement.DeepCopyInternal();
+ if(_UpdateCreateElement is not null) dest.UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)_UpdateCreateElement.DeepCopyInternal();
+ if(_ConditionalCreateElement is not null) dest.ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalCreateElement.DeepCopyInternal();
+ if(_ConditionalReadElement is not null) dest.ConditionalReadElement = (Code)_ConditionalReadElement.DeepCopyInternal();
+ if(_ConditionalUpdateElement is not null) dest.ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalUpdateElement.DeepCopyInternal();
+ if(_ConditionalPatchElement is not null) dest.ConditionalPatchElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalPatchElement.DeepCopyInternal();
+ if(_ConditionalDeleteElement is not null) dest.ConditionalDeleteElement = (Code)_ConditionalDeleteElement.DeepCopyInternal();
+ if(_ReferencePolicyElement is not null) dest.ReferencePolicyElement = new List>(_ReferencePolicyElement.DeepCopyInternal());
+ if(_SearchIncludeElement is not null) dest.SearchIncludeElement = new List(_SearchIncludeElement.DeepCopyInternal());
+ if(_SearchRevIncludeElement is not null) dest.SearchRevIncludeElement = new List(_SearchRevIncludeElement.DeepCopyInternal());
+ if(_SearchParam is not null) dest.SearchParam = new List(_SearchParam.DeepCopyInternal());
+ if(_Operation is not null) dest.Operation = new List(_Operation.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -1819,153 +1743,154 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as ResourceComponent;
- if(otherT == null) return false;
+ if(other is not ResourceComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false;
- if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false;
- if(!comparer.ListEquals(SupportedProfileElement, otherT.SupportedProfileElement)) return false;
- if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false;
- if(!comparer.ListEquals(Interaction, otherT.Interaction)) return false;
- if(!comparer.Equals(VersioningElement, otherT.VersioningElement)) return false;
- if(!comparer.Equals(ReadHistoryElement, otherT.ReadHistoryElement)) return false;
- if(!comparer.Equals(UpdateCreateElement, otherT.UpdateCreateElement)) return false;
- if(!comparer.Equals(ConditionalCreateElement, otherT.ConditionalCreateElement)) return false;
- if(!comparer.Equals(ConditionalReadElement, otherT.ConditionalReadElement)) return false;
- if(!comparer.Equals(ConditionalUpdateElement, otherT.ConditionalUpdateElement)) return false;
- if(!comparer.Equals(ConditionalPatchElement, otherT.ConditionalPatchElement)) return false;
- if(!comparer.Equals(ConditionalDeleteElement, otherT.ConditionalDeleteElement)) return false;
- if(!comparer.ListEquals(ReferencePolicyElement, otherT.ReferencePolicyElement)) return false;
- if(!comparer.ListEquals(SearchIncludeElement, otherT.SearchIncludeElement)) return false;
- if(!comparer.ListEquals(SearchRevIncludeElement, otherT.SearchRevIncludeElement)) return false;
- if(!comparer.ListEquals(SearchParam, otherT.SearchParam)) return false;
- if(!comparer.ListEquals(Operation, otherT.Operation)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false;
+ if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false;
+ if(!comparer.ListEquals(_SupportedProfileElement, otherT._SupportedProfileElement)) return false;
+ if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false;
+ if(!comparer.ListEquals(_Interaction, otherT._Interaction)) return false;
+ if(!comparer.Equals(_VersioningElement, otherT._VersioningElement)) return false;
+ if(!comparer.Equals(_ReadHistoryElement, otherT._ReadHistoryElement)) return false;
+ if(!comparer.Equals(_UpdateCreateElement, otherT._UpdateCreateElement)) return false;
+ if(!comparer.Equals(_ConditionalCreateElement, otherT._ConditionalCreateElement)) return false;
+ if(!comparer.Equals(_ConditionalReadElement, otherT._ConditionalReadElement)) return false;
+ if(!comparer.Equals(_ConditionalUpdateElement, otherT._ConditionalUpdateElement)) return false;
+ if(!comparer.Equals(_ConditionalPatchElement, otherT._ConditionalPatchElement)) return false;
+ if(!comparer.Equals(_ConditionalDeleteElement, otherT._ConditionalDeleteElement)) return false;
+ if(!comparer.ListEquals(_ReferencePolicyElement, otherT._ReferencePolicyElement)) return false;
+ if(!comparer.ListEquals(_SearchIncludeElement, otherT._SearchIncludeElement)) return false;
+ if(!comparer.ListEquals(_SearchRevIncludeElement, otherT._SearchRevIncludeElement)) return false;
+ if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false;
+ if(!comparer.ListEquals(_Operation, otherT._Operation)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "type":
- value = TypeElement;
- return TypeElement is not null;
+ value = _TypeElement;
+ return _TypeElement is not null;
case "profile":
- value = ProfileElement;
- return ProfileElement is not null;
+ value = _ProfileElement;
+ return _ProfileElement is not null;
case "supportedProfile":
- value = SupportedProfileElement;
- return SupportedProfileElement?.Any() == true;
+ value = _SupportedProfileElement;
+ return _SupportedProfileElement?.Any() == true;
case "documentation":
- value = DocumentationElement;
- return DocumentationElement is not null;
+ value = _DocumentationElement;
+ return _DocumentationElement is not null;
case "interaction":
- value = Interaction;
- return Interaction?.Any() == true;
+ value = _Interaction;
+ return _Interaction?.Any() == true;
case "versioning":
- value = VersioningElement;
- return VersioningElement is not null;
+ value = _VersioningElement;
+ return _VersioningElement is not null;
case "readHistory":
- value = ReadHistoryElement;
- return ReadHistoryElement is not null;
+ value = _ReadHistoryElement;
+ return _ReadHistoryElement is not null;
case "updateCreate":
- value = UpdateCreateElement;
- return UpdateCreateElement is not null;
+ value = _UpdateCreateElement;
+ return _UpdateCreateElement is not null;
case "conditionalCreate":
- value = ConditionalCreateElement;
- return ConditionalCreateElement is not null;
+ value = _ConditionalCreateElement;
+ return _ConditionalCreateElement is not null;
case "conditionalRead":
- value = ConditionalReadElement;
- return ConditionalReadElement is not null;
+ value = _ConditionalReadElement;
+ return _ConditionalReadElement is not null;
case "conditionalUpdate":
- value = ConditionalUpdateElement;
- return ConditionalUpdateElement is not null;
+ value = _ConditionalUpdateElement;
+ return _ConditionalUpdateElement is not null;
case "conditionalPatch":
- value = ConditionalPatchElement;
- return ConditionalPatchElement is not null;
+ value = _ConditionalPatchElement;
+ return _ConditionalPatchElement is not null;
case "conditionalDelete":
- value = ConditionalDeleteElement;
- return ConditionalDeleteElement is not null;
+ value = _ConditionalDeleteElement;
+ return _ConditionalDeleteElement is not null;
case "referencePolicy":
- value = ReferencePolicyElement;
- return ReferencePolicyElement?.Any() == true;
+ value = _ReferencePolicyElement;
+ return _ReferencePolicyElement?.Any() == true;
case "searchInclude":
- value = SearchIncludeElement;
- return SearchIncludeElement?.Any() == true;
+ value = _SearchIncludeElement;
+ return _SearchIncludeElement?.Any() == true;
case "searchRevInclude":
- value = SearchRevIncludeElement;
- return SearchRevIncludeElement?.Any() == true;
+ value = _SearchRevIncludeElement;
+ return _SearchRevIncludeElement?.Any() == true;
case "searchParam":
- value = SearchParam;
- return SearchParam?.Any() == true;
+ value = _SearchParam;
+ return _SearchParam?.Any() == true;
case "operation":
- value = Operation;
- return Operation?.Any() == true;
+ value = _Operation;
+ return _Operation?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "type":
- TypeElement = (Hl7.Fhir.Model.Code)value;
+ TypeElement = (Hl7.Fhir.Model.Code?)value;
return this;
case "profile":
- ProfileElement = (Hl7.Fhir.Model.Canonical)value;
+ ProfileElement = (Hl7.Fhir.Model.Canonical?)value;
return this;
case "supportedProfile":
- SupportedProfileElement = (List)value;
+ SupportedProfileElement = (List?)value!;
return this;
case "documentation":
- DocumentationElement = (Hl7.Fhir.Model.Markdown)value;
+ DocumentationElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
case "interaction":
- Interaction = (List)value;
+ Interaction = (List?)value!;
return this;
case "versioning":
- VersioningElement = (Code)value;
+ VersioningElement = (Code?)value;
return this;
case "readHistory":
- ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)value;
+ ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean?)value;
return this;
case "updateCreate":
- UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)value;
+ UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean?)value;
return this;
case "conditionalCreate":
- ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)value;
+ ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean?)value;
return this;
case "conditionalRead":
- ConditionalReadElement = (Code)value;
+ ConditionalReadElement = (Code?)value;
return this;
case "conditionalUpdate":
- ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)value;
+ ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean?)value;
return this;
case "conditionalPatch":
- ConditionalPatchElement = (Hl7.Fhir.Model.FhirBoolean)value;
+ ConditionalPatchElement = (Hl7.Fhir.Model.FhirBoolean?)value;
return this;
case "conditionalDelete":
- ConditionalDeleteElement = (Code)value;
+ ConditionalDeleteElement = (Code?)value;
return this;
case "referencePolicy":
- ReferencePolicyElement = (List>)value;
+ ReferencePolicyElement = (List>?)value!;
return this;
case "searchInclude":
- SearchIncludeElement = (List)value;
+ SearchIncludeElement = (List?)value!;
return this;
case "searchRevInclude":
- SearchRevIncludeElement = (List)value;
+ SearchRevIncludeElement = (List?)value!;
return this;
case "searchParam":
- SearchParam = (List)value;
+ SearchParam = (List?)value!;
return this;
case "operation":
- Operation = (List)value;
+ Operation = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -1976,24 +1901,24 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement);
- if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement);
- if (SupportedProfileElement?.Any() == true) yield return new KeyValuePair("supportedProfile",SupportedProfileElement);
- if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement);
- if (Interaction?.Any() == true) yield return new KeyValuePair("interaction",Interaction);
- if (VersioningElement is not null) yield return new KeyValuePair("versioning",VersioningElement);
- if (ReadHistoryElement is not null) yield return new KeyValuePair("readHistory",ReadHistoryElement);
- if (UpdateCreateElement is not null) yield return new KeyValuePair("updateCreate",UpdateCreateElement);
- if (ConditionalCreateElement is not null) yield return new KeyValuePair("conditionalCreate",ConditionalCreateElement);
- if (ConditionalReadElement is not null) yield return new KeyValuePair("conditionalRead",ConditionalReadElement);
- if (ConditionalUpdateElement is not null) yield return new KeyValuePair("conditionalUpdate",ConditionalUpdateElement);
- if (ConditionalPatchElement is not null) yield return new KeyValuePair("conditionalPatch",ConditionalPatchElement);
- if (ConditionalDeleteElement is not null) yield return new KeyValuePair("conditionalDelete",ConditionalDeleteElement);
- if (ReferencePolicyElement?.Any() == true) yield return new KeyValuePair("referencePolicy",ReferencePolicyElement);
- if (SearchIncludeElement?.Any() == true) yield return new KeyValuePair("searchInclude",SearchIncludeElement);
- if (SearchRevIncludeElement?.Any() == true) yield return new KeyValuePair("searchRevInclude",SearchRevIncludeElement);
- if (SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",SearchParam);
- if (Operation?.Any() == true) yield return new KeyValuePair("operation",Operation);
+ if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement);
+ if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement);
+ if (_SupportedProfileElement?.Any() == true) yield return new KeyValuePair("supportedProfile",_SupportedProfileElement);
+ if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement);
+ if (_Interaction?.Any() == true) yield return new KeyValuePair("interaction",_Interaction);
+ if (_VersioningElement is not null) yield return new KeyValuePair("versioning",_VersioningElement);
+ if (_ReadHistoryElement is not null) yield return new KeyValuePair("readHistory",_ReadHistoryElement);
+ if (_UpdateCreateElement is not null) yield return new KeyValuePair("updateCreate",_UpdateCreateElement);
+ if (_ConditionalCreateElement is not null) yield return new KeyValuePair("conditionalCreate",_ConditionalCreateElement);
+ if (_ConditionalReadElement is not null) yield return new KeyValuePair("conditionalRead",_ConditionalReadElement);
+ if (_ConditionalUpdateElement is not null) yield return new KeyValuePair("conditionalUpdate",_ConditionalUpdateElement);
+ if (_ConditionalPatchElement is not null) yield return new KeyValuePair("conditionalPatch",_ConditionalPatchElement);
+ if (_ConditionalDeleteElement is not null) yield return new KeyValuePair("conditionalDelete",_ConditionalDeleteElement);
+ if (_ReferencePolicyElement?.Any() == true) yield return new KeyValuePair("referencePolicy",_ReferencePolicyElement);
+ if (_SearchIncludeElement?.Any() == true) yield return new KeyValuePair("searchInclude",_SearchIncludeElement);
+ if (_SearchRevIncludeElement?.Any() == true) yield return new KeyValuePair("searchRevInclude",_SearchRevIncludeElement);
+ if (_SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",_SearchParam);
+ if (_Operation?.Any() == true) yield return new KeyValuePair("operation",_Operation);
}
}
@@ -2023,13 +1948,13 @@ public partial class ResourceInteractionComponent : Hl7.Fhir.Model.BackboneEleme
[Binding("TypeRestfulInteraction")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code CodeElement
+ public Code? CodeElement
{
get { return _CodeElement; }
set { _CodeElement = value; OnPropertyChanged("CodeElement"); }
}
- private Code _CodeElement;
+ private Code? _CodeElement;
///
/// read | vread | update | patch | delete | history-instance | history-type | create | search-type
@@ -2038,13 +1963,10 @@ public Code CodeEleme
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatement.TypeRestfulInteraction? Code
{
- get { return CodeElement != null ? CodeElement.Value : null; }
+ get => _CodeElement?.Value;
set
{
- if (value == null)
- CodeElement = null;
- else
- CodeElement = new Code(value);
+ CodeElement = value is null ? null : new Code(value);
OnPropertyChanged("Code");
}
}
@@ -2054,44 +1976,37 @@ public Hl7.Fhir.Model.CapabilityStatement.TypeRestfulInteraction? Code
///
[FhirElement("documentation", Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DocumentationElement
+ public Hl7.Fhir.Model.Markdown? DocumentationElement
{
get { return _DocumentationElement; }
set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); }
}
- private Hl7.Fhir.Model.Markdown _DocumentationElement;
+ private Hl7.Fhir.Model.Markdown? _DocumentationElement;
///
/// Anything special about operation behavior
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Documentation
+ public string? Documentation
{
- get { return DocumentationElement != null ? DocumentationElement.Value : null; }
+ get => _DocumentationElement?.Value;
set
{
- if (value == null)
- DocumentationElement = null;
- else
- DocumentationElement = new Hl7.Fhir.Model.Markdown(value);
+ DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Documentation");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as ResourceInteractionComponent;
-
- if (dest == null)
- {
+ if(other is not ResourceInteractionComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal();
- if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal();
+ if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal();
+ if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -2103,41 +2018,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as ResourceInteractionComponent;
- if(otherT == null) return false;
+ if(other is not ResourceInteractionComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false;
- if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false;
+ if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "code":
- value = CodeElement;
- return CodeElement is not null;
+ value = _CodeElement;
+ return _CodeElement is not null;
case "documentation":
- value = DocumentationElement;
- return DocumentationElement is not null;
+ value = _DocumentationElement;
+ return _DocumentationElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "code":
- CodeElement = (Code)value;
+ CodeElement = (Code?)value;
return this;
case "documentation":
- DocumentationElement = (Hl7.Fhir.Model.Markdown)value;
+ DocumentationElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
default:
return base.SetValue(key, value);
@@ -2148,8 +2064,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement);
- if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement);
+ if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement);
+ if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement);
}
}
@@ -2177,28 +2093,25 @@ public partial class SearchParamComponent : Hl7.Fhir.Model.BackboneElement
[FhirElement("name", Order=40)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirString NameElement
+ public Hl7.Fhir.Model.FhirString? NameElement
{
get { return _NameElement; }
set { _NameElement = value; OnPropertyChanged("NameElement"); }
}
- private Hl7.Fhir.Model.FhirString _NameElement;
+ private Hl7.Fhir.Model.FhirString? _NameElement;
///
/// Name for parameter in search url
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Name
+ public string? Name
{
- get { return NameElement != null ? NameElement.Value : null; }
+ get => _NameElement?.Value;
set
{
- if (value == null)
- NameElement = null;
- else
- NameElement = new Hl7.Fhir.Model.FhirString(value);
+ NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Name");
}
}
@@ -2208,28 +2121,25 @@ public string Name
///
[FhirElement("definition", Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Canonical DefinitionElement
+ public Hl7.Fhir.Model.Canonical? DefinitionElement
{
get { return _DefinitionElement; }
set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); }
}
- private Hl7.Fhir.Model.Canonical _DefinitionElement;
+ private Hl7.Fhir.Model.Canonical? _DefinitionElement;
///
/// Source of definition for parameter
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Definition
+ public string? Definition
{
- get { return DefinitionElement != null ? DefinitionElement.Value : null; }
+ get => _DefinitionElement?.Value;
set
{
- if (value == null)
- DefinitionElement = null;
- else
- DefinitionElement = new Hl7.Fhir.Model.Canonical(value);
+ DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value);
OnPropertyChanged("Definition");
}
}
@@ -2242,13 +2152,13 @@ public string Definition
[Binding("SearchParamType")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code TypeElement
+ public Code? TypeElement
{
get { return _TypeElement; }
set { _TypeElement = value; OnPropertyChanged("TypeElement"); }
}
- private Code _TypeElement;
+ private Code? _TypeElement;
///
/// number | date | string | token | reference | composite | quantity | uri | special
@@ -2257,13 +2167,10 @@ public Code TypeElement
[IgnoreDataMember]
public Hl7.Fhir.Model.SearchParamType? Type
{
- get { return TypeElement != null ? TypeElement.Value : null; }
+ get => _TypeElement?.Value;
set
{
- if (value == null)
- TypeElement = null;
- else
- TypeElement = new Code(value);
+ TypeElement = value is null ? null : new Code(value);
OnPropertyChanged("Type");
}
}
@@ -2273,46 +2180,39 @@ public Hl7.Fhir.Model.SearchParamType? Type
///
[FhirElement("documentation", Order=70)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DocumentationElement
+ public Hl7.Fhir.Model.Markdown? DocumentationElement
{
get { return _DocumentationElement; }
set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); }
}
- private Hl7.Fhir.Model.Markdown _DocumentationElement;
+ private Hl7.Fhir.Model.Markdown? _DocumentationElement;
///
/// Server-specific usage
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Documentation
+ public string? Documentation
{
- get { return DocumentationElement != null ? DocumentationElement.Value : null; }
+ get => _DocumentationElement?.Value;
set
{
- if (value == null)
- DocumentationElement = null;
- else
- DocumentationElement = new Hl7.Fhir.Model.Markdown(value);
+ DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Documentation");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as SearchParamComponent;
-
- if (dest == null)
- {
+ if(other is not SearchParamComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal();
- if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal();
- if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal();
- if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal();
+ if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal();
+ if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal();
+ if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal();
+ if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -2324,55 +2224,56 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as SearchParamComponent;
- if(otherT == null) return false;
+ if(other is not SearchParamComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(NameElement, otherT.NameElement)) return false;
- if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false;
- if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false;
- if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_NameElement, otherT._NameElement)) return false;
+ if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false;
+ if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false;
+ if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "name":
- value = NameElement;
- return NameElement is not null;
+ value = _NameElement;
+ return _NameElement is not null;
case "definition":
- value = DefinitionElement;
- return DefinitionElement is not null;
+ value = _DefinitionElement;
+ return _DefinitionElement is not null;
case "type":
- value = TypeElement;
- return TypeElement is not null;
+ value = _TypeElement;
+ return _TypeElement is not null;
case "documentation":
- value = DocumentationElement;
- return DocumentationElement is not null;
+ value = _DocumentationElement;
+ return _DocumentationElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "name":
- NameElement = (Hl7.Fhir.Model.FhirString)value;
+ NameElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "definition":
- DefinitionElement = (Hl7.Fhir.Model.Canonical)value;
+ DefinitionElement = (Hl7.Fhir.Model.Canonical?)value;
return this;
case "type":
- TypeElement = (Code)value;
+ TypeElement = (Code?)value;
return this;
case "documentation":
- DocumentationElement = (Hl7.Fhir.Model.Markdown)value;
+ DocumentationElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
default:
return base.SetValue(key, value);
@@ -2383,10 +2284,10 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (NameElement is not null) yield return new KeyValuePair("name",NameElement);
- if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement);
- if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement);
- if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement);
+ if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement);
+ if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement);
+ if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement);
+ if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement);
}
}
@@ -2415,28 +2316,25 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement
[FhirElement("name", InSummary=true, Order=40)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirString NameElement
+ public Hl7.Fhir.Model.FhirString? NameElement
{
get { return _NameElement; }
set { _NameElement = value; OnPropertyChanged("NameElement"); }
}
- private Hl7.Fhir.Model.FhirString _NameElement;
+ private Hl7.Fhir.Model.FhirString? _NameElement;
///
/// Name by which the operation/query is invoked
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Name
+ public string? Name
{
- get { return NameElement != null ? NameElement.Value : null; }
+ get => _NameElement?.Value;
set
{
- if (value == null)
- NameElement = null;
- else
- NameElement = new Hl7.Fhir.Model.FhirString(value);
+ NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Name");
}
}
@@ -2447,28 +2345,25 @@ public string Name
[FhirElement("definition", InSummary=true, Order=50)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.Canonical DefinitionElement
+ public Hl7.Fhir.Model.Canonical? DefinitionElement
{
get { return _DefinitionElement; }
set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); }
}
- private Hl7.Fhir.Model.Canonical _DefinitionElement;
+ private Hl7.Fhir.Model.Canonical? _DefinitionElement;
///
/// The defined operation/query
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Definition
+ public string? Definition
{
- get { return DefinitionElement != null ? DefinitionElement.Value : null; }
+ get => _DefinitionElement?.Value;
set
{
- if (value == null)
- DefinitionElement = null;
- else
- DefinitionElement = new Hl7.Fhir.Model.Canonical(value);
+ DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value);
OnPropertyChanged("Definition");
}
}
@@ -2478,45 +2373,38 @@ public string Definition
///
[FhirElement("documentation", Order=60)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DocumentationElement
+ public Hl7.Fhir.Model.Markdown? DocumentationElement
{
get { return _DocumentationElement; }
set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); }
}
- private Hl7.Fhir.Model.Markdown _DocumentationElement;
+ private Hl7.Fhir.Model.Markdown? _DocumentationElement;
///
/// Specific details about operation behavior
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Documentation
+ public string? Documentation
{
- get { return DocumentationElement != null ? DocumentationElement.Value : null; }
+ get => _DocumentationElement?.Value;
set
{
- if (value == null)
- DocumentationElement = null;
- else
- DocumentationElement = new Hl7.Fhir.Model.Markdown(value);
+ DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Documentation");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as OperationComponent;
-
- if (dest == null)
- {
+ if(other is not OperationComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal();
- if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal();
- if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal();
+ if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal();
+ if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal();
+ if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -2528,48 +2416,49 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as OperationComponent;
- if(otherT == null) return false;
+ if(other is not OperationComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(NameElement, otherT.NameElement)) return false;
- if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false;
- if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_NameElement, otherT._NameElement)) return false;
+ if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false;
+ if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "name":
- value = NameElement;
- return NameElement is not null;
+ value = _NameElement;
+ return _NameElement is not null;
case "definition":
- value = DefinitionElement;
- return DefinitionElement is not null;
+ value = _DefinitionElement;
+ return _DefinitionElement is not null;
case "documentation":
- value = DocumentationElement;
- return DocumentationElement is not null;
+ value = _DocumentationElement;
+ return _DocumentationElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "name":
- NameElement = (Hl7.Fhir.Model.FhirString)value;
+ NameElement = (Hl7.Fhir.Model.FhirString?)value;
return this;
case "definition":
- DefinitionElement = (Hl7.Fhir.Model.Canonical)value;
+ DefinitionElement = (Hl7.Fhir.Model.Canonical?)value;
return this;
case "documentation":
- DocumentationElement = (Hl7.Fhir.Model.Markdown)value;
+ DocumentationElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
default:
return base.SetValue(key, value);
@@ -2580,9 +2469,9 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (NameElement is not null) yield return new KeyValuePair("name",NameElement);
- if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement);
- if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement);
+ if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement);
+ if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement);
+ if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement);
}
}
@@ -2611,13 +2500,13 @@ public partial class SystemInteractionComponent : Hl7.Fhir.Model.BackboneElement
[Binding("SystemRestfulInteraction")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code CodeElement
+ public Code? CodeElement
{
get { return _CodeElement; }
set { _CodeElement = value; OnPropertyChanged("CodeElement"); }
}
- private Code _CodeElement;
+ private Code? _CodeElement;
///
/// transaction | batch | search-system | history-system
@@ -2626,13 +2515,10 @@ public Code CodeEle
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatement.SystemRestfulInteraction? Code
{
- get { return CodeElement != null ? CodeElement.Value : null; }
+ get => _CodeElement?.Value;
set
{
- if (value == null)
- CodeElement = null;
- else
- CodeElement = new Code(value);
+ CodeElement = value is null ? null : new Code(value);
OnPropertyChanged("Code");
}
}
@@ -2642,44 +2528,37 @@ public Hl7.Fhir.Model.CapabilityStatement.SystemRestfulInteraction? Code
///
[FhirElement("documentation", Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DocumentationElement
+ public Hl7.Fhir.Model.Markdown? DocumentationElement
{
get { return _DocumentationElement; }
set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); }
}
- private Hl7.Fhir.Model.Markdown _DocumentationElement;
+ private Hl7.Fhir.Model.Markdown? _DocumentationElement;
///
/// Anything special about operation behavior
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Documentation
+ public string? Documentation
{
- get { return DocumentationElement != null ? DocumentationElement.Value : null; }
+ get => _DocumentationElement?.Value;
set
{
- if (value == null)
- DocumentationElement = null;
- else
- DocumentationElement = new Hl7.Fhir.Model.Markdown(value);
+ DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Documentation");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as SystemInteractionComponent;
-
- if (dest == null)
- {
+ if(other is not SystemInteractionComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal();
- if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal();
+ if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal();
+ if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -2691,41 +2570,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as SystemInteractionComponent;
- if(otherT == null) return false;
+ if(other is not SystemInteractionComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false;
- if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false;
+ if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "code":
- value = CodeElement;
- return CodeElement is not null;
+ value = _CodeElement;
+ return _CodeElement is not null;
case "documentation":
- value = DocumentationElement;
- return DocumentationElement is not null;
+ value = _DocumentationElement;
+ return _DocumentationElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "code":
- CodeElement = (Code)value;
+ CodeElement = (Code?)value;
return this;
case "documentation":
- DocumentationElement = (Hl7.Fhir.Model.Markdown)value;
+ DocumentationElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
default:
return base.SetValue(key, value);
@@ -2736,8 +2616,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement);
- if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement);
+ if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement);
+ if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement);
}
}
@@ -2767,24 +2647,24 @@ public partial class MessagingComponent : Hl7.Fhir.Model.BackboneElement
[DataMember]
public List Endpoint
{
- get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; }
+ get => _Endpoint ??= [];
set { _Endpoint = value; OnPropertyChanged("Endpoint"); }
}
- private List _Endpoint;
+ private List? _Endpoint;
///
/// Reliable Message Cache Length (min).
///
[FhirElement("reliableCache", Order=50)]
[DataMember]
- public Hl7.Fhir.Model.UnsignedInt ReliableCacheElement
+ public Hl7.Fhir.Model.UnsignedInt? ReliableCacheElement
{
get { return _ReliableCacheElement; }
set { _ReliableCacheElement = value; OnPropertyChanged("ReliableCacheElement"); }
}
- private Hl7.Fhir.Model.UnsignedInt _ReliableCacheElement;
+ private Hl7.Fhir.Model.UnsignedInt? _ReliableCacheElement;
///
/// Reliable Message Cache Length (min)
@@ -2793,13 +2673,10 @@ public Hl7.Fhir.Model.UnsignedInt ReliableCacheElement
[IgnoreDataMember]
public int? ReliableCache
{
- get { return ReliableCacheElement != null ? ReliableCacheElement.Value : null; }
+ get => _ReliableCacheElement?.Value;
set
{
- if (value == null)
- ReliableCacheElement = null;
- else
- ReliableCacheElement = new Hl7.Fhir.Model.UnsignedInt(value);
+ ReliableCacheElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value);
OnPropertyChanged("ReliableCache");
}
}
@@ -2809,28 +2686,25 @@ public int? ReliableCache
///
[FhirElement("documentation", Order=60)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DocumentationElement
+ public Hl7.Fhir.Model.Markdown? DocumentationElement
{
get { return _DocumentationElement; }
set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); }
}
- private Hl7.Fhir.Model.Markdown _DocumentationElement;
+ private Hl7.Fhir.Model.Markdown? _DocumentationElement;
///
/// Messaging interface behavior details
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Documentation
+ public string? Documentation
{
- get { return DocumentationElement != null ? DocumentationElement.Value : null; }
+ get => _DocumentationElement?.Value;
set
{
- if (value == null)
- DocumentationElement = null;
- else
- DocumentationElement = new Hl7.Fhir.Model.Markdown(value);
+ DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Documentation");
}
}
@@ -2843,26 +2717,22 @@ public string Documentation
[DataMember]
public List SupportedMessage
{
- get { if(_SupportedMessage==null) _SupportedMessage = new List(); return _SupportedMessage; }
+ get => _SupportedMessage ??= [];
set { _SupportedMessage = value; OnPropertyChanged("SupportedMessage"); }
}
- private List _SupportedMessage;
+ private List? _SupportedMessage;
protected internal override void CopyToInternal(Base other)
{
- var dest = other as MessagingComponent;
-
- if (dest == null)
- {
+ if(other is not MessagingComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal());
- if(ReliableCacheElement != null) dest.ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)ReliableCacheElement.DeepCopyInternal();
- if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal();
- if(SupportedMessage.Any()) dest.SupportedMessage = new List(SupportedMessage.DeepCopyInternal());
+ if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal());
+ if(_ReliableCacheElement is not null) dest.ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)_ReliableCacheElement.DeepCopyInternal();
+ if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal();
+ if(_SupportedMessage is not null) dest.SupportedMessage = new List(_SupportedMessage.DeepCopyInternal());
}
protected internal override Base DeepCopyInternal()
@@ -2874,55 +2744,56 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as MessagingComponent;
- if(otherT == null) return false;
+ if(other is not MessagingComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false;
- if(!comparer.Equals(ReliableCacheElement, otherT.ReliableCacheElement)) return false;
- if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false;
- if(!comparer.ListEquals(SupportedMessage, otherT.SupportedMessage)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false;
+ if(!comparer.Equals(_ReliableCacheElement, otherT._ReliableCacheElement)) return false;
+ if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false;
+ if(!comparer.ListEquals(_SupportedMessage, otherT._SupportedMessage)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "endpoint":
- value = Endpoint;
- return Endpoint?.Any() == true;
+ value = _Endpoint;
+ return _Endpoint?.Any() == true;
case "reliableCache":
- value = ReliableCacheElement;
- return ReliableCacheElement is not null;
+ value = _ReliableCacheElement;
+ return _ReliableCacheElement is not null;
case "documentation":
- value = DocumentationElement;
- return DocumentationElement is not null;
+ value = _DocumentationElement;
+ return _DocumentationElement is not null;
case "supportedMessage":
- value = SupportedMessage;
- return SupportedMessage?.Any() == true;
+ value = _SupportedMessage;
+ return _SupportedMessage?.Any() == true;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "endpoint":
- Endpoint = (List)value;
+ Endpoint = (List?)value!;
return this;
case "reliableCache":
- ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)value;
+ ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt?)value;
return this;
case "documentation":
- DocumentationElement = (Hl7.Fhir.Model.Markdown)value;
+ DocumentationElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
case "supportedMessage":
- SupportedMessage = (List)value;
+ SupportedMessage = (List?)value!;
return this;
default:
return base.SetValue(key, value);
@@ -2933,10 +2804,10 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint);
- if (ReliableCacheElement is not null) yield return new KeyValuePair("reliableCache",ReliableCacheElement);
- if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement);
- if (SupportedMessage?.Any() == true) yield return new KeyValuePair("supportedMessage",SupportedMessage);
+ if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint);
+ if (_ReliableCacheElement is not null) yield return new KeyValuePair("reliableCache",_ReliableCacheElement);
+ if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement);
+ if (_SupportedMessage?.Any() == true) yield return new KeyValuePair("supportedMessage",_SupportedMessage);
}
}
@@ -2964,13 +2835,13 @@ public partial class EndpointComponent : Hl7.Fhir.Model.BackboneElement
[Binding("MessageTransport")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.Coding Protocol
+ public Hl7.Fhir.Model.Coding? Protocol
{
get { return _Protocol; }
set { _Protocol = value; OnPropertyChanged("Protocol"); }
}
- private Hl7.Fhir.Model.Coding _Protocol;
+ private Hl7.Fhir.Model.Coding? _Protocol;
///
/// Network address or identifier of the end-point.
@@ -2978,44 +2849,37 @@ public Hl7.Fhir.Model.Coding Protocol
[FhirElement("address", Order=50)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirUrl AddressElement
+ public Hl7.Fhir.Model.FhirUrl? AddressElement
{
get { return _AddressElement; }
set { _AddressElement = value; OnPropertyChanged("AddressElement"); }
}
- private Hl7.Fhir.Model.FhirUrl _AddressElement;
+ private Hl7.Fhir.Model.FhirUrl? _AddressElement;
///
/// Network address or identifier of the end-point
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Address
+ public string? Address
{
- get { return AddressElement != null ? AddressElement.Value : null; }
+ get => _AddressElement?.Value;
set
{
- if (value == null)
- AddressElement = null;
- else
- AddressElement = new Hl7.Fhir.Model.FhirUrl(value);
+ AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value);
OnPropertyChanged("Address");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as EndpointComponent;
-
- if (dest == null)
- {
+ if(other is not EndpointComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(Protocol != null) dest.Protocol = (Hl7.Fhir.Model.Coding)Protocol.DeepCopyInternal();
- if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)AddressElement.DeepCopyInternal();
+ if(_Protocol is not null) dest.Protocol = (Hl7.Fhir.Model.Coding)_Protocol.DeepCopyInternal();
+ if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)_AddressElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -3027,41 +2891,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as EndpointComponent;
- if(otherT == null) return false;
+ if(other is not EndpointComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(Protocol, otherT.Protocol)) return false;
- if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_Protocol, otherT._Protocol)) return false;
+ if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "protocol":
- value = Protocol;
- return Protocol is not null;
+ value = _Protocol;
+ return _Protocol is not null;
case "address":
- value = AddressElement;
- return AddressElement is not null;
+ value = _AddressElement;
+ return _AddressElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "protocol":
- Protocol = (Hl7.Fhir.Model.Coding)value;
+ Protocol = (Hl7.Fhir.Model.Coding?)value;
return this;
case "address":
- AddressElement = (Hl7.Fhir.Model.FhirUrl)value;
+ AddressElement = (Hl7.Fhir.Model.FhirUrl?)value;
return this;
default:
return base.SetValue(key, value);
@@ -3072,8 +2937,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (Protocol is not null) yield return new KeyValuePair("protocol",Protocol);
- if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement);
+ if (_Protocol is not null) yield return new KeyValuePair("protocol",_Protocol);
+ if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement);
}
}
@@ -3103,13 +2968,13 @@ public partial class SupportedMessageComponent : Hl7.Fhir.Model.BackboneElement
[Binding("EventCapabilityMode")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code ModeElement
+ public Code? ModeElement
{
get { return _ModeElement; }
set { _ModeElement = value; OnPropertyChanged("ModeElement"); }
}
- private Code _ModeElement;
+ private Code? _ModeElement;
///
/// sender | receiver
@@ -3118,13 +2983,10 @@ public Code ModeElement
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatement.EventCapabilityMode? Mode
{
- get { return ModeElement != null ? ModeElement.Value : null; }
+ get => _ModeElement?.Value;
set
{
- if (value == null)
- ModeElement = null;
- else
- ModeElement = new Code(value);
+ ModeElement = value is null ? null : new Code(value);
OnPropertyChanged("Mode");
}
}
@@ -3135,44 +2997,37 @@ public Hl7.Fhir.Model.CapabilityStatement.EventCapabilityMode? Mode
[FhirElement("definition", InSummary=true, Order=50)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.Canonical DefinitionElement
+ public Hl7.Fhir.Model.Canonical? DefinitionElement
{
get { return _DefinitionElement; }
set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); }
}
- private Hl7.Fhir.Model.Canonical _DefinitionElement;
+ private Hl7.Fhir.Model.Canonical? _DefinitionElement;
///
/// Message supported by this system
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Definition
+ public string? Definition
{
- get { return DefinitionElement != null ? DefinitionElement.Value : null; }
+ get => _DefinitionElement?.Value;
set
{
- if (value == null)
- DefinitionElement = null;
- else
- DefinitionElement = new Hl7.Fhir.Model.Canonical(value);
+ DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value);
OnPropertyChanged("Definition");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as SupportedMessageComponent;
-
- if (dest == null)
- {
+ if(other is not SupportedMessageComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal();
- if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal();
+ if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal();
+ if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -3184,41 +3039,42 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as SupportedMessageComponent;
- if(otherT == null) return false;
+ if(other is not SupportedMessageComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false;
- if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false;
+ if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "mode":
- value = ModeElement;
- return ModeElement is not null;
+ value = _ModeElement;
+ return _ModeElement is not null;
case "definition":
- value = DefinitionElement;
- return DefinitionElement is not null;
+ value = _DefinitionElement;
+ return _DefinitionElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "mode":
- ModeElement = (Code)value;
+ ModeElement = (Code?)value;
return this;
case "definition":
- DefinitionElement = (Hl7.Fhir.Model.Canonical)value;
+ DefinitionElement = (Hl7.Fhir.Model.Canonical?)value;
return this;
default:
return base.SetValue(key, value);
@@ -3229,8 +3085,8 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement);
- if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement);
+ if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement);
+ if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement);
}
}
@@ -3259,13 +3115,13 @@ public partial class DocumentComponent : Hl7.Fhir.Model.BackboneElement
[Binding("DocumentMode")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code ModeElement
+ public Code? ModeElement
{
get { return _ModeElement; }
set { _ModeElement = value; OnPropertyChanged("ModeElement"); }
}
- private Code _ModeElement;
+ private Code? _ModeElement;
///
/// producer | consumer
@@ -3274,13 +3130,10 @@ public Code ModeElement
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatement.DocumentMode? Mode
{
- get { return ModeElement != null ? ModeElement.Value : null; }
+ get => _ModeElement?.Value;
set
{
- if (value == null)
- ModeElement = null;
- else
- ModeElement = new Code(value);
+ ModeElement = value is null ? null : new Code(value);
OnPropertyChanged("Mode");
}
}
@@ -3290,28 +3143,25 @@ public Hl7.Fhir.Model.CapabilityStatement.DocumentMode? Mode
///
[FhirElement("documentation", Order=50)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DocumentationElement
+ public Hl7.Fhir.Model.Markdown? DocumentationElement
{
get { return _DocumentationElement; }
set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); }
}
- private Hl7.Fhir.Model.Markdown _DocumentationElement;
+ private Hl7.Fhir.Model.Markdown? _DocumentationElement;
///
/// Description of document support
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Documentation
+ public string? Documentation
{
- get { return DocumentationElement != null ? DocumentationElement.Value : null; }
+ get => _DocumentationElement?.Value;
set
{
- if (value == null)
- DocumentationElement = null;
- else
- DocumentationElement = new Hl7.Fhir.Model.Markdown(value);
+ DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Documentation");
}
}
@@ -3322,45 +3172,38 @@ public string Documentation
[FhirElement("profile", InSummary=true, Order=60)]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.Canonical ProfileElement
+ public Hl7.Fhir.Model.Canonical? ProfileElement
{
get { return _ProfileElement; }
set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); }
}
- private Hl7.Fhir.Model.Canonical _ProfileElement;
+ private Hl7.Fhir.Model.Canonical? _ProfileElement;
///
/// Constraint on the resources used in the document
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Profile
+ public string? Profile
{
- get { return ProfileElement != null ? ProfileElement.Value : null; }
+ get => _ProfileElement?.Value;
set
{
- if (value == null)
- ProfileElement = null;
- else
- ProfileElement = new Hl7.Fhir.Model.Canonical(value);
+ ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value);
OnPropertyChanged("Profile");
}
}
protected internal override void CopyToInternal(Base other)
{
- var dest = other as DocumentComponent;
-
- if (dest == null)
- {
+ if(other is not DocumentComponent dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal();
- if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal();
- if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal();
+ if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal();
+ if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal();
+ if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal();
}
protected internal override Base DeepCopyInternal()
@@ -3372,48 +3215,49 @@ protected internal override Base DeepCopyInternal()
public override bool CompareChildren(Base other, IEqualityComparer comparer)
{
- var otherT = other as DocumentComponent;
- if(otherT == null) return false;
+ if(other is not DocumentComponent otherT) return false;
if(!base.CompareChildren(otherT, comparer)) return false;
- if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false;
- if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false;
- if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false;
+ #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here
+ if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false;
+ if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false;
+ if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false;
+ #pragma warning restore CS8604 // Possible null reference argument.
return true;
}
- public override bool TryGetValue(string key, out object value)
+ public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value)
{
switch (key)
{
case "mode":
- value = ModeElement;
- return ModeElement is not null;
+ value = _ModeElement;
+ return _ModeElement is not null;
case "documentation":
- value = DocumentationElement;
- return DocumentationElement is not null;
+ value = _DocumentationElement;
+ return _DocumentationElement is not null;
case "profile":
- value = ProfileElement;
- return ProfileElement is not null;
+ value = _ProfileElement;
+ return _ProfileElement is not null;
default:
return base.TryGetValue(key, out value);
}
}
- public override Base SetValue(string key, object value)
+ public override Base SetValue(string key, object? value)
{
switch (key)
{
case "mode":
- ModeElement = (Code)value;
+ ModeElement = (Code?)value;
return this;
case "documentation":
- DocumentationElement = (Hl7.Fhir.Model.Markdown)value;
+ DocumentationElement = (Hl7.Fhir.Model.Markdown?)value;
return this;
case "profile":
- ProfileElement = (Hl7.Fhir.Model.Canonical)value;
+ ProfileElement = (Hl7.Fhir.Model.Canonical?)value;
return this;
default:
return base.SetValue(key, value);
@@ -3424,9 +3268,9 @@ public override Base SetValue(string key, object value)
public override IEnumerable> EnumerateElements()
{
foreach (var kvp in base.EnumerateElements()) yield return kvp;
- if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement);
- if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement);
- if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement);
+ if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement);
+ if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement);
+ if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement);
}
}
@@ -3436,28 +3280,25 @@ public override IEnumerable> EnumerateElements()
///
[FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")]
[DataMember]
- public Hl7.Fhir.Model.FhirUri UrlElement
+ public Hl7.Fhir.Model.FhirUri? UrlElement
{
get { return _UrlElement; }
set { _UrlElement = value; OnPropertyChanged("UrlElement"); }
}
- private Hl7.Fhir.Model.FhirUri _UrlElement;
+ private Hl7.Fhir.Model.FhirUri? _UrlElement;
///
/// Canonical identifier for this capability statement, represented as a URI (globally unique)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Url
+ public string? Url
{
- get { return UrlElement != null ? UrlElement.Value : null; }
+ get => _UrlElement?.Value;
set
{
- if (value == null)
- UrlElement = null;
- else
- UrlElement = new Hl7.Fhir.Model.FhirUri(value);
+ UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value);
OnPropertyChanged("Url");
}
}
@@ -3473,39 +3314,36 @@ public string Url
[DataMember]
public List Identifier
{
- get { if(_Identifier==null) _Identifier = new List(); return _Identifier; }
+ get => _Identifier ??= [];
set { _Identifier = value; OnPropertyChanged("Identifier"); }
}
- private List _Identifier;
+ private List? _Identifier;
///
/// Business version of the capability statement.
///
[FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")]
[DataMember]
- public Hl7.Fhir.Model.FhirString VersionElement
+ public Hl7.Fhir.Model.FhirString? VersionElement
{
get { return _VersionElement; }
set { _VersionElement = value; OnPropertyChanged("VersionElement"); }
}
- private Hl7.Fhir.Model.FhirString _VersionElement;
+ private Hl7.Fhir.Model.FhirString? _VersionElement;
///
/// Business version of the capability statement
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Version
+ public string? Version
{
- get { return VersionElement != null ? VersionElement.Value : null; }
+ get => _VersionElement?.Value;
set
{
- if (value == null)
- VersionElement = null;
- else
- VersionElement = new Hl7.Fhir.Model.FhirString(value);
+ VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Version");
}
}
@@ -3520,41 +3358,38 @@ public string Version
[CLSCompliant(false)]
[AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))]
[DataMember]
- public Hl7.Fhir.Model.DataType VersionAlgorithm
+ public Hl7.Fhir.Model.DataType? VersionAlgorithm
{
get { return _VersionAlgorithm; }
set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); }
}
- private Hl7.Fhir.Model.DataType _VersionAlgorithm;
+ private Hl7.Fhir.Model.DataType? _VersionAlgorithm;
///
/// Name for this capability statement (computer friendly).
///
[FhirElement("name", InSummary=true, Order=130)]
[DataMember]
- public Hl7.Fhir.Model.FhirString NameElement
+ public Hl7.Fhir.Model.FhirString? NameElement
{
get { return _NameElement; }
set { _NameElement = value; OnPropertyChanged("NameElement"); }
}
- private Hl7.Fhir.Model.FhirString _NameElement;
+ private Hl7.Fhir.Model.FhirString? _NameElement;
///
/// Name for this capability statement (computer friendly)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Name
+ public string? Name
{
- get { return NameElement != null ? NameElement.Value : null; }
+ get => _NameElement?.Value;
set
{
- if (value == null)
- NameElement = null;
- else
- NameElement = new Hl7.Fhir.Model.FhirString(value);
+ NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Name");
}
}
@@ -3564,28 +3399,25 @@ public string Name
///
[FhirElement("title", InSummary=true, Order=140)]
[DataMember]
- public Hl7.Fhir.Model.FhirString TitleElement
+ public Hl7.Fhir.Model.FhirString? TitleElement
{
get { return _TitleElement; }
set { _TitleElement = value; OnPropertyChanged("TitleElement"); }
}
- private Hl7.Fhir.Model.FhirString _TitleElement;
+ private Hl7.Fhir.Model.FhirString? _TitleElement;
///
/// Name for this capability statement (human friendly)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Title
+ public string? Title
{
- get { return TitleElement != null ? TitleElement.Value : null; }
+ get => _TitleElement?.Value;
set
{
- if (value == null)
- TitleElement = null;
- else
- TitleElement = new Hl7.Fhir.Model.FhirString(value);
+ TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Title");
}
}
@@ -3598,13 +3430,13 @@ public string Title
[Binding("PublicationStatus")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code StatusElement
+ public Code? StatusElement
{
get { return _StatusElement; }
set { _StatusElement = value; OnPropertyChanged("StatusElement"); }
}
- private Code _StatusElement;
+ private Code? _StatusElement;
///
/// draft | active | retired | unknown
@@ -3613,13 +3445,10 @@ public Code StatusElement
[IgnoreDataMember]
public Hl7.Fhir.Model.PublicationStatus? Status
{
- get { return StatusElement != null ? StatusElement.Value : null; }
+ get => _StatusElement?.Value;
set
{
- if (value == null)
- StatusElement = null;
- else
- StatusElement = new Code(value);
+ StatusElement = value is null ? null : new Code(value);
OnPropertyChanged("Status");
}
}
@@ -3629,13 +3458,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status
///
[FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")]
[DataMember]
- public Hl7.Fhir.Model.FhirBoolean ExperimentalElement
+ public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement
{
get { return _ExperimentalElement; }
set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); }
}
- private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement;
+ private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement;
///
/// For testing purposes, not real usage
@@ -3644,13 +3473,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement
[IgnoreDataMember]
public bool? Experimental
{
- get { return ExperimentalElement != null ? ExperimentalElement.Value : null; }
+ get => _ExperimentalElement?.Value;
set
{
- if (value == null)
- ExperimentalElement = null;
- else
- ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value);
+ ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value);
OnPropertyChanged("Experimental");
}
}
@@ -3661,28 +3487,25 @@ public bool? Experimental
[FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Hl7.Fhir.Model.FhirDateTime DateElement
+ public Hl7.Fhir.Model.FhirDateTime? DateElement
{
get { return _DateElement; }
set { _DateElement = value; OnPropertyChanged("DateElement"); }
}
- private Hl7.Fhir.Model.FhirDateTime _DateElement;
+ private Hl7.Fhir.Model.FhirDateTime? _DateElement;
///
/// Date last changed
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Date
+ public string? Date
{
- get { return DateElement != null ? DateElement.Value : null; }
+ get => _DateElement?.Value;
set
{
- if (value == null)
- DateElement = null;
- else
- DateElement = new Hl7.Fhir.Model.FhirDateTime(value);
+ DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value);
OnPropertyChanged("Date");
}
}
@@ -3692,28 +3515,25 @@ public string Date
///
[FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")]
[DataMember]
- public Hl7.Fhir.Model.FhirString PublisherElement
+ public Hl7.Fhir.Model.FhirString? PublisherElement
{
get { return _PublisherElement; }
set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); }
}
- private Hl7.Fhir.Model.FhirString _PublisherElement;
+ private Hl7.Fhir.Model.FhirString? _PublisherElement;
///
/// Name of the publisher/steward (organization or individual)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Publisher
+ public string? Publisher
{
- get { return PublisherElement != null ? PublisherElement.Value : null; }
+ get => _PublisherElement?.Value;
set
{
- if (value == null)
- PublisherElement = null;
- else
- PublisherElement = new Hl7.Fhir.Model.FhirString(value);
+ PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("Publisher");
}
}
@@ -3726,39 +3546,36 @@ public string Publisher
[DataMember]
public List Contact
{
- get { if(_Contact==null) _Contact = new List(); return _Contact; }
+ get => _Contact ??= [];
set { _Contact = value; OnPropertyChanged("Contact"); }
}
- private List _Contact;
+ private List? _Contact;
///
/// Natural language description of the capability statement.
///
[FhirElement("description", Order=200)]
[DataMember]
- public Hl7.Fhir.Model.Markdown DescriptionElement
+ public Hl7.Fhir.Model.Markdown? DescriptionElement
{
get { return _DescriptionElement; }
set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); }
}
- private Hl7.Fhir.Model.Markdown _DescriptionElement;
+ private Hl7.Fhir.Model.Markdown? _DescriptionElement;
///
/// Natural language description of the capability statement
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Description
+ public string? Description
{
- get { return DescriptionElement != null ? DescriptionElement.Value : null; }
+ get => _DescriptionElement?.Value;
set
{
- if (value == null)
- DescriptionElement = null;
- else
- DescriptionElement = new Hl7.Fhir.Model.Markdown(value);
+ DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Description");
}
}
@@ -3771,11 +3588,11 @@ public string Description
[DataMember]
public List UseContext
{
- get { if(_UseContext==null) _UseContext = new List(); return _UseContext; }
+ get => _UseContext ??= [];
set { _UseContext = value; OnPropertyChanged("UseContext"); }
}
- private List _UseContext;
+ private List? _UseContext;
///
/// Intended jurisdiction for capability statement (if applicable).
@@ -3786,39 +3603,36 @@ public List UseContext
[DataMember]
public List Jurisdiction
{
- get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; }
+ get => _Jurisdiction ??= [];
set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); }
}
- private List _Jurisdiction;
+ private List? _Jurisdiction;
///
/// Why this capability statement is defined.
///
[FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")]
[DataMember]
- public Hl7.Fhir.Model.Markdown PurposeElement
+ public Hl7.Fhir.Model.Markdown? PurposeElement
{
get { return _PurposeElement; }
set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); }
}
- private Hl7.Fhir.Model.Markdown _PurposeElement;
+ private Hl7.Fhir.Model.Markdown? _PurposeElement;
///
/// Why this capability statement is defined
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Purpose
+ public string? Purpose
{
- get { return PurposeElement != null ? PurposeElement.Value : null; }
+ get => _PurposeElement?.Value;
set
{
- if (value == null)
- PurposeElement = null;
- else
- PurposeElement = new Hl7.Fhir.Model.Markdown(value);
+ PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Purpose");
}
}
@@ -3828,28 +3642,25 @@ public string Purpose
///
[FhirElement("copyright", Order=240)]
[DataMember]
- public Hl7.Fhir.Model.Markdown CopyrightElement
+ public Hl7.Fhir.Model.Markdown? CopyrightElement
{
get { return _CopyrightElement; }
set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); }
}
- private Hl7.Fhir.Model.Markdown _CopyrightElement;
+ private Hl7.Fhir.Model.Markdown? _CopyrightElement;
///
/// Use and/or publishing restrictions
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string Copyright
+ public string? Copyright
{
- get { return CopyrightElement != null ? CopyrightElement.Value : null; }
+ get => _CopyrightElement?.Value;
set
{
- if (value == null)
- CopyrightElement = null;
- else
- CopyrightElement = new Hl7.Fhir.Model.Markdown(value);
+ CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value);
OnPropertyChanged("Copyright");
}
}
@@ -3862,28 +3673,25 @@ public string Copyright
///
[FhirElement("copyrightLabel", Order=250, Since=FhirRelease.R5)]
[DataMember]
- public Hl7.Fhir.Model.FhirString CopyrightLabelElement
+ public Hl7.Fhir.Model.FhirString? CopyrightLabelElement
{
get { return _CopyrightLabelElement; }
set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); }
}
- private Hl7.Fhir.Model.FhirString _CopyrightLabelElement;
+ private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement;
///
/// Copyright holder and year(s)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public string CopyrightLabel
+ public string? CopyrightLabel
{
- get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; }
+ get => _CopyrightLabelElement?.Value;
set
{
- if (value == null)
- CopyrightLabelElement = null;
- else
- CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value);
+ CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value);
OnPropertyChanged("CopyrightLabel");
}
}
@@ -3896,13 +3704,13 @@ public string CopyrightLabel
[Binding("CapabilityStatementKind")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code KindElement
+ public Code? KindElement
{
get { return _KindElement; }
set { _KindElement = value; OnPropertyChanged("KindElement"); }
}
- private Code _KindElement;
+ private Code? _KindElement;
///
/// instance | capability | requirements
@@ -3911,13 +3719,10 @@ public Code KindElement
[IgnoreDataMember]
public Hl7.Fhir.Model.CapabilityStatementKind? Kind
{
- get { return KindElement != null ? KindElement.Value : null; }
+ get => _KindElement?.Value;
set
{
- if (value == null)
- KindElement = null;
- else
- KindElement = new Code(value);
+ KindElement = value is null ? null : new Code(value);
OnPropertyChanged("Kind");
}
}
@@ -3930,24 +3735,24 @@ public Hl7.Fhir.Model.CapabilityStatementKind? Kind
[DataMember]
public List InstantiatesElement
{
- get { if(_InstantiatesElement==null) _InstantiatesElement = new List(); return _InstantiatesElement; }
+ get => _InstantiatesElement ??= [];
set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); }
}
- private List _InstantiatesElement;
+ private List? _InstantiatesElement;
///
/// Canonical URL of another capability statement this implements
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable Instantiates
+ public IEnumerable Instantiates
{
- get { return InstantiatesElement != null ? InstantiatesElement.Select(elem => elem.Value) : null; }
+ get => _InstantiatesElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- InstantiatesElement = null;
+ InstantiatesElement = null!;
else
InstantiatesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem)));
OnPropertyChanged("Instantiates");
@@ -3962,24 +3767,24 @@ public IEnumerable Instantiates
[DataMember]
public List ImportsElement
{
- get { if(_ImportsElement==null) _ImportsElement = new List(); return _ImportsElement; }
+ get => _ImportsElement ??= [];
set { _ImportsElement = value; OnPropertyChanged("ImportsElement"); }
}
- private List _ImportsElement;
+ private List? _ImportsElement;
///
/// Canonical URL of another capability statement this adds to
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable Imports
+ public IEnumerable Imports
{
- get { return ImportsElement != null ? ImportsElement.Select(elem => elem.Value) : null; }
+ get => _ImportsElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- ImportsElement = null;
+ ImportsElement = null!;
else
ImportsElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem)));
OnPropertyChanged("Imports");
@@ -3991,26 +3796,26 @@ public IEnumerable Imports
///
[FhirElement("software", InSummary=true, Order=290)]
[DataMember]
- public Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent Software
+ public Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent? Software
{
get { return _Software; }
set { _Software = value; OnPropertyChanged("Software"); }
}
- private Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent _Software;
+ private Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent? _Software;
///
/// If this describes a specific instance.
///
[FhirElement("implementation", InSummary=true, Order=300)]
[DataMember]
- public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent Implementation
+ public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent? Implementation
{
get { return _Implementation; }
set { _Implementation = value; OnPropertyChanged("Implementation"); }
}
- private Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent _Implementation;
+ private Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent? _Implementation;
///
/// FHIR Version the system supports.
@@ -4020,13 +3825,13 @@ public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent Implementation
[Binding("FHIRVersion")]
[Cardinality(Min=1,Max=1)]
[DataMember]
- public Code FhirVersionElement
+ public Code? FhirVersionElement
{
get { return _FhirVersionElement; }
set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); }
}
- private Code _FhirVersionElement;
+ private Code? _FhirVersionElement;
///
/// FHIR Version the system supports
@@ -4035,13 +3840,10 @@ public Code FhirVersionElement
[IgnoreDataMember]
public Hl7.Fhir.Model.FHIRVersion? FhirVersion
{
- get { return FhirVersionElement != null ? FhirVersionElement.Value : null; }
+ get => _FhirVersionElement?.Value;
set
{
- if (value == null)
- FhirVersionElement = null;
- else
- FhirVersionElement = new Code(value);
+ FhirVersionElement = value is null ? null : new Code(value);
OnPropertyChanged("FhirVersion");
}
}
@@ -4055,24 +3857,24 @@ public Hl7.Fhir.Model.FHIRVersion? FhirVersion
[DataMember]
public List FormatElement
{
- get { if(_FormatElement==null) _FormatElement = new List(); return _FormatElement; }
+ get => _FormatElement ??= [];
set { _FormatElement = value; OnPropertyChanged("FormatElement"); }
}
- private List _FormatElement;
+ private List? _FormatElement;
///
/// formats supported (xml | json | ttl | mime type)
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable Format
+ public IEnumerable Format
{
- get { return FormatElement != null ? FormatElement.Select(elem => elem.Value) : null; }
+ get => _FormatElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- FormatElement = null;
+ FormatElement = null!;
else
FormatElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem)));
OnPropertyChanged("Format");
@@ -4088,24 +3890,24 @@ public IEnumerable Format
[DataMember]
public List PatchFormatElement
{
- get { if(_PatchFormatElement==null) _PatchFormatElement = new List(); return _PatchFormatElement; }
+ get => _PatchFormatElement ??= [];
set { _PatchFormatElement = value; OnPropertyChanged("PatchFormatElement"); }
}
- private List _PatchFormatElement;
+ private List? _PatchFormatElement;
///
/// Patch formats supported
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable PatchFormat
+ public IEnumerable PatchFormat
{
- get { return PatchFormatElement != null ? PatchFormatElement.Select(elem => elem.Value) : null; }
+ get => _PatchFormatElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- PatchFormatElement = null;
+ PatchFormatElement = null!;
else
PatchFormatElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem)));
OnPropertyChanged("PatchFormat");
@@ -4124,24 +3926,24 @@ public IEnumerable PatchFormat
[DataMember]
public List AcceptLanguageElement
{
- get { if(_AcceptLanguageElement==null) _AcceptLanguageElement = new List(); return _AcceptLanguageElement; }
+ get => _AcceptLanguageElement ??= [];
set { _AcceptLanguageElement = value; OnPropertyChanged("AcceptLanguageElement"); }
}
- private List _AcceptLanguageElement;
+ private List? _AcceptLanguageElement;
///
/// Languages supported
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable AcceptLanguage
+ public IEnumerable AcceptLanguage
{
- get { return AcceptLanguageElement != null ? AcceptLanguageElement.Select(elem => elem.Value) : null; }
+ get => _AcceptLanguageElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- AcceptLanguageElement = null;
+ AcceptLanguageElement = null!;
else
AcceptLanguageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem)));
OnPropertyChanged("AcceptLanguage");
@@ -4156,24 +3958,24 @@ public IEnumerable AcceptLanguage
[DataMember]
public List ImplementationGuideElement
{
- get { if(_ImplementationGuideElement==null) _ImplementationGuideElement = new List(); return _ImplementationGuideElement; }
+ get => _ImplementationGuideElement ??= [];
set { _ImplementationGuideElement = value; OnPropertyChanged("ImplementationGuideElement"); }
}
- private List _ImplementationGuideElement;
+ private List? _ImplementationGuideElement;
///
/// Implementation guides supported
///
/// This uses the native .NET datatype, rather than the FHIR equivalent
[IgnoreDataMember]
- public IEnumerable ImplementationGuide
+ public IEnumerable ImplementationGuide
{
- get { return ImplementationGuideElement != null ? ImplementationGuideElement.Select(elem => elem.Value) : null; }
+ get => _ImplementationGuideElement?.Select(elem => elem.Value) ?? [];
set
{
if (value == null)
- ImplementationGuideElement = null;
+ ImplementationGuideElement = null!;
else
ImplementationGuideElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem)));
OnPropertyChanged("ImplementationGuide");
@@ -4188,11 +3990,11 @@ public IEnumerable ImplementationGuide
[DataMember]
public List Rest
{
- get { if(_Rest==null) _Rest = new List(); return _Rest; }
+ get => _Rest ??= [];
set { _Rest = value; OnPropertyChanged("Rest"); }
}
- private List _Rest;
+ private List? _Rest;
///
/// If messaging is supported.
@@ -4202,11 +4004,11 @@ public List Rest
[DataMember]
public List Messaging
{
- get { if(_Messaging==null) _Messaging = new List(); return _Messaging; }
+ get => _Messaging ??= [];
set { _Messaging = value; OnPropertyChanged("Messaging"); }
}
- private List _Messaging;
+ private List? _Messaging;
///
/// Document definition.
@@ -4216,54 +4018,50 @@ public List Messaging
[DataMember]
public List Document
{
- get { if(_Document==null) _Document = new List(); return _Document; }
+ get => _Document ??= [];
set { _Document = value; OnPropertyChanged("Document"); }
}
- private List _Document;
+ private List? _Document;
List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; }
protected internal override void CopyToInternal(Base other)
{
- var dest = other as CapabilityStatement;
-
- if (dest == null)
- {
+ if(other is not CapabilityStatement dest)
throw new ArgumentException("Can only copy to an object of the same type", "other");
- }
base.CopyToInternal(dest);
- if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal();
- if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal());
- if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal();
- if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal();
- if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal();
- if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal();
- if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal();
- if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal();
- if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal();
- if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal();
- if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal());
- if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal();
- if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal());
- if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal());
- if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal();
- if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal();
- if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal();
- if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal();
- if(InstantiatesElement.Any()) dest.InstantiatesElement = new List(InstantiatesElement.DeepCopyInternal());
- if(ImportsElement.Any()) dest.ImportsElement = new List(ImportsElement.DeepCopyInternal());
- if(Software != null) dest.Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent)Software.DeepCopyInternal();
- if(Implementation != null) dest.Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent)Implementation.DeepCopyInternal();
- if(FhirVersionElement != null) dest.FhirVersionElement = (Code