Class RoundTripJsonOutputFormatter
Handles serialization of JSON objects for noSQL scenarios that supports round trips without any property loss, even if one side of the transaction is out of data and is not aware of all of the possible JSON properties.
This class is designed to support classes generated by the Neon.ModelGen assembly that implement IRoundtripData.
Namespace: Neon.Web
Assembly: Neon.Web.dll
Syntax
public sealed class RoundTripJsonOutputFormatter : TextOutputFormatter
Constructors
RoundTripJsonOutputFormatter(Func<Type, bool>)
Constructor.
Declaration
public RoundTripJsonOutputFormatter(Func<Type, bool> allowRoundtripFormatter = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Type, bool> | allowRoundtripFormatter | Optional lamba function that returns |
Methods
CanWriteType(Type)
Returns a value indicating whether or not the given type can be written by this serializer.
Declaration
protected override bool CanWriteType(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The object type. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
WriteResponseBodyAsync(OutputFormatterWriteContext, Encoding)
Writes the response body.
Declaration
public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
Parameters
| Type | Name | Description |
|---|---|---|
| OutputFormatterWriteContext | context | The formatter context associated with the call. |
| Encoding | selectedEncoding | The Encoding that should be used to write the response. |
Returns
| Type | Description |
|---|---|
| Task | A task which can write the response body. |