0

I'm using DefaultODataBatchHandler in order to be able to accept a number of OData requests at once, but want to handle these as a single all-or-nothing operation (i.e. a single transaction). 

My understanding is that this is what change sets are for. However, if I submit a request using a change set with two requests - the first that'll succeed, and a second that'll fail - then it doesn't seem to do so. The first request successfully alters the data, the second fails, but the first request still take effect.

Is this kind of atomic batch operation not supported at the moment?

EDIT: I'm using the latest version btw - Web API 2.2 w/ OData 4 support

Barguast
  • 5,926
  • 9
  • 43
  • 73

1 Answers1

0

WebApi doesn't implement atomic support out of box, the reason is that it depends on the back end data storage. There is a sample to address such requirment https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/OData/v3/ODataEFBatchSample/, it is for OData v3, but it is easy to follow it to create a v4 one. You may want to have a try.

Tan Jinfu
  • 3,327
  • 1
  • 19
  • 20