I'm just testing with the sample ASP.NET Mobile App Web API through Visual Studio and have some questions regarding the concurrency checks.
The TableController<T>
requires updates to be submitted using the following:
protected virtual Task<TData> UpdateAsync(string id, Delta<TData> patch)
i.e. it takes a Delta<T>
of the changes. There is no "overwrite" update.
The sample entity in the project is TodoItem
which derives from EntityData
which implements a bunch of standard properties, one of which is the Version
property, which as I understand Entity Framework will detect as the concurrency property to check versions before update.
I've created a test client to Get
a TodoItem
, change the Text
property and then submit it as an update.
I have found that if I just send the the Delta containing the updated Text
property (along with the Id
in the URL, of course) then I can just update as much as I want and overwrite and changes that may have occurred in the meantime.
If I change the Delta to include the updated Text
property and the Version
of the TodoItem
when I fetched it, then if I make my Patch request I get a 409 error if there have been changes in the meantime, as expected.
Can anyone tell me why this Delta pattern seems to allow you to circumvent the concurrency checks, and if there is any way to ensure that the checks always happen?
Version
from the Delta you can circumvent them! – oatsoda