Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement asynchronous support in ODataJsonLightBatchWriter #2111

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Microsoft.OData.Core/Batch/ODataBatchUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,13 @@ internal static ODataReadStream CreateBatchOperationReadStream(
/// <returns>A new <see cref="ODataWriteStream"/> instance.</returns>
internal static ODataWriteStream CreateBatchOperationWriteStream(
Stream outputStream,
IODataStreamListener operationListener)
IODataStreamListener operationListener,
bool synchronous = true)
{
Debug.Assert(outputStream != null, "outputStream != null");
Debug.Assert(operationListener != null, "operationListener != null");

return new ODataWriteStream(outputStream, operationListener);
return new ODataWriteStream(outputStream, operationListener, synchronous);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remind me what the synchronous argument does again? I remember it from a previous PR but don't remember what it was used for. I think it was used in the dispose methods, but I'm not quite sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference to #2109, ODataWriteStream previously had no way of telling whether we're writing synchronously or asynchronously. We address that gap by introducing this argument such that when the Dispose method is invoked, either of StreamDisposed or StreamDisposedAsync is called depending on the value passed for the argument.
This approach is necessitated by the fact that we support NET45 and NETSTANDARD1_1 both of which do not support IAsyncDisposable that would make it feasible to use DisposeAsync in asynchronous scenarios.

}

/// <summary>
Expand Down
Loading