Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Visual Editing of business class w private datasession
Message
De
23/12/2009 06:58:12
 
 
À
22/12/2009 21:15:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01440258
Message ID:
01440310
Vues:
122
This message has been marked as the solution to the initial question of the thread.
>Huh?
>
>I'm missing something. Yes, you can set it in the Init.
>
>However, if I've got a bizobject which is always around (say, called gobizobject), based on Custom, doesn't it always just use the datasession in effect whenever it is called? gobizobject.Post(something) .... ???
>

James,

Any non-session class ( ie not form, toolbar with private datasession or Session class) inherits the session from the object that created that object

easy to test - create a couple of the class below in different datasessions - and look at its DataSessionId
define class ThaClass as Custom
	DataSessionId			= 0

protected function Init()

	local Success
	Success = TRUE
	
	do case
	case !m.Success
	
	case !DoDefault()
		assert FALSE
		Success = FALSE
	
	case !AddProperty(m.this, 'DataSessionId', set('dataSession'))
		assert FALSE
		Success = FALSE

	endcase
	
	return m.Success
endfunc
Calling a method of an object always runs in the datasession the object was created in

eg
I create a Session object ( say it has datasession 5). I then call a method of the session object which creates an custom object and returns it.
The returned object will have datasession 5

If you dereference the session object but keep its returned object alive, datasession 5 will not close

What do you do if you want the datasession of the returned object to be one ?
You create an object at app startup (with datasession 1) and attach it to _screen.

If from the session object, I call the screen object to create an object and return it, the returned object will have datasession one
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform