privates DataSession

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
jpmoschi
Posts: 78
Joined: Thu May 21, 2020 3:45 pm

privates DataSession

Post by jpmoschi »

Good morning guys, I'm reviewing XSharp and I enjoy the evolution when I recognize that the equivalent of the FoxPro SET command has been incorporated, a useful debugging object to see the different "dbf aliases" open in different data sessions.

The question arises for me: what is the approach to managing different private DataSessions in XSharp that try to emulate VFP Data Sessions?

In other words, in FoxPro, forms (Class Form, etc.) have the DataSession property that determines the visibility of open aliases. Can XSHARP understand the concept of private data sessions linked to the life of a form or some equivalent mechanism?

Does anyone on the forum have some code examples to analyze and understand it?

thank you
Juan
Captura.JPG
User avatar
xinjie
Posts: 130
Joined: Wed May 20, 2020 10:05 am
Location: China
Contact:

Re: privates DataSession

Post by xinjie »

Hi, Juan

You'll notice ADO.NET if you think about data binding further.
A DataSet is very similar to a DataSession.
简单的东西重复做,你能成为专家;重复的东西用心做,你能成为赢家!
User avatar
robert
Posts: 4625
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: privates DataSession

Post by robert »

Juan,
We indeed support the concept of a DataSession. There is a DataSession class (see https://www.xsharp.eu/runtimehelp/html/ ... ession.htm)
It has the list of open workareas/cursors
A form can create a new datasession :

oDataSession := DataSession{"DatasessionName"}

This object will be automatically added to the list of open datasessions.
The Datasession object has a name and an ID. It also saves the thread in which it was created.
When the thread exits, then the session will be closed automatically (and the files will be closed to).

The RuntimeState has a method SetDataSession() that you can use to set the current active datasession.

Please note that for index expressions to be properly evaluated by the Macro compiler, you will have to make sure that the DataSession that the file is opened in is the current active Datasession in the runtime state

We are still working on automatically opening and restoring the datasession for a form.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply