Exemplo n.º 1
0
        private int CreateCustomerBranch2()
        {
            AccountService2.AccountServiceClient         lClient = Bank2AccountService;
            Bank.TransferClient.AccountService2.Customer lCust2  = new AccountService2.Customer()
            {
                Name = "Branch2Customer"
            };
            int lCustId = lClient.CreateCustomer(lCust2);

            return(lClient.CreateAccount(lCustId, new AccountService2.Account()
            {
                Balance = 50.0
            }));
        }
Exemplo n.º 2
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();
            }
        }