lifecycle delphi datasnap which one to use?

1

Greetings to all.

I developed an app for android using the datasnap reflection REST technology with JSON delphi using the firedac data connection engine. This app basically has the data query function.

My question is what kind of lifecycle would be the ideal one to use.

    
asked by anonymous 23.02.2015 / 12:35

3 answers

1

The property LifeCycle basically has three options:

  • Server : The server maintains a single instance of the class on the server, all clients requesting this class will always receive the same instance (Singleton).
  • Session : The server maintains one instance of the class per session of DataSnap, each client receives a different instance of the class.
  • Invocation : At each invocation of a client an instance of the class will be created and then destroyed ( Stateless ).

The documentation mentions that for REST clients, if the chosen lifecycle is Session at DSServerClass , Session will behave as Invocation . If you have no major issues, the first option Server might be appropriate.

    
23.02.2015 / 13:29
0

I modified the lifecycle on the server to invocation . On the client, I have modified the PreserveSessionID property of the DRestConection component to false because I do not have the need to manage or create sessions. This way, if the server or link is unavailable as soon as the interruption is remedied, the application will be able to redo the connection.

The security routine I use is applied in two moments when the mainform where the menus are mounted and when connecting the DRestConection component where are passed the login and password for access to the server methods.

At first it worked, I'm doing more tests to reach a final conclusion. Thank you all for your help.

    
24.02.2015 / 11:33
0

If you are using REST and without session what is session naturally is invocation does not need nor change. By the characteristic of the protocol itself. Connects processes and disconnects.

    
01.07.2015 / 23:12