Table of Contents

Class PatientObservationConverter

Namespace
adas_core.Infrastructure.Utils
Assembly
adas-core.Infrastructure.dll

Provides conversion logic for PatientObservation values, supporting JSON serialization through Newtonsoft.Json.JsonConverter<T> and BSON serialization through MongoDB.Bson.Serialization.IBsonSerializer.

public class PatientObservationConverter : JsonConverter<PatientObservation>, IBsonSerializer
Inheritance
JsonConverter
JsonConverter<PatientObservation>
PatientObservationConverter
Implements
IBsonSerializer
Inherited Members
JsonConverter.CanRead
JsonConverter.CanWrite
Extension Methods

Remarks

The optional Type constructor parameter specifies the target value type used during conversion.

Constructors

PatientObservationConverter(Type?)

Provides conversion logic for PatientObservation values, supporting JSON serialization through Newtonsoft.Json.JsonConverter<T> and BSON serialization through MongoDB.Bson.Serialization.IBsonSerializer.

public PatientObservationConverter(Type? valueType)

Parameters

valueType Type

Remarks

The optional Type constructor parameter specifies the target value type used during conversion.

Properties

ValueType

Gets the type of the value.

public Type? ValueType { get; }

Property Value

Type

The type of the value.

Methods

Deserialize(BsonDeserializationContext, BsonDeserializationArgs)

Deserializes a BSON value using the provided deserialization context and arguments.

public object Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)

Parameters

context BsonDeserializationContext

The deserialization context that provides the BSON reader and configuration.

args BsonDeserializationArgs

The deserialization arguments containing additional information for the operation.

Returns

object

An object representing the deserialized value.

Exceptions

NotImplementedException

Always thrown because the method is not yet implemented.

ReadJson(JsonReader, Type, PatientObservation?, bool, JsonSerializer)

Deserializes a JSON representation into a PatientObservation instance.

public override PatientObservation ReadJson(JsonReader reader, Type objectType, PatientObservation? existingValue, bool hasExistingValue, JsonSerializer serializer)

Parameters

reader JsonReader

The Newtonsoft.Json.JsonReader to read the JSON from.

objectType Type

The type of the object being deserialized.

existingValue PatientObservation

The existing value of the object to populate, or null if none.

hasExistingValue bool

Indicates whether existingValue contains a value to reuse.

serializer JsonSerializer

The Newtonsoft.Json.JsonSerializer used to read nested values.

Returns

PatientObservation

A PatientObservation instance produced from the JSON.

Exceptions

NotImplementedException

Thrown because the method has not been implemented yet.

Serialize(BsonSerializationContext, BsonSerializationArgs, object)

Serializes the specified value into a BSON format using the provided serialization context and arguments. This implementation is not yet provided and currently throws a NotImplementedException.

public void Serialize(BsonSerializationContext context, BsonSerializationArgs args, object value)

Parameters

context BsonSerializationContext

The BSON serialization context that provides access to the writer and configuration used during serialization.

args BsonSerializationArgs

The BSON serialization arguments containing additional information that may influence the serialization process.

value object

The object to be serialized into BSON.

Exceptions

NotImplementedException

Thrown because the serialization logic has not been implemented.

WriteJson(JsonWriter, PatientObservation?, JsonSerializer)

Serializes a PatientObservation instance to JSON, applying a string enum converter to the Status property and excluding the MessageTime property from the output. If the supplied value is null, nothing is written to the writer.

public override void WriteJson(JsonWriter writer, PatientObservation? value, JsonSerializer serializer)

Parameters

writer JsonWriter

The JSON writer that receives the serialized output.

value PatientObservation

The patient observation to serialize. When null, the method performs no serialization.

serializer JsonSerializer

The JSON serializer used during the conversion process.