Show / Hide Table of Contents

    Class NewtonsoftJsonMessageSerializer<TMessage>

    Serializes and deserializes the messages of type TMessage in JSON format.

    Inheritance
    object
    NewtonsoftJsonMessageSerializerBase
    NewtonsoftJsonMessageSerializer<TMessage>
    Implements
    IMessageSerializer
    IEquatable<NewtonsoftJsonMessageSerializer<TMessage>>
    Inherited Members
    NewtonsoftJsonMessageSerializerBase.Encoding
    NewtonsoftJsonMessageSerializerBase.Settings
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Silverback.Messaging.Serialization
    Assembly: Silverback.Integration.Newtonsoft.dll
    Syntax
    public sealed class NewtonsoftJsonMessageSerializer<TMessage> : NewtonsoftJsonMessageSerializerBase, IMessageSerializer, IEquatable<NewtonsoftJsonMessageSerializer<TMessage>>
    Type Parameters
    Name Description
    TMessage

    The type of the messages to be serialized and/or deserialized.

    Properties

    | Improve this doc View source

    RequireHeaders

    Gets a value indicating whether headers are mandatory for this serializer implementation or configuration to work properly.

    Declaration
    public override bool RequireHeaders { get; }
    Property Value
    Type Description
    bool
    Overrides
    NewtonsoftJsonMessageSerializerBase.RequireHeaders

    Methods

    | Improve this doc View source

    DeserializeAsync(Stream?, MessageHeaderCollection, MessageSerializationContext)

    Deserializes the byte array back into a message object.

    Declaration
    public override ValueTask<(object? Message, Type MessageType)> DeserializeAsync(Stream? messageStream, MessageHeaderCollection messageHeaders, MessageSerializationContext context)
    Parameters
    Type Name Description
    Stream messageStream

    The Stream containing the message to be deserialized.

    MessageHeaderCollection messageHeaders

    The message headers collection.

    MessageSerializationContext context

    The context information.

    Returns
    Type Description
    ValueTask<(object Message, Type MessageType)>

    A Task<TResult> representing the asynchronous operation. The task result contains the deserialized message (or null when the input is null or empty) and the type of the message.

    Overrides
    NewtonsoftJsonMessageSerializerBase.DeserializeAsync(Stream?, MessageHeaderCollection, MessageSerializationContext)
    | Improve this doc View source

    Equals(NewtonsoftJsonMessageSerializer<TMessage>?)

    Indicates whether the current object is equal to another object of the same type.

    Declaration
    public bool Equals(NewtonsoftJsonMessageSerializer<TMessage>? other)
    Parameters
    Type Name Description
    NewtonsoftJsonMessageSerializer<TMessage> other

    An object to compare with this object.

    Returns
    Type Description
    bool

    true if the current object is equal to the other parameter; otherwise, false.

    | Improve this doc View source

    Equals(object?)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object? obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)
    | Improve this doc View source

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()
    | Improve this doc View source

    SerializeAsync(object?, MessageHeaderCollection, MessageSerializationContext)

    Serializes the specified message object into a byte array.

    Declaration
    public override ValueTask<Stream?> SerializeAsync(object? message, MessageHeaderCollection messageHeaders, MessageSerializationContext context)
    Parameters
    Type Name Description
    object message

    The message object to be serialized.

    MessageHeaderCollection messageHeaders

    The message headers collection.

    MessageSerializationContext context

    The context information.

    Returns
    Type Description
    ValueTask<Stream>

    A Task<TResult> representing the asynchronous operation. The task result contains the Stream with the serialized message.

    Overrides
    NewtonsoftJsonMessageSerializerBase.SerializeAsync(object?, MessageHeaderCollection, MessageSerializationContext)

    Implements

    IMessageSerializer
    IEquatable<T>
    • Improve this doc
    • View source
    GitHub E-Mail
    ↑ Back to top © 2020 Sergio Aquilini