As a beginner of DataSnap in Delphi XE2, I found it not easy to get the big picture in several minutes, since the tutorial on the Internet are described by text, screenshot or recorded video. So I made one like below.
From the picture we can see the client side just uses the proxy components of server side components to update the data on server or call the methods on server.
On the server side you can create three types of server class: TDSServerModule, TDataModule & TComponent. TDSServer create the instance of these class at run time by TDSServerClass. The difference is that: TComponent contains the methods you define; the TDataModule can contain non-visible components like TTimer than the TComponent; the TDSServerModule can contain dataset components that need to be published to client side than the TDataModule.
On the client side, it is easy to create the corresponding proxy classes by the help of TSQLConnection. It will generate the basic code framework for you.
As a beginner you may ask below two questions:
1. What is the main benefits of Multi-Tier?
*It moves the connection between the client applications and database server to application server and database server while you can connect many client applications to the same application server. It will save your database client license fee.
*It adds an application server in the system, make it more powerful to handle the client requests before database server. The application make database server’s workload not as heavy as before.
*It allows you put your main business logic on the application server and make it easy to update the main business logic.
…
2. What is the main benefits of DataSnap in Delphi XE2 again the MIDAS in Delphi 2009?
* Before Delphi 2010, when you deploy MIDAS application, you need run Borland Socket Server on the Application, now no need. Now Datasnap server itself is the socket server, it can listen to the requests on its port like 211.
* Before Delphi 2010, you can not call the method to run a business logic on application server directly, you need some unreadable skills. Now you can. Now Datasnap maps the datasets and methods directly in the client application, so you can call them directly.
* Its architecture is more flexible than before.
* It is easy to broadcast a message to clients from server now.
Download
PDF (you can zoom in the picture)
Visio (you need remove .jpg from the file name)
Reference
Learn to unleash the power of Delphi with Delphi Labs