Skip to content

SerializerExtensions class

Defined in

Namespace: Akavache.SystemTextJson Assembly: Akavache.SystemTextJson.Bson.dll Full name: Akavache.SystemTextJson.SerializerExtensions Modifiers: public static

Summary

View source

Extension methods that expose the AOT-safe JsonTypeInfo overloads of ISerializer from the System.Text.Json-backed serializers without pulling System.Text.Json into Akavache.Core.

Applies to

net10.0, net10.0-tvos26.0, net10.0-maccatalyst26.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net10.0-macos26.0, net10.0-windows10.0.19041, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-windows10.0.19041, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-macos14.2, net8.0-maccatalyst17.5, net8.0-ios17.5, net8.0-tvos17.2, net8.0-windows10.0.19041, net8.0-macos14.5, netstandard2.1, net481, net462, net471

Remarks

These extensions dispatch to the concrete SystemJsonSerializer or SystemJsonBsonSerializer instance when the runtime ISerializer is backed by one of them. For every other serializer implementation (for example the Newtonsoft-backed ones) they throw NotSupportedException — those serializers can still be used via the non-typed [Deserialize][M:Akavache.ISerializer.Deserialize--1(System.Byte[])] / Serialize overloads.

This indirection keeps Akavache.Core free of a hard dependency on System.Text.Json, so Newtonsoft-only consumers do not transitively pull it in. Callers that need AOT-safe serialization add the Akavache.SystemTextJson.Bson package reference (which transitively brings in Akavache.SystemTextJson) and import this namespace.

Methods

NameSummary
static DeserializeDeserializes bytes into a T using the AOT-safe JsonTypeInfo metadata path.
static SerializeSerializes item to bytes using the AOT-safe JsonTypeInfo metadata path.
Inherited members