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
-
JsonConverterJsonConverter<PatientObservation>PatientObservationConverter
- Implements
-
IBsonSerializer
- Inherited Members
-
JsonConverter.CanReadJsonConverter.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
valueTypeType
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
contextBsonDeserializationContextThe deserialization context that provides the BSON reader and configuration.
argsBsonDeserializationArgsThe 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
readerJsonReaderThe Newtonsoft.Json.JsonReader to read the JSON from.
objectTypeTypeThe type of the object being deserialized.
existingValuePatientObservationThe existing value of the object to populate, or null if none.
hasExistingValueboolIndicates whether
existingValuecontains a value to reuse.serializerJsonSerializerThe 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
contextBsonSerializationContextThe BSON serialization context that provides access to the writer and configuration used during serialization.
argsBsonSerializationArgsThe BSON serialization arguments containing additional information that may influence the serialization process.
valueobjectThe 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
writerJsonWriterThe JSON writer that receives the serialized output.
valuePatientObservationThe patient observation to serialize. When
null, the method performs no serialization.serializerJsonSerializerThe JSON serializer used during the conversion process.