I have successfully implented the optimistic concurrency sample from the JayData site http://jaydata.org/blog/optimistic-concurrency-support-in-jaydata-1.2 with a WCF DataService in the back, just like in the sample.
Now, someone in charge decided that we need to change the OData backend in our project to Web Api.
But I can't get the sample to work with Web Api.
My first try: just switch out the backend, all the Javascript is the same. This results in the token being undefined.
When creating the Entity description with the Jaydata SvcUtil, it will look like this:
'token': {
type: 'Edm.Binary'
},
The token will then show up as [UInt8Array], but when executing the saveItems() command, both items will be saved, as it won't send the token in the If-Match header. As soon as I add concurrencyMode: $data.ConcurrencyMode.Fixed to the entity description, the token will be undefined again.
Is there something I would have to implement on the server side for my OData controllers to make this work? Or do I have to add something else to my Entities, maybe for Web Api, it is not sufficient to have the token as byte[] with the [Timestamp] attribute?