Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Private Datasession in Container?
Message
From
29/05/2004 16:26:04
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
29/05/2004 14:59:37
Koos Veel
Gamma Research
Aruba
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00908472
Message ID:
00908492
Views:
20
>Hello all,
>
>We are in a situation that a business object (we used the container class)that is not on a form needs to have a private datasession. Is there a way to make a business object with a private datasession?

Look at the Session class. You can just do this.addobject("oSession","mysession") and have mysession class defined as Session, with your properties (like DataSession=2 - private). However, I'm not sure that any code in your container will switch automatically to this.oSession.DataSessionID datasession - any method or event code executes in the datasession in which the object was created.

So you may just turn the things around and define your bizobjects as sessions - but this has two disadvantages. First, Session is not a container, it doesn't have object members. You can get around it by adding object properties, though, but then they don't have an automatic .parent backlink. Second, Session is a strictly non-visual class.

Another funny thing - I've created the following code:
Define Class mycnt As Container

	Procedure Init
		This.AddObject("oSS","mysess")
	Endproc

	Procedure hi
		?"datasession", Set("Datasession")
	Endproc
Enddefine



Define Class mysess As Session
	DataSession= 2
Enddefine
When I instantiate myCnt, it doesn't create a new datasession (tried with "Add Object Oss as Mysess" as well). However, when I instantiate mysess first, it does create it - but stays at the current one. So I figure the way to go would be to
- create a session object
- set datasession to oSession.nDataSession
- instantiate your bizobject.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform