asp.net - How to return the last value when retrying action multiple times? -


when using oracle or postgres repeatable read / serializable isolation levels, need ready retry transaction. our back-end services pretty state less, can rerun them same input parameters want. asp.net core seems returning result created when action executed first time , not last time. here example:

[httppost] public async task<iactionresult> postitemasync([frombody]createitemmodel requestbody) {     int itemid = await createitemservice.value.createitemasync(requestbody);      return createdataction(nameof(getitemasync), new { id = itemid }, new itemcreatedmodel { id = itemid }); } 

itemid contains database id , different every time retry call, since sequences aren't reverted when transaction rolled back. when 2 transactions started in parallel, first gets itemid 1 , second gets 2, second rolled due concurrency issues , rerun filter (this works far), new itemid second transaction 3 client still retrieves 2.

how can force asp.net core return last result of action?

the exception due transaction rolled occurs in filter surrounding , calling action. i'm not interested in solutions create id on client using guids, since solves current specific problem, many others, more complex ones, still exist.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -