本文介绍了Wcf并发请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须开发一个银行系统,允许用户存入或取出账户。

我已经实现了整个逻辑,现在的要求是账户不能有负余额,我卡住了这里。



多个用户可以从一个帐户中抽奖。如何在多个并发用户(或请求)的情况下实现负余额?

例如用户A和B同时抽签,用户A的请求先完成,账户得到负余额那么我该如何向用户B提出错误?



我尝试过:



我用两种存款和取款方法创建了WCF Restful服务。我正在使用绘图时检查帐户余额。

I have to develop a banking system which allows users to deposit or withdraw in accounts.
I have implemented the whole logic,now the requirement is that an account cannot have negative balance,I am stuck here.

Multiple users can with-draw from a single account. How can I implement the negative balance in-case of multiple concurrent users(or requests)?
eg User A and B with-draws at same time, User A's request finish first and the account got negative balance,then how can I give error to user B?

What I have tried:

I have created WCF Restful service with two methods for deposit and withdrawal. I am checking account balance while with-drawing.

推荐答案


这篇关于Wcf并发请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 04:50