-
Notifications
You must be signed in to change notification settings - Fork 352
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
Provide async APIs for CsdlWriter and SchemaWriter #3006
Conversation
…lSchemaJsonWriter
…tract methods for EdmModelCsdlSchemaWriter class
…ModelCsdlSchemaXmlWriter
…sJsonVisitor, EdmModelCsdlSerializationVisitor and EdmModelReferenceElementsXmlVisitor
test/FunctionalTests/Microsoft.OData.Edm.Tests/Csdl/CsdlReaderTests.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.OData.Edm/Csdl/Serialization/EdmModelCsdlSchemaXmlWriter.cs
Outdated
Show resolved
Hide resolved
If you do |
Thanks for bringing this up. However, this might be a breaking change since it will involve modify the In both:
Change From internal override Task WriteMetadataDocumentAsync()
{
this.AssertAsynchronous();
return TaskUtils.GetTaskForSynchronousOperationReturningTask(
() =>
{
this.WriteMetadataDocumentImplementation();
return this.FlushAsync();
});
} to internal override async Task WriteMetadataDocumentAsync()
{
this.AssertAsynchronous();
await this.WriteMetadataDocumentImplementationAsync().ConfigureAwait(false);
await this.FlushAsync().ConfigureAwait(false);
} |
Should I go forward and change these implementations in this PR or can be done in a different PR. |
It wouldn't be a breaking change if it doesn't change what's written on the wire... In addition, part of the objective for implementing the async APIs was so we could remove these async wrapper over sync APIs. The change you mentioned above is the right/desired change. Make sure to add tests to verify that the output is the same from both |
This has been done and pushed in this commit: 64977a6 I have added tests to compare both |
…ceTests to OasisActionsFunctionsRelationshipChangesAcceptanceTest to reuse the methods used in main class OasisActionsFunctionsRelationshipChangesAcceptanceTest
Cherry-pick bd08585 Fix errors with cherry-pick
* 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
Issues
This pull request fixes #2684
Description
The current
CsdlWriter
class provides only synchronous methods for writing CSDL(WriteCsdl and TryWriteCsdl)
.Also
SchemaWriter
class exposes only syncronous methods for writing Schema(TryWriteSchema)
Main Changes
1. Provide APIs for writing
CSDL
asynchronously:To add these async APIs methods necessitates updates to the following files to support asynchronous operations:
These new asynchronous APIs have been documented in
PublicAPI.Unshipped.txt
.2. Writing tests for the new asynchronous
CsdlWriter
APIs:Adapting the existing tests to utilize the async/await pattern for the newly introduced asynchronous methods in the:
Checklist (Uncheck if it is not completed)