Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
In lieu of SESSION object for use in VFP6 based objects
Message
From
13/04/2004 11:08:47
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
 
 
To
13/04/2004 00:53:18
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00893854
Message ID:
00894418
Views:
10
My business object is based on the custom class and can optionally use a private data session. The SetPrivateDataSession() method looks like this:
* Set up private data session for object
If This.lPrivateDataSession
	This.oSession = CreateObject("Session")
	This.oSession.Name = This.Name
	Set Datasession To This.oSession.DataSessionID
	Set Deleted On
	Set Multilocks On
EndIf 
If I want to force the object to use the current data session, I pass a parameter in the NewObject() that gets passed to the objects Init(). Here is the Init() method:
Lparameters llDefaultDataSession

...

* Parameter can cause object override private data session property
* Useful for passing around cursors in VFP when default is private data session
If llDefaultDataSession
	This.lPrivateDataSession = .f.
EndIf 
This.SetPrivateDataSession()

...
Are you looking for something like this?

>i found it lurking somewhere.. thanks!
>
>the main reason why i was looking for the session object is to design a generic business object that could be used within a form or even just on its own...
>
>in vfp6, since the dataenvironment doesn't have the datasession and datasessionid properties, i'd need to create a data session from scratch if needed... if the business object will be used within a form, then the builtin datasession of the form takes over, however, if the business object will be used without a form (say as an object that provides services to the application but there is no form in direct contact with the user) the session object should create the datasession so that the dataenvironment can use it..
>
>the sequence of events will be such:
>
>if used on a form:
>1. cursors are loaded into memory (but not data)
>2. dataenvironment is loaded
>3. business object is loaded
>4. form is loaded
>
>if not used on a form:
>1. cursors are loaded into memory (but not data)
>2. dataenvironment is loaded
>3. business object is loaded
>
>
>in this case, the business object should first test if it is contained within a form, if it is, then just pass on the datasessionid of the form to the business object, if the business object is not contained in a form, create a session class to be used by the dataenvironment...
>
>is this making sense? or am i missing something? any special concerns i have to watch out for?
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Previous
Reply
Map
View

Click here to load this message in the networking platform