Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design question on 3-tier application
Message
 
 
To
10/05/2008 12:01:47
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01315981
Message ID:
01316310
Views:
14
>>And I would like to keep updates of each module done via the module Business/DA class.
>
>Hi Dmitry,
>
>You didn't say which language you're using, but here's how we manage it in our .NET apps:
>
>The "parent" Biz class first instantiates it's associated DA class. That DA class starts the transaction. That DA object is then passed to all the "child" Biz classes. The Biz classes are constructed such that if another DA is passed to it in the constructor, it uses that DA object, otherwise, it uses it's own. Likewise the DA classes are constructed such that it will use another DA passed to it, or it's own Command, DbAdpater, etc. if not.
>
>Other than when they're first instantiated, the individual DA classes don't know or care where their Command, DbAdapter, etc. objects came from. When a DA class finishes up what it's doing, it does the usual Commit/RollBack Transaction, or Close the Connection. But in the base DA class from which all are sub-classed, those methods (the CommitTransaction, RollBackTransaction, CloseConnection, etc), all know that if a DA class was passed in, then it won't actually Commit the Transaction, or Roll it back or close the Connection. It all gets passed back through to whatever initially called the DA class/method.
>
>I hope this makes some sense. I can give you some examples if you need some (as time permits ... you may or may not have noticed that I've been absent from here most of this past week ... crunch time at the office!!)
>
>~~Bonnie

Hi Bonnie,

Thank you for sharing your knowledge and for your input.

I am using VFP 9.0 for this application. And I will try to figure out how to apply your methodology to my case. Let me describe how I designed my BIZ and DA tiers (in VFP 9):

My UI tier passes data to be saved (not necessary one record but often many records/rows). The BIZ class calls the DA class to get one or often times several cursors (using SPT) from the SQL (or VFP) database for the tables that will be updated. Then BIZ class process all the business logic against the cursors returned from the DA class. Once finished, the BIZ class "passes" the cursors to the DA class. I put "passes" in parenthesis because the BIZ and DA class use the same data session so DA can access the cursors without a need for anything to be passed. Then, finally, the DA class updates the SQL Server (or VFP) database from the cursors processed by the BIZ class. The method of the DA class that saves the data to the database uses TRANSACTION in case any table cannot be updated, so that the entire transaction can be reverted.

In my case, the Parent BIZ/DA is not much different (logically) from the Child BIZ/DA classes, in terms of how the data is being processed and updated to the database.

I will study your message and your approach to see how (if at all) it can be applied to my design.

Thank you very much for your help.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform