-
Notifications
You must be signed in to change notification settings - Fork 349
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
Cherry-pick b94324c from 8.x to 7.x: Provide async APIs for CsdlWriter and SchemaWriter (#3006) #3060
Cherry-pick b94324c from 8.x to 7.x: Provide async APIs for CsdlWriter and SchemaWriter (#3006) #3060
Conversation
* Add corresponding async methods for syncronous methods of EdmModelCsdlSchemaJsonWriter * Implemented asynchronous counterparts for synchronous virtual and abstract methods for EdmModelCsdlSchemaWriter class * Added asynchronous implementations for the synchronous methods in EdmModelCsdlSchemaXmlWriter * Added corresponding asynchronous methods for EdmModelReferenceElementsJsonVisitor, EdmModelCsdlSerializationVisitor and EdmModelReferenceElementsXmlVisitor * Added asynchronous counterparts for csdl writer methods * Added async corresponding sync methods for EdmModelVisitor * Fix WriteStartElementAsync prefix and namespace missing * Added csdl async/await and functional tests for csdl writer async methods * Added async APIs to net48 public API * Fixed comments to add ConfigureAwait(false) * Added configureAwait(false) to await tests * Elude await/async in BeginElementAsync method Func<TElement, Task> params * Rewrite the doc string of the async methods to add <returns> and provide correct summary * Rewrite WriteSchemata to WriteSchema * Move the asynhronous tests to .Async partial classes * Added ContextUrlWriterReaderTests.Async partial class with async tests and fix asynhronous equal true when writing xml * Added doc string for <params></params> * Resolve missing spaces * Added Returns Documentation string for WriteCsdlAsync * Remove unnecessary 'else' * Added WriteMetadataDocumentAsync methods and tests * Rename test functions for WriteMetadataDocumentAsync * Renaming WriteSchema to WriteSchemas and WriteSchemaAsync to WriteSchemasAsync * Provide the correct file in copyright for the added files * Rename partial class OasisActionsFunctionsRelationshipChangesAcceptanceTests to OasisActionsFunctionsRelationshipChangesAcceptanceTest to reuse the methods used in main class OasisActionsFunctionsRelationshipChangesAcceptanceTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems there's a lot of cases where we use Task.FromResult(0)
where Task.CompletedTask
appears to be more appropriate, and there are cases missing ConfigureAwait(false)
.
…ing ConfigureAwait(false)
/// <param name="error">The error instance to write.</param> | ||
/// <param name="includeDebugInformation">A flag indicating whether error details should be written (in debug mode only) or not.</param> | ||
/// <param name="maxInnerErrorDepth">The maximum number of nested inner errors to allow.</param> | ||
internal static async Task WriteXmlErrorAsync(XmlWriter writer, ODataError error, bool includeDebugInformation, int maxInnerErrorDepth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still write the XML payload?
I don't think so, we only output the JSON payload exception the CSDL, right?
If that's the case, why do we need to implement the XML related async methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some async tests and async methods that are calling this method.
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelCsdlSchemaJsonWriter.cs
Outdated
Show resolved
Hide resolved
…file for partial classes.
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelReferenceElementsJsonVisitor.Async.cs
Show resolved
Hide resolved
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelReferenceElementsJsonVisitor.Async.cs
Show resolved
Hide resolved
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelReferenceElementsJsonVisitor.Async.cs
Show resolved
Hide resolved
…Task for FlushAsync in JsonWriter
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelCsdlSchemaXmlWriter.Async.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelReferenceElementsXmlVisitor.Async.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelCsdlSchemaXmlWriter.Async.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelCsdlSchemaXmlWriter.Async.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments; otherwise LGTM
Issues
This pull request fixes #xxx.
Description
Main Changes
Provide APIs for writing
CSDL
asynchronously:Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.