Class DefaultSerializer
The default serializer for the Couchbase.NET SDK. Uses Newtonsoft.JSON as the the serializer.
Implements
Namespace: Couchbase.Core.IO.Serializers
Assembly: Couchbase.NetClient.dll
Syntax
public class DefaultSerializer : object, IExtendedTypeSerializer, IStreamingTypeDeserializer, IProjectableTypeDeserializer, ITypeSerializer
Constructors
| Improve this Doc View SourceDefaultSerializer()
Declaration
public DefaultSerializer()
DefaultSerializer(JsonSerializerSettings, JsonSerializerSettings)
Declaration
public DefaultSerializer(JsonSerializerSettings deserializationSettings, JsonSerializerSettings serializerSettings)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializerSettings | deserializationSettings | |
JsonSerializerSettings | serializerSettings |
Fields
| Improve this Doc View SourceRequiresDynamicCodeMessage
Declaration
public const string RequiresDynamicCodeMessage = null
Field Value
Type | Description |
---|---|
String |
UnreferencedCodeMessage
Declaration
public const string UnreferencedCodeMessage = null
Field Value
Type | Description |
---|---|
String |
Properties
| Improve this Doc View SourceDeserializationOptions
Provides custom deserialization options. Options not listed in SupportedDeserializationOptions will be ignored. If null, then defaults will be used.
Declaration
public DeserializationOptions DeserializationOptions { get; set; }
Property Value
Type | Description |
---|---|
DeserializationOptions |
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 |
---|---|
JsonSerializerSettings | 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 |
---|---|
JsonSerializerSettings | The outgoing serializer settings; controls the format of the JSON you are storing in Couchbase. |
SupportedDeserializationOptions
Informs consumers what deserialization options this IExtendedTypeSerializer supports.
Declaration
public SupportedDeserializationOptions SupportedDeserializationOptions { get; }
Property Value
Type | Description |
---|---|
SupportedDeserializationOptions |
Methods
| Improve this Doc View SourceCreateJsonStreamReader(Stream)
Create an IJsonStreamReader for parsing a
Declaration
public IJsonStreamReader CreateJsonStreamReader(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream |
Returns
Type | Description |
---|---|
IJsonStreamReader | The new IJsonStreamReader. |
CreateProjectionBuilder(ILogger)
Create a new IProjectionBuilder based on this serializer.
Declaration
public IProjectionBuilder CreateProjectionBuilder(ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | Logger for logging warnings or errors. |
Returns
Type | Description |
---|---|
IProjectionBuilder | A new IProjectionBuilder. |
Deserialize<T>(ReadOnlyMemory<Byte>)
Deserializes the specified buffer into the
Declaration
public T Deserialize<T>(ReadOnlyMemory<byte> buffer)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyMemory<Byte> | buffer | The buffer to deserialize from. |
Returns
Type | Description |
---|---|
T | The |
Type Parameters
Name | Description |
---|---|
T | The |
Deserialize<T>(Stream)
Deserializes the specified stream into the
Declaration
public T Deserialize<T>(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream. |
Returns
Type | Description |
---|---|
T | The |
Type Parameters
Name | Description |
---|---|
T | The |
DeserializeAsync<T>(Stream, CancellationToken)
Deserializes the specified stream into the
Declaration
public ValueTask<T> DeserializeAsync<T>(Stream stream, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream. |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
ValueTask<T> | The |
Type Parameters
Name | Description |
---|---|
T | The |
GetDeserializationSettings(JsonSerializerSettings, DeserializationOptions)
Declaration
protected virtual JsonSerializerSettings GetDeserializationSettings(JsonSerializerSettings baseSettings, DeserializationOptions options)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializerSettings | baseSettings | |
DeserializationOptions | options |
Returns
Type | Description |
---|---|
JsonSerializerSettings |
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 |
---|---|---|
MemberInfo | member | Returns the name of this member. |
Returns
Type | Description |
---|---|
Nullable<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
Serialize(Stream, Nullable<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. |
Nullable<Object> | obj | The object to serialize. |
SerializeAsync(Stream, Nullable<Object>, CancellationToken)
Serializes the specified object onto a stream.
Declaration
public ValueTask SerializeAsync(Stream stream, object? obj, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream to receive the serialized object. |
Nullable<Object> | obj | The object to serialize. |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
ValueTask |