Skip to content

Commit

Permalink
Implement asynchronous support in ODataJsonLightDeltaWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
John Gathogo committed Jun 8, 2021
1 parent 3c68c51 commit 17618c2
Show file tree
Hide file tree
Showing 5 changed files with 2,720 additions and 359 deletions.
18 changes: 9 additions & 9 deletions src/Microsoft.OData.Core/JsonLight/ODataJsonLightDeltaWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public override void WriteStart(ODataDeltaResourceSet deltaResourceSet)
/// <returns>A task instance that represents the asynchronous write operation.</returns>
public override Task WriteStartAsync(ODataDeltaResourceSet deltaResourceSet)
{
return TaskUtils.GetTaskForSynchronousOperation(() => this.resourceWriter.WriteStart(deltaResourceSet));
return this.resourceWriter.WriteStartAsync(deltaResourceSet);
}

/// <summary>
Expand All @@ -140,7 +140,7 @@ public override void WriteEnd()
/// <returns>A task instance that represents the asynchronous write operation.</returns>
public override Task WriteEndAsync()
{
return TaskUtils.GetTaskForSynchronousOperation(() => this.resourceWriter.WriteEnd());
return this.resourceWriter.WriteEndAsync();
}

/// <summary>
Expand All @@ -159,7 +159,7 @@ public override void WriteStart(ODataNestedResourceInfo nestedResourceInfo)
/// <returns>A task instance that represents the asynchronous write operation.</returns>
public override Task WriteStartAsync(ODataNestedResourceInfo nestedResourceInfo)
{
return TaskUtils.GetTaskForSynchronousOperation(() => this.resourceWriter.WriteStart(nestedResourceInfo));
return this.resourceWriter.WriteStartAsync(nestedResourceInfo);
}

/// <summary>
Expand All @@ -178,7 +178,7 @@ public override void WriteStart(ODataResourceSet expandedResourceSet)
/// <returns>A task instance that represents the asynchronous write operation.</returns>
public override Task WriteStartAsync(ODataResourceSet expandedResourceSet)
{
return TaskUtils.GetTaskForSynchronousOperation(() => this.resourceWriter.WriteStart(expandedResourceSet));
return this.resourceWriter.WriteStartAsync(expandedResourceSet);
}

/// <summary>
Expand All @@ -197,7 +197,7 @@ public override void WriteStart(ODataResource deltaResource)
/// <returns>A task instance that represents the asynchronous write operation.</returns>
public override Task WriteStartAsync(ODataResource deltaResource)
{
return TaskUtils.GetTaskForSynchronousOperation(() => this.resourceWriter.WriteStart(deltaResource));
return this.resourceWriter.WriteStartAsync(deltaResource);
}

/// <summary>
Expand All @@ -217,7 +217,7 @@ public override void WriteDeltaDeletedEntry(ODataDeltaDeletedEntry deltaDeletedE
/// <returns>A task instance that represents the asynchronous write operation.</returns>
public override Task WriteDeltaDeletedEntryAsync(ODataDeltaDeletedEntry deltaDeletedEntry)
{
return TaskUtils.GetTaskForSynchronousOperation(() => this.resourceWriter.WriteStart(ODataDeltaDeletedEntry.GetDeletedResource(deltaDeletedEntry)));
return this.resourceWriter.WriteStartAsync(ODataDeltaDeletedEntry.GetDeletedResource(deltaDeletedEntry));
}

/// <summary>
Expand All @@ -236,7 +236,7 @@ public override void WriteDeltaLink(ODataDeltaLink deltaLink)
/// <returns>A task instance that represents the asynchronous write operation.</returns>
public override Task WriteDeltaLinkAsync(ODataDeltaLink deltaLink)
{
return TaskUtils.GetTaskForSynchronousOperation(() => this.resourceWriter.WriteDeltaLink(deltaLink));
return this.resourceWriter.WriteDeltaLinkAsync(deltaLink);
}

/// <summary>
Expand All @@ -255,7 +255,7 @@ public override void WriteDeltaDeletedLink(ODataDeltaDeletedLink deltaDeletedLin
/// <returns>A task instance that represents the asynchronous write operation.</returns>
public override Task WriteDeltaDeletedLinkAsync(ODataDeltaDeletedLink deltaDeletedLink)
{
return TaskUtils.GetTaskForSynchronousOperation(() => this.resourceWriter.WriteDeltaDeletedLink(deltaDeletedLink));
return this.resourceWriter.WriteDeltaDeletedLinkAsync(deltaDeletedLink);
}

/// <summary>
Expand Down Expand Up @@ -290,7 +290,7 @@ void IODataOutputInStreamErrorListener.OnInStreamError()
/// <inheritdoc/>
Task IODataOutputInStreamErrorListener.OnInStreamErrorAsync()
{
throw new NotImplementedException();
return this.inStreamErrorListener.OnInStreamErrorAsync();
}

#endregion
Expand Down
Loading

0 comments on commit 17618c2

Please sign in to comment.