Through WCF from theory to practice: the study of transactions, we understand the WCF implementation of the transaction of some basic knowledge, but the transaction in WCF is not so simple, we lack one of the most important function: The business vote, the so-called business vote is a flexible control of the way the transaction is committed, In the above we set the TransactionAutoComplete of the service method to be true, which means that the method automatically votes in favour without exception, but sometimes we want the transaction to be committed only when a certain data satisfies a specific condition in the operation. So the above realization is obviously not satisfied with the demand, at this time we can use OperationContext.Current.SetTransactionComplete (), the display of voting. Note that WCF transactions must be submitted when the unanimous vote is passed. This article is a combination of the bank's example to demonstrate a business vote, and with a beautiful WPF client, can be bought one to get one off,:).
The purpose of this article
Learn more about WCF transactions
By the way, experience the WPF
This article is suitable for readers
This article is suitable for WCF intermediate users, at least need to understand the basic knowledge of the transaction and simple implementation, beginners can first read WCF from theory to practice: business
Learn more about WCF transactions
In this article, we want to simulate the real situation as follows, the establishment of an alliance banking service self-service system, which provides the function of free transfer between banks, according to the practice, the system is divided into four levels, respectively, as follows:
Level |
Project |
Service contract |
Jillzhang.Wcf.Transactions.Contracts |
Service side |
Jillzhang.Wcf.Transactions |
Host Program |
Jillzhang.wcf.transactions.icbc-used to simulate ICBC Jillzhang.wcf.transactions.ccb-used to simulate CCB |
Client |
jillzhang.wcf.bankclient– includes a nice WPF form |