Dela via


JsonMessageFormatter Class

Definition

Uses Newtonsoft.Json serialization to serialize JsonRpcMessage as JSON (text).

public class JsonMessageFormatter : StreamJsonRpc.IJsonRpcMessageTextFormatter
public class JsonMessageFormatter : StreamJsonRpc.IJsonRpcAsyncMessageTextFormatter
public class JsonMessageFormatter : IDisposable, StreamJsonRpc.IJsonRpcAsyncMessageTextFormatter, StreamJsonRpc.IJsonRpcInstanceContainer, StreamJsonRpc.IJsonRpcMessageFactory, StreamJsonRpc.Reflection.IJsonRpcFormatterState
public class JsonMessageFormatter : StreamJsonRpc.FormatterBase, StreamJsonRpc.IJsonRpcAsyncMessageTextFormatter, StreamJsonRpc.IJsonRpcMessageFactory
public class JsonMessageFormatter : IDisposable, StreamJsonRpc.IJsonRpcAsyncMessageTextFormatter, StreamJsonRpc.IJsonRpcInstanceContainer
public class JsonMessageFormatter : IDisposable, StreamJsonRpc.IJsonRpcAsyncMessageTextFormatter, StreamJsonRpc.IJsonRpcInstanceContainer, StreamJsonRpc.Reflection.IJsonRpcFormatterState
type JsonMessageFormatter = class
    interface IJsonRpcMessageTextFormatter
    interface IJsonRpcMessageFormatter
type JsonMessageFormatter = class
    interface IJsonRpcAsyncMessageTextFormatter
    interface IJsonRpcAsyncMessageFormatter
    interface IJsonRpcMessageFormatter
    interface IJsonRpcMessageTextFormatter
type JsonMessageFormatter = class
    interface IJsonRpcAsyncMessageTextFormatter
    interface IJsonRpcAsyncMessageFormatter
    interface IJsonRpcMessageFormatter
    interface IJsonRpcMessageTextFormatter
    interface IJsonRpcFormatterState
    interface IJsonRpcInstanceContainer
    interface IJsonRpcMessageFactory
    interface IDisposable
type JsonMessageFormatter = class
    inherit FormatterBase
    interface IJsonRpcAsyncMessageTextFormatter
    interface IJsonRpcAsyncMessageFormatter
    interface IJsonRpcMessageFormatter
    interface IJsonRpcMessageTextFormatter
    interface IJsonRpcMessageFactory
type JsonMessageFormatter = class
    interface IJsonRpcAsyncMessageTextFormatter
    interface IJsonRpcAsyncMessageFormatter
    interface IJsonRpcMessageFormatter
    interface IJsonRpcMessageTextFormatter
    interface IJsonRpcInstanceContainer
    interface IDisposable
type JsonMessageFormatter = class
    interface IJsonRpcAsyncMessageTextFormatter
    interface IJsonRpcAsyncMessageFormatter
    interface IJsonRpcMessageFormatter
    interface IJsonRpcMessageTextFormatter
    interface IJsonRpcFormatterState
    interface IJsonRpcInstanceContainer
    interface IDisposable
Public Class JsonMessageFormatter
Implements IJsonRpcMessageTextFormatter
Public Class JsonMessageFormatter
Implements IJsonRpcAsyncMessageTextFormatter
Public Class JsonMessageFormatter
Implements IDisposable, IJsonRpcAsyncMessageTextFormatter, IJsonRpcFormatterState, IJsonRpcInstanceContainer, IJsonRpcMessageFactory
Public Class JsonMessageFormatter
Inherits FormatterBase
Implements IJsonRpcAsyncMessageTextFormatter, IJsonRpcMessageFactory
Public Class JsonMessageFormatter
Implements IDisposable, IJsonRpcAsyncMessageTextFormatter, IJsonRpcInstanceContainer
Public Class JsonMessageFormatter
Implements IDisposable, IJsonRpcAsyncMessageTextFormatter, IJsonRpcFormatterState, IJsonRpcInstanceContainer
Inheritance
JsonMessageFormatter
Inheritance
JsonMessageFormatter
Implements

Remarks

Each instance of this class may only be used with a single JsonRpc instance.

Constructors

JsonMessageFormatter()

Initializes a new instance of the JsonMessageFormatter class that uses JsonProgress (without the preamble) for its text encoding.

JsonMessageFormatter(Encoding)

Initializes a new instance of the JsonMessageFormatter class.

Properties

ApplicableMethodAttributeOnDeserializingMethod

Gets the JsonRpcMethodAttribute that is present on the method that may be invoked to serve the incoming request, when applicable.

(Inherited from FormatterBase)
DuplexPipeTracker

Gets the helper for marshaling pipes as RPC method arguments.

(Inherited from FormatterBase)
Encoding

Gets or sets the encoding to use for transmitted messages.

EnumerableTracker

Gets the helper for marshaling IAsyncEnumerable<T> in RPC method arguments or return values.

(Inherited from FormatterBase)
FormatterProgressTracker

Gets the MessageFormatterProgressTracker instance containing useful methods to help on the implementation of message formatters.

(Inherited from FormatterBase)
JsonRpc

Gets the JsonRpc that is associated with this formatter.

(Inherited from FormatterBase)
JsonSerializer

Gets the Newtonsoft.Json.JsonSerializer used when serializing and deserializing method arguments and return values.

MultiplexingStream

Gets or sets the MultiplexingStream that may be used to establish out of band communication (e.g. marshal IDuplexPipe arguments).

ProtocolVersion

Gets or sets the version of the JSON-RPC protocol emulated by this instance.

Methods

Deserialize(JToken)

Deserializes a Newtonsoft.Json.Linq.JToken to a JsonRpcMessage.

Deserialize(ReadOnlySequence<Byte>, Encoding)

Deserializes a sequence of bytes to a JsonRpcMessage.

Deserialize(ReadOnlySequence<Byte>)

Deserializes a JsonRpcMessage.

DeserializeAsync(PipeReader, CancellationToken)

Deserializes a JsonRpcMessage.

DeserializeAsync(PipeReader, Encoding, CancellationToken)

Deserializes a sequence of bytes to a JsonRpcMessage.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Dispose() (Inherited from FormatterBase)
Dispose(Boolean)

Disposes managed and native resources held by this instance.

GetJsonText(JsonRpcMessage)

Gets a JSON representation for a given message for tracing purposes.

Serialize(IBufferWriter<Byte>, JsonRpcMessage)

Serializes a JsonRpcMessage.

Serialize(JsonRpcMessage)

Serializes a JsonRpcMessage to a Newtonsoft.Json.Linq.JToken.

TrackDeserialization(JsonRpcMessage, ReadOnlySpan<ParameterInfo>)

Sets up state to track deserialization of a message.

(Inherited from FormatterBase)
TrackSerialization(JsonRpcMessage)

Sets up state to track serialization of a message.

(Inherited from FormatterBase)

Explicit Interface Implementations

IJsonRpcFormatterState.DeserializingMessageWithId

Gets the ID of the response currently being deserialized.

IJsonRpcFormatterState.DeserializingMessageWithId

Gets the ID of the response currently being deserialized.

(Inherited from FormatterBase)
IJsonRpcFormatterState.SerializingMessageWithId

Gets the id of the request or response currently being serialized.

IJsonRpcFormatterState.SerializingMessageWithId

Gets the id of the request or response currently being serialized.

(Inherited from FormatterBase)
IJsonRpcFormatterState.SerializingRequest

Gets a value indicating whether a JsonRpcRequest is being serialized.

IJsonRpcFormatterState.SerializingRequest

Gets a value indicating whether a JsonRpcRequest is being serialized.

(Inherited from FormatterBase)
IJsonRpcInstanceContainer.Rpc

Sets the JsonRpc instance.

IJsonRpcInstanceContainer.Rpc

Sets the JsonRpc instance.

(Inherited from FormatterBase)
IJsonRpcMessageFactory.CreateErrorMessage()

Creates an instance of JsonRpcError suitable for transmission over the IJsonRpcMessageFormatter.

IJsonRpcMessageFactory.CreateRequestMessage()

Creates an instance of JsonRpcRequest suitable for transmission over the IJsonRpcMessageFormatter.

IJsonRpcMessageFactory.CreateResultMessage()

Creates an instance of JsonRpcResult suitable for transmission over the IJsonRpcMessageFormatter.

Applies to