Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter vs Data objects.
Message
De
22/10/2009 17:04:54
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, États-Unis
 
 
À
22/10/2009 15:18:47
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01430032
Message ID:
01430814
Vues:
63
Hi Walter,
We are in the health care industry and work for states. We have several different kinds of contracts, but a common one is to audit nursing homes and set reimbursement rates.
Normally the caData class doesn't require much code. For a single record adapters, the builder sets most of the properties. The only thing you need to add is some vMethods. (Like vName to validate the Name or vEffectiveDate to validate the EffectiveDate.) For multi record sets, you provide the BuilderSelect property so the builder knows it's not PrimaryKey = ?This.KeyValue but ForeignKey = ?This.KeyValue.

In our forms, the Load() calls a LoadCustom hook so you can put the your Data Environment code there.
This.NewObject('oData', 'deData', 'deData.VCX')
RETURN This.oData.AutoOpen()

We made the caData class and deData classes such that they both have many of the same methods and properties. Save, Validate, Delete, Revert, etc., so for single table environments, we can just:
ADDPROPERTY(This, 'oData', NewObject('caData','caData.VCX')
RETURN This.oData.AutoOpen()

The pattern is always: set the KeyValue property and Requery(). The form doesn't know or care it's talking to a ca or a de class.
Adding new records is more automatic than most folks do. If KeyValue = 0 and I requery, I get the DefaultNumberOfRecords, which in many cases is 1 blank record. Unless the user modifies it, I don't validate or try to save it. Child cursors have as many blank records as the user ever needs. We only save Validate and Save those the user actually modifies.

I've been really happy with the abilty to work easily with native or SQL Server data. We have code like this:
IF PROPER(This.DataSourceType) = "Native" AND '@@IDENTITY' $ This.InsertCmdRefreshCmd
   This.InsertCmdRefreshCmd = STRTRAN(This.InsertCmdRefreshCmd,'@@IDENTITY', 'GETAUTOINCVALUE()')
ELSE
   IF This.DataSourceType = "ODBC" AND 'GETAUTOINCVALUE()' $ This.InsertCmdRefreshCmd
      This.InsertCmdRefreshCmd = STRTRAN(This.InsertCmdRefreshCmd,'GETAUTOINCVALUE()', '@@IDENTITY')
   ENDIF   
ENDIF
so a class that works with Native, well, you get the picture.


>Hi Charlie,
>
>Thats quite impressive. In what type of applications do you use them? Enterprise level?
>
>Walter,
>
>
>
>>Hi Walter.
Charlie
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform