private int CreateCustomerBranch1() { AccountService1.AccountServiceClient lClient = Bank1AccountService; Bank.TransferClient.AccountService1.Customer lCust1 = new AccountService1.Customer() { Name = "Branch1Customer" }; int lCustId = lClient.CreateCustomer(lCust1); return(lClient.CreateAccount(lCustId, new AccountService1.Account() { Balance = 50.0 })); }
public void PerformTransfer(int pAcctAId, int pAcctBId) { using (TransactionScope lScope = new TransactionScope()) { //transfer 20.0 from Branch1Customer to Branch2Customer AccountService1.AccountServiceClient lClient1 = Bank1AccountService; AccountService2.AccountServiceClient lClient2 = Bank2AccountService; lClient1.Withdraw(pAcctAId, 20); lClient2.Deposit(pAcctBId, 20); //someone wishing to find the sum of both balances may also get an inconsistent read if there's no distributed transaction if ((lClient1.GetAccountBalance(pAcctAId) + lClient2.GetAccountBalance(pAcctBId)) != 100) { System.Diagnostics.Trace.WriteLine("INCONSISTENCY!!!!"); } lScope.Complete(); } }