It is more fun and work as I expected but here there is: The third episode in the Delphi Labs "DataSnap" serie. My goal is to consistently release one new episode about Delphi DataSnap programming every week in this quarter. The demos are intentionally simple and all the steps documented in a detailed way so it should be OK to follow even for non-experienced Delphi XE users. In the video episodes I have decided to reduce resolution, but I am still doing zooming and panning in Camtasia before producing a file to mp4. If you have any feedback regarding the format of Delphi Labs please do not hesitate to comment here. Appreciated!
In the first part of this lab I’m using Delphi XE to build a DataSnap VCL Forms app server and client application. The server method instance has overridden constructor where its private FID is initialized with a generated GUID and "GetId" server method is implemented to be able to uniquely identify a server methods instance on the client. The client app has a button and a label where the value of server method instance ID is displayed. At the end we see that with default DSServerClass.LifeCycle value of "Session" every connected client has its own server methods instance inside the server application.
“Delphi Labs: DataSnap XE - Server Methods Lifecycle (Part 1/2)”
In the second part of the lifecycle demo we are extending both server and client applications. In the server we are adding two new TDSServerClass components with other possible values for lifecycle: server and invocation. Implementations of all three server classes are identical and they provide "GetID" server method that returns an instance GUID value and let us identify instances inside the server. The client interface is extended and DataSnap proxies are regenerated. At the end of the demo we verify that server method instances are global to all clients, session instances are unique per client and invocation instances created and destroyed on the fly.
“Delphi Labs: DataSnap XE - Server Methods Lifecycle (Part 2/2)”