You wont be able to use ToOptimizedResult() on auto batched responses since it returns a CompressedResult (encapsulating raw serialized compressed bytes) whereas Auto Batching requires the original DTO’s so they can be passed individually through the response pipeline then combined and returned together.
Thanks for the response. Further on batched requests. I am probably doing something wrong but it seems to be working such that if I post a batch of requests and the service throws and exception for one of them then the batch stops processing at that point and the only response I get is the error response.
Yes it throws an exception/error response short-circuiting the Request. It will also return a HttpHeaders.XAutoBatchCompleted (X-AutoBatch-Completed) HTTP Header indicating how many requests were completed before first failure.
The ToOptimizedResult() isn’t the same thing as it doesn’t compress every response, it stores compressed serialized bytes in cache and writes directly to the Response stream on subsequent requests, so the response is only compressed once (when cached) and not every response.
Thats a little painful. I was hoping to use this when creating new objects which have server generated unique ids. So with this model I can know that the first N were create but I will not have their unique ids and will find it difficult to find them, unless I send some other unique property in each request.