You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show how to read large field values (e.g. strings, binary values) into streams with ODataMessageReader #337
When you have fields which large values, usually strings or binary data encoded as base64 strings, deserializing these fields might lead to large heap allocations due to reading the entire value into memory. ODataMessageWriter exposes a ReadAsStreamFunc property that the user can assign a delegate that returns true for any property that should be deserialized into a stream. This feature is not documented but is useful work performance-sensitive services working which large payloads.
Basically, there are two steps:
Register a ReadAsStreamFunc on the message writer settings which return true for the properties that you want to stream. ODL will call your function for each property and, if you return true, will enter a new reader state ODataReaderState.Stream.
Handle the ODataReaderState.Stream state by creating stream or text reader, depending on the type of the property, and read the stream.
Activity