-
Notifications
You must be signed in to change notification settings - Fork 9
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
Batch requests? #146
Comments
To clarify a little: I realise that you could submit a batch request using the It would be nice if all of the type-safe wrappers around the entity data and requests could be re-used for the batch requests. (Alternatively, if this is already doable, it would be nice if there were some examples in the README.md 😄.) |
You are right, no support for batch requests exists. I would implement as per http://docs.oasis-open.org/odata/odata/v4.01/csprd02/part1-protocol/odata-v4.01-csprd02-part1-protocol.html#_Toc486263479. We'll have to give you some functionality to modify standard headers as well to conform to expectations of v2 service. |
I had a high-level idea for how this could be implemented in a fairly transparent way, with minimal changes to the code base. What if each batch request was implemented as HTTP client wrapper over the top of the "main" client. Individual batches would be built up by submitting requests through this client wrapper, and when you've finished you call some method on the wrapper client which submits the batch. This would require minimal changes to the generated code. One issue that I can foresee is that the generated clients all handle requests synchronously (correct me if I'm wrong). That wouldn't work with this approach because the first request obviously won't complete until it receives a response. A solution to this would be to add asynchronous request support to the generated clients by returning a Thoughts? |
Interesting, I'll have to read the spec to check up on all this... |
a quick and dirty might be to wrap every individual request as a batch request (of 1). The http client can be customized already. |
+1 |
So I've just learned that the remote OData service that I'm trying to connect to requires that all requests (even singletons) be sent as batch requests.
Unless I'm mistaken, the current client generator does not generate clients that support batch requests out-of-the-box?
The text was updated successfully, but these errors were encountered: