The Client Project (Delphi)
Overview
The client project that is generated by the new Data Abstract Project Wizard is a rather simple application. It is intentionally created to be as simple as possible, because it is supposed to be only a starting point for developing a new application that allows to skip some routine work in the very beginning of the application development cycle.
Project Contents
Project Overview
This article describes the VCL client application project. The FMX client application will have other components (for example TDAFMXReconcileProvider instead of TDAVCLReconcileProvider), but DataModule and Data Definition will always remain the very core of the application.
A newly generated client application contains several files:
fClientDataModule.pas | Data Module: Contains all components responsible for communication with a remote server. |
fLogOnForm.pas | (Optional) Log On dialog definition |
fClientForm.pas | Main Application Form |
All components are described below in more detail.
DataModule
This form contains the following sub-components:
ClientChannel | The Client Channel performs low-level communication with the server. The Client Channel also handles the OnLoginNeeded event raised when a remote server requests user authentication by calling the LogOn method (see below). |
Message | The Message component performs protocol-specific data serialization and deserialization. |
EncryptionEnvelope | The (optional) AES Encryption Envelope component encrypts data sent over the wire. |
RemoteDataAdapter | The Data Adapter component is the core element that sends data requests to the server. |
RemoteService | This component receives data requests from the RemoteDataAdapter instance and sends them to the remote server using ClientChannel and Message. |
DataStreamer | The Data Streamer serializes and deserializes data requests. |
These components are created for each table:
sp_tbl_ | Optional Business Rules Scripting support component |
tbl_ | Data Tables component |
ds_ | Data Source component, used for linking visual components like TDBGrid with Data Tables components |
Please note that some components (f.e. EncryptionEnvelope) are optional and are added to the generated Data Module only when the appropriate options were selected in the Project Wizard.
The Data Module exposes the following properties and methods:
fIsLoggedOn | property | This property returns true when logging on to the server was successful. |
fUserId | property | This property gets the user name. |
LogOn | method | This method performs the logging on to the server using the provided username and password, and returns true on success. |
LogOff | method | This method performs the logging off from the server. |
LogOn form
An optional dialog that asks for the user name and password and saves them to the application settings file. Please note that the password is saved as plain text without any encryption.
Main Form
Main application form. The Project Wizard leaves to it to the user to fill it with the needed content and application logic.
Summary
The client project generated by the New Project Wizard is a rather simple application. It is a good starting point for learning Data Abstract for Delphi or creating simple utility applications. However, more complex production-level applications would require major changes in the application (for example, the Data Module might be moved into a separate Data Access Layer assembly, the Log On dialog reworked to match the company style etc).