HAKOM.Serialization.Core.Net Assembly
Provides the core serialization infrastructure for the HAKOM platform, enabling media-type-driven serialization and deserialization of objects to and from streams.
Remarks
Section titled “Remarks”This assembly contains the foundational interfaces, abstract base classes, and default implementations
for JSON, XML, and binary serialization. It follows a factory-based architecture where serializers
are selected at runtime based on media type (e.g. application/json, application/xml).
The primary entry point is ISerializerFactory, which creates ISerializer<TData> instances matched via IMediaTypeMatcher registrations. Serialization parameters (encoding, casing, number format, etc.) are parsed from media type headers using the ISerializationParametersFactory<TParameters> hierarchy.
Registering serialization services:using HAKOM.DependencyInjection.Core.Net.Api;using HAKOM.Serialization.Core.Net.Api.Extensions;
container .UseSerializerFactory() .UseJsonSerialization() .UseDefaultJsonSerializer() .UseXmlSerialization();ISerializerFactory factory = /* resolved from container */;ISerializer<MyDto> serializer = factory.Create<MyDto>("application/json");using Stream output = new MemoryStream();await serializer.Serialize(myDto, output);| Namespaces | |
|---|---|
| HAKOM.Serialization.Core.Net.Api | Contains the public API surface for core serialization, including the ISerializer and ISerializer<TData> contracts, the ISerializerFactory for creating serializers by media type, the IMediaTypeMatcher for matching types to serializers, and the Serializer<TData,TParameters> base class for custom serializer implementations. |
| HAKOM.Serialization.Core.Net.Api.Binary | Provides interfaces for binary-level value conversion via IBinaryConverter<TValue>, enabling efficient byte-array serialization and deserialization of primitive value types such as System.Double. |
| HAKOM.Serialization.Core.Net.Api.Binary.Extensions | Provides dependency injection extension methods for registering default IBinaryConverter<TValue> implementations with the IContainer. |
| HAKOM.Serialization.Core.Net.Api.Exceptions | Contains all exceptions related to serialization and deserialization operations. Every exception in this namespace inherits from SerializationException (which itself derives from HakomException), carries a unique HAKOM error code, and maps to an appropriate HTTP status code. |
| HAKOM.Serialization.Core.Net.Api.Exceptions.UnsupportedMediaTypeExceptions | Contains exceptions that indicate unsupported media type parameters. The abstract UnsupportedMediaTypeParameterException serves as the base class, with concrete subclasses for specific parameter violations such as unsupported character set encodings. |
| HAKOM.Serialization.Core.Net.Api.Exceptions.UnsupportedMediaTypeExceptions.UnsupportedMediaTypeParameterExceptions | Contains concrete exceptions for specific unsupported media type parameter values, such as UnsupportedEncodingException which is thrown when a requested character set encoding is not supported by the serializer. |
| HAKOM.Serialization.Core.Net.Api.Extensions | Provides extension methods for configuring serialization services in the IContainer, as well as string conversion utilities (e.g. PascalCase, camelCase, snake_case) used throughout the serialization infrastructure. |
| HAKOM.Serialization.Core.Net.Api.Json | Provides JSON serialization support including the JsonSerializer<TData> abstract base class, IJsonSerializationParameters for controlling JSON-specific settings (casing, indentation, number format), and delegate types for contract-based and factory-based serialization patterns. |
| HAKOM.Serialization.Core.Net.Api.Json.Exceptions | Contains JSON-specific serialization exceptions such as DoubleParsingInvalidJsonTokenTypeException, which is thrown when a JSON token type is incompatible with the expected numeric value during deserialization. |
| HAKOM.Serialization.Core.Net.Api.Json.Extensions | Provides extension methods for integrating HAKOM serializers with System.Text.Json.JsonSerializerOptions, enabling the use of ISerializer<TData> implementations as System.Text.Json.Serialization.JsonConverter instances within the System.Text.Json pipeline. |
| HAKOM.Serialization.Core.Net.Api.Parametrization | Provides the parameter model for serialization, defining how media type header values are parsed into strongly-typed parameter objects. The hierarchy starts with ISerializationParameters (time zone, version), extends through ITextSerializationParameters (charset, time format), and includes corresponding abstract base classes and factory types. |
| HAKOM.Serialization.Core.Net.Api.Xml | Provides XML serialization support including the XmlSerializer<TData> abstract base class and the IXmlSerializationParameters interface for controlling XML-specific serialization settings parsed from media type headers. |