>>>Hi everybody,
>>>
>>>I have a class QueueProcess which is based on BusinessProcess class which in turn is based on cCustom class. I want the BusinessProcess class to run all its code in the separate session. In other words, when I instantiate my class it should not share current datasession (from the calling form or program), but run everything in its own. Since it's a custom class and not a session (I used custom in order to be able to create my class visually), I'm thinking about the following:
>>>
>>>In the Init method of the BusinessProcess class do:
>>>
>>>this.nOldSession = set("datasession")
>>>this.oSession = createobject("PrivateDataSession")
>>>set datasession to (this.oSession.SessionID)
>>>
>>>And in the class destroy make
>>>
>>>this.oSession = null
>>>set datasession to (this.nOldSession)
>>>
>>>Do you think it would work and achieve what I want? Do you have better ideas?
>>>
>>>Thanks in advance.
>>
>>this is sufficient
>>
>>* init
>>WITH createobject("Session")
>> set datasession to .dataSessionID
>>ENDWITH
>>
>>*And in the class destroy make
>>* none
>>
>
>Do you think it's safe go this route? Or better use the other idea of instantiating Session object first and creating my object inside it?
>
are equal.
>Also when the object will be destroyed, what would be the current datasession?
Current datasession ? Where ? When ?
It doesn't have sense speak of "current datasesssion",
because VFP have not a "current datasession";
every object or an active procedure of a .PRG have one "current datasession"
Then, when a stack exist it is:
- PROGRAM(PROGRAM(-1)-1)'s datasession
Then, if you write:
SET DATASESSION TO ....
you change objectX's datasession only!
and this doesn't set the "current datasession" after "destroy" is finished