Readme


0x01 graphic

Component-Oriented

Design and Process Solutions

www.componentware.net

.NET Enterprise Services Transactions

This project contains existing server and client projects, simulation bank accounts transactions. To use it, you need to create the bank database.

Create a SQL Server Database

Create a database, which will contain a table of Bank Accounts. Bring up the SQL server explorer: Start | Programs | Microsoft SQL Server | Enterprise Manager:

Expand Microsoft SQL Servers and the server group to see the databases:

0x01 graphic

Right-click on Databases, select “New Database…”

0x01 graphic

Next, create the accounts table:

Right-click on the Tables folder in the bank DB, and select New Table…

0x01 graphic

Add the Number, Balance and Name columns, of types int, money and varchar.

Make the Number column the key, and disallow Nulls for it. Name the table “BankAccounts”.

Adding Accounts

In the SQL Enterprise Manager verify the table is there (may have to refresh - F5):

0x01 graphic

Open the table, and return all rows, by selecting in the BankAccounts table context menu Open Table | Return all rows

0x01 graphic

You should get an empty table, like this:

0x01 graphic

Add two new accounts, numbered 123 and 456. Set initial balance of 500 in each, and name them after yourself and your spouse (or pet):

0x01 graphic

Using the Bank Application

Open up the BankAccountServer.sln solution file. Build both the server and the client to make sure all is well. The server contains the Account and AccountMgr components. The Account component implements the IAccount interface, used to credit or debit an account.

The Account component uses ADO.NET to credit or debit an account. The only business logic applied is in rejecting debiting an account with insufficient balance (throwing an exception).

The AccountMgr component implements the IAccountMgr interface, used to transfer money between accounts.

AccountMgr creates one account object to represent the credit account, a second account object to represent the debit account, and calls IAccount.Creadit() and IAccount.Debit() on them respectively.

Here is the architecture of the bank application and the client:

0x01 graphic

Use the client to invoke the transfer, and pass 100 from account 123 to account 456. The client contains a data grid reflecting your transfer actions:

0x01 graphic

Experiments

Try performing a transfer when one of the two accounts doesn't exist: For example, suppose only the destination account number is valid.

0x01 graphic

Similarly, try a transfer, with an amount greater than the source account balance. Note, that the destination account is credited.

IDesign Inc. www.componentware.net October 2001

- 8 -

©2001 IDesign Inc. All rights reserved



Wyszukiwarka

Podobne podstrony:
avr32 gnu toolchain 3 3 0 275 readme
knock knock joke readme
Readme
Readme
readme text
Brutus readme
readme grissom
Readme
readme
readMeFirst
ReadMe (7)
Readme (16)
README
Readme!
Designography ReadMe
GTG MX 08 readme
README
readme
readme

więcej podobnych podstron