OData / odata.net

ODataLib: Open Data Protocol - .NET Libraries and Frameworks
https://docs.microsoft.com/odata
Other
687 stars 349 forks source link

Allow `ODataUtf8JsonWriter` buffer size to be configurable by the user. #3100

Open habbes opened 3 weeks ago

habbes commented 3 weeks ago

A customer wants to be able to configure the buffer size of ODataUtf8JsonWriter, e.g. increase the buffer size to reduce how frequent stream I/O is invoked. While ODataUtf8JsonWriter accepts a buffer size as a constructor parameter, this parameter is not exposed on the IJsonWriterFactory interface or any of the built-in implementations of that interface. ODataMessageWriter has a BufferSize property, but that's only used when using the "older" JsonWriter.

There are some existing design issues that make this feature request less straightforward:

If the issue https://github.com/OData/odata.net/issues/3099 is addressed, a workaround would be for the user to wrap the output stream behind a custom stream implementation that intercepts writes and users a buffer size the user desires, then pass that stream to ODataMessageWriter.

Assemblies affected

Microsoft.OData.Core 7.x and 8.x

Reproduce steps

N/A

Expected result

There's no way for the user to configure the ODataUtf8JsonWriter buffer size

Actual result

There should be a way to control the buffer size of ODataUtf8JsonWriter