Class DefaultSerializer
The default serializer for the Couchbase.NET SDK. Uses Newtonsoft.JSON as the the serializer.
Implements
Inherited Members
Namespace: Couchbase.Core.IO.Serializers
Assembly: Couchbase.NetClient.dll
Syntax
public class DefaultSerializer : IExtendedTypeSerializer, IStreamingTypeDeserializer, IProjectableTypeDeserializer, ITypeSerializer
Constructors
| Edit this page View SourceDefaultSerializer()
Declaration
public DefaultSerializer()
DefaultSerializer(JsonSerializerSettings, JsonSerializerSettings)
Declaration
public DefaultSerializer(JsonSerializerSettings deserializationSettings, JsonSerializerSettings serializerSettings)
Parameters
Type | Name | Description |
---|---|---|
Json |
deserializationSettings | |
Json |
serializerSettings |
Fields
| Edit this page View SourceRequiresDynamicCodeMessage
Declaration
public const string RequiresDynamicCodeMessage = "The DefaultSerializer uses Newtonsoft.Json which requires dynamic code and is incompatible with AOT."
Field Value
Type | Description |
---|---|
string |
UnreferencedCodeMessage
Declaration
public const string UnreferencedCodeMessage = "The DefaultSerializer uses Newtonsoft.Json which requires unreferenced code and is incompatible with trimming."
Field Value
Type | Description |
---|---|
string |
Properties
| Edit this page View SourceDeserializationOptions
Provides custom deserialization options. Options not listed in Supported
Declaration
public DeserializationOptions? DeserializationOptions { get; set; }
Property Value
Type | Description |
---|---|
Deserialization |
DeserializationSettings
Gets the incoming de-serializer settings; controls the format of the incoming JSON for de-serialization into POCOs.
Declaration
public JsonSerializerSettings DeserializationSettings { get; }
Property Value
Type | Description |
---|---|
Json |
The incoming serializer settings. |
SerializerSettings
Gets the outgoing serializer settings; controls the format of the JSON you are storing in Couchbase.
Declaration
public JsonSerializerSettings SerializerSettings { get; }
Property Value
Type | Description |
---|---|
Json |
The outgoing serializer settings; controls the format of the JSON you are storing in Couchbase. |
SupportedDeserializationOptions
Informs consumers what deserialization options this IExtended
Declaration
public SupportedDeserializationOptions SupportedDeserializationOptions { get; }
Property Value
Type | Description |
---|---|
Supported |
Methods
| Edit this page View SourceCreateJsonStreamReader(Stream)
Create an IJson
Declaration
public IJsonStreamReader CreateJsonStreamReader(Stream stream)
Parameters
Returns
Type | Description |
---|---|
IJson |
The new IJson |
CreateProjectionBuilder(ILogger)
Create a new IProjection
Declaration
public IProjectionBuilder CreateProjectionBuilder(ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | Logger for logging warnings or errors. |
Returns
Type | Description |
---|---|
IProjection |
A new IProjection |
DeserializeAsync<T>(Stream, CancellationToken)
Deserializes the specified stream into the Type T specified as a generic parameter.
Declaration
public ValueTask<T?> DeserializeAsync<T>(Stream stream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream. |
Cancellation |
cancellationToken | Cancellation token. |
Returns
Type Parameters
Name | Description |
---|---|
T | The Type specified as the type of the value. |
Deserialize<T>(Stream)
Deserializes the specified stream into the Type T specified as a generic parameter.
Declaration
public T? Deserialize<T>(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream. |
Returns
Type | Description |
---|---|
T | The Type instance representing the value of the key. |
Type Parameters
Name | Description |
---|---|
T | The Type specified as the type of the value. |
Deserialize<T>(ReadOnlyMemory<byte>)
Deserializes the specified buffer into the Type T specified as a generic parameter.
Declaration
public T? Deserialize<T>(ReadOnlyMemory<byte> buffer)
Parameters
Type | Name | Description |
---|---|---|
Read |
buffer | The buffer to deserialize from. |
Returns
Type | Description |
---|---|
T | The Type instance representing the value of the key. |
Type Parameters
Name | Description |
---|---|
T | The Type specified as the type of the value. |
GetDeserializationSettings(JsonSerializerSettings, DeserializationOptions?)
Declaration
protected virtual JsonSerializerSettings GetDeserializationSettings(JsonSerializerSettings baseSettings, DeserializationOptions? options)
Parameters
Type | Name | Description |
---|---|---|
Json |
baseSettings | |
Deserialization |
options |
Returns
Type | Description |
---|---|
Json |
GetMemberName(MemberInfo)
Get the name which will be used for a given member during serialization/deserialization.
Declaration
public string? GetMemberName(MemberInfo member)
Parameters
Type | Name | Description |
---|---|---|
Member |
member | Returns the name of this member. |
Returns
Type | Description |
---|---|
string | The name which will be used for a given member during serialization/deserialization, or null if if will not be serialized. |
Remarks
DefaultSerializer uses Newtonsoft.
Serialize(Stream, object?)
Serializes the specified object onto a stream.
Declaration
public void Serialize(Stream stream, object? obj)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream to receive the serialized object. |
object | obj | The object to serialize. |
SerializeAsync(Stream, object?, CancellationToken)
Serializes the specified object onto a stream.
Declaration
public ValueTask SerializeAsync(Stream stream, object? obj, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream to receive the serialized object. |
object | obj | The object to serialize. |
Cancellation |
cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Value |