Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Private datasession for a class
Message
De
11/06/2002 12:12:33
 
 
À
11/06/2002 11:29:25
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00666940
Message ID:
00666978
Vues:
25
>>>>Trying to manage myCustomClass in a prg file gets me confused. I much prefer to do it visually in the class designer. Maybe you know how to use the class designer on a session class, that I don't know about. That would solve ALL my problems.
>>>
>>>Then use a form. You don't need to make it visible for the end-user.
>>>
>>>Hilmar.
>>
>>I thought about that, but I keep reading about how the session class uses so much less resources than the form class.
>
>I believe that this is so, but then you lose the visual class-editor capabilities you mention. Do you need hundreds of instances of your class? Perhaps some tests, of speed, and memory used, would be in order, to determine whether it makes sense to use the form class.
>
>Hilmar.

Hi Hilmar,
What do you think of this idea, that seems to work.
The idea is to wrap myCustomClass in a wrapper that created a new DS before creating myCustomClass. And giving myCustomClass the object that contains the session class, so it can close the Private DS.
myForm.Method()
  local lo
  lo = myWrapper()
  lo.WhatEver()
endproc

myWrapper.prg
  LOCAL loSes, loCus
    loSes = NEWOBJECT('Ses_Base','Base_Classes.prg')
    SET DATASESSION TO loSes.nDs
    loCus = CREATEOBJECT('myCustomClass')
    loCus.oDS = loSes
    RETURN loCus
endproc

Base_Classes.prg
  Define Class Ses_Base as Session
    nDS = 0
    Procedure Init()
      This.nDS = Set('DataSession')
    EndProc
  EndDeFine
EndProc

In Class Desginer:
  Define Class myCustomClass as Cus_Base
  EndDefine

  Define Class Cus_Base as Custom
    oDS = .null.
    Procedure Destroy
      This.oDS = .null.
    EndProc
  EndDefine
Bill Morris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform