Wiki Home

Session Class

Namespace: WIN_COM_API
The session class, introduced in VFP 6 SP3, is a lightweight class that embodies a Data Session.

Regardless, Form Set (believe it or not) is lighter weight and also embodies a datasession. Just that you can't add a Form Set to most containers like you can with a Session.
I say as much in my article, "Private Sessions",, Charlie Schreiner
This is a question to those guru's out there. Sitting here thinking about this class it occurs to me that it might be a good idea to extract the datesessions for the form class and create them as a separate object that can be reused in various forms, business objects and reports?
Michael Chean
Yes, there are a lot of form managers that work that way. More, new VFP Session class allows to organize this easy. Just initialize a form inside of the code in Session class and you have this form running in another data session. -- Vlad Grynchyshyn
Example of using the session class:

*Create Database foo
*Create Table Bar ( nFid1 i )
*Insert into bar values (1)
*Close Databases

oMain = CreateObject( "cMain" )

Define Class cMain as Session 

	Procedure go
		Local loMkDbc
		USE foo!bar
		loMkDbc = CreateObject(  "cMkDbc" )
		? Dbf()
		loMkDbc.go(bar.nFid1 )
		? dbf()

Define Class cMkDbc as Session 
	Procedure go
		Lparameters tnVal
		Close Databases all
		* DO thing.prg generated by gendbc

Carl Karsten
Contributors: Steven Black Vlad Grynchyshyn Carl Karsten
Category Class Design Category Code Samples
( Topic last updated: 2003.03.16 06:41:13 PM )