Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stateless Objects.
Message
 
To
21/09/2000 09:06:59
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00416469
Message ID:
00418963
Views:
27
>>.Validate(ADOcursor)
>>Parameter is a cursor with all the customer data,
>>it returns a boolean specifing if the data is valid (.T.) or invalid (.F.)
>>
>>.Save(ADOcursor)
>>Parameter is a cursor with all the customer data.
>>
>>.GetBrokenRules(ADOcursor)
>>Parameter is a cursor with all the customer data,
>>it returns an ADO cursor that contians 1 row for each broken rule.
>
>This won't work. It isn't stateless.

It is if you pass all the data to each method. But, it sucks because you end up round-tripping data. Which was what I was trying to show. This was an example of how NOT to do it. :)

>A better way is to have the UI send the data to a Save() method. Save() calls Validate(). Validate() returns a text string that contains the messages to be displayed for all data that fails validation. If empty, all data is valid and Save() calls the appropriate Data objects to save the data and then returns. If data fails validation, the text string is returned from Save() to the UI for display.

Yep. That is what I was thinking. Send the data across the wire once, via the .save() method and let it do the validation. That was at the bottom of the post.

>Remember that one of the rules of this thing is that you need to be stateless. You can't set properties and then retrieve them from another method call. Everything has to be handled in parameters and RETURN values.
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform