Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
N-tier development
Message
From
13/09/2004 18:09:40
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00941723
Message ID:
00941741
Views:
7
Roy,

See my comments inserted below.

>Hi,
>
>I would like upgrade my framework to have n-tier capabilities, for now 3 tier will do. I have a few initial questions:
>
>1) I know I need to create a Class (custom type class?) as the Business Object for the business rules.

I would use the Session class. That way it can have it's own data session for processing and won't interfere with the form.

>
>2) I need to choose a way to transfer data back and forth between the presentation layer, the business layer(middle tier) and the data layer.
>I can use either XML or ADO recordsets, maybe some other technology,what is the suggested method to handle the data? XML? ADO?

XML is much easier to work with in VFP.

>
>3) I will need to instantiate this class when I open my forms.
> Let's say it's a customer data entry screen. Basically the screen will function like this(assume we gonna use XML):
>
> * Instantiate the business layer class (oBusiness for this example)
>
> * Get the record.
> - oXML_Record = Thisform.oBusiness.Get_Record("Select * from customers WHERE nCust_id = 54")
> (The "oBusiness.Get_Data" method will issue a call to the database, get the results and put them in XML format and send the result back to the presentation layer.)
>
> * If it's foxpro interface I can convert the XML to a cursor and bind to the controls.
>
> * Save Record.
> - Convert cursor to XML if foxpro interface
> - Thisform.oBusiness.Save_Record(oXML_Object)
> - How can I check for field changes? Keep a copy of the original XML on the business layer and when the business layer receives back the XML from the presentation layer compare against it?

Only send one record at a time to the Business Object. That way, the BO won't need to worry about tracking changes.


> - Call data validation method
> aFailedFields = Thisform.oBusiness.Validate(oXML_Object)
> (send the XML, the business object will validate and return an array with the fields that failed the validation)
>
> * Add Record
> - oXML_record = Thisform.oBusiness.Add_Record("Select * FROM Customers WHERE 1=2")
> (it would return nothing but it will enable me to create the cursor based on the XML structure when I convert, so I have an empty cursor)
>
> * Delete Record
> - Thisform.oBusiness.Delete_Record(nCust_id)
>
> * Cancel Changes
> - oXML_Record = Thisform.oBusiness.Get_Record("Select * from customers WHERE nCust_id = 54")
> (just call the same procedure as when getting the record)
>
>- if I'm updating multiple tables in this screen then have a business layer object for each table that I'm updating?
>
>Am I in the right direction?

Looks like you're heading in the right direction.

>
>Thanks!
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform