BusinessSegmentJsonConverter Class

JSON Serializer for BusinessSegmentDto objects.

Definition

Namespace: MobileTrack.Common.Services.JsonConverters.BusinessObjects
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.7+45c8d9adb5970d727cceec44a5ed61aea0016e50
internal sealed class BusinessSegmentJsonConverter : JsonConverter<BusinessSegmentDto[]>
Inheritance
Object    JsonConverter    JsonConverterBusinessSegmentDto    BusinessSegmentJsonConverter

Remarks

Unlike other objects, the business segment serialization is designed to be as small and performant as physically possible, and not concern ourselves with type safety and providing ourselves insights in the database.

The dataset of a BusinessSegmentDto is exactly 64 bytes; 16 for the Guid ID, and another 48 bytes for the Label. The Label is truncated or padded with empty chars to make it exactly 24 characters. The serialization is done by copying memory from the struct to a char array of 32 (char is 2 bytes, therefore 64 bytes) and back.
For de-serialization the same is done but in reverse.

Constructors

BusinessSegmentJsonConverterInitializes a new instance of the BusinessSegmentJsonConverter class

Methods

ReadReads and converts the JSON to type T.
(Overrides JsonConverterTRead(Utf8JsonReader, Type, JsonSerializerOptions))
WriteWrites a specified value as JSON.
(Overrides JsonConverterTWrite(Utf8JsonWriter, T, JsonSerializerOptions))

See Also