optimistic concurrency for wallet application development

asp.net-core entity-framework entity-framework-core

Question

I am now working wallet system ,multiple user balance update concurrently . But now the problem is when a user balance update time another transaction happened balance can not update properly. If i use optimistic concurrency for wallet balance column in database in entity framework core . The problem is solved or not

1
1
9/21/2019 10:06:59 AM

Popular Answer

I assume you are asking a question for whether the optimistic lock column implementation solves the simultaneous balance update problem. The answer is NO, it does not solve the simultaneous balance update problem by itself. Simultaneous updates won't happen with just optimistic lock column implementation.

Optimistic lock implementation only tells you that there were simultaneous attempts to change the balance, and it stops the update that happens later than the first one (only the first of the simultaneous changes succeeds).

In order for the balance to update, you need to write code that handles the concurrency conflicts, as it's described here. The basic idea is to handle the conflict error and decide what to do. Some of the options are to ask the user what to do, or to automatically decide what to do by your code while handling the conflict error.

0
10/1/2019 1:30:48 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow