Porting the Server
For porting the server project, I followed these steps:
- I removed the initialization section of the remote data module unit, called AppsRDM. The code removed was the call to the constructor of the TComponentFactory class.
- I also removed the UpdateRegistry class method of the TAppServerPlus class from the same remote data module unit.
- At that point I could eliminate from the uses clause of the remote data module the COM and ActiveX related units: ComServ, ComObj, VCLCom, and StdVcl.
155 The program is described in detail in the book Mastering Delphi 2005, but also in previous editions like Mastering Delphi 7. Here I'll provide only an overview of some of its features. Those books can certainly give you a broader picture of the original features of DataSnap (and previously MIDAS), which are mostly still available in the Delphi 2009 version.
- Next I had to remove the reference to the custom IAppServerPlus interface that was used by the project to provide custom server methods (the interface was defined in the project type library).
- I deleted the type library and RIDL file (just created when the project was opened in Delphi 2009) from the project and the disk. I also had to remove a uses statement referring to the type library unit.
- I moved the only server method (Login) from the protected section to the public section of the remote data module class, removing from it the safecall modifier. As the TRemoteDataModule class is already compiled with $MethodInfo turned on, there is no need to add this declaration to the project unit.
- Finally, I added to the main form of the program the usual trio of components (server, server class, and server transport), wired them together, and returned the TAppServerPlus in the OnGetClass event handler of the server class component .
That was all it took to upgrade an old DataSnap server to the Delphi 2009 version. It might seem a lot, but it was actually quite fast. Now it was time to look into the client application, one that does a few custom operations.
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.
Get My Free Ebook