Delphi5.5 MiDAS programming
Three basic layers in the database application:
l Data layer: responsible for storing data
l Business Layer: Responsible for obtaining data from the data layer and performs the final legality check (also called execution business rules). The business layer is also the application server layer.
l Representation: also called the GUI layer, responsible for displaying data in an appropriate format in the client application. Always deal with the business layer, not directly dealing with the data layer.
Advantages of multi-layer architecture under Delphi:
1. Business rules Concentrate: Business rules are placed on the application server
2. Thin customer architecture: Data Access is controlled by the application server, and the data representation is done by the customer's application. Just issue a client application and a DLL file that uses to access the server.
3. Automatic error adjustment
4. Briefcase mode: The briefcase opens the data mode, allowing you to keep active with the application server or database server.
5. Fault
6. Load balancing: The algorithm of load balancing has a random method, sequential method, minimum network user, and the least network traffic. Delphi4 and the above version provide a sequential method to implement the load balanced components.
Typical MIDAS architecture:
Form / Data Module Remote Data Module (RDM)
Customer service
TDataSetProvider TdataSet
TclientDataSet
TDISPATCONNECTION
First, the server
Second, the client
Delphi is used to connect customers and servers for TDISPATCONNECTION. With its AppServer property, you can call the customized method on the server. TDISPATCONNECTION has derived several subclasses, which have different connection features:
1. TDCOMCONNECTION: The core of security verification is provided through standard Windows services. Very useful for intranet / extranet applications. Just configure the security verification of the DCOM in the intermediate layer application server, with dcomcnfg.exe. Disadvantages:
It is difficult to configure, mainly in crossing route or domain, distribution is also difficult
Can't be very good and strong firewall
Install DCOM95 on Win95 machine
2. TsocketConnection: Easy to configure, only one port is transmitted. You must run SCKTSRVR for configuration. Delphi4 is required to install Winsock2, and Delphi5 does not use the callback, you can use Winsock1 to connect users.
3. TOLENTERPRISDCONNECTION: Provides embedded fault tolerance and load balancing. Component TSIMPLEOBJECTBROKER for fault-tolerant and simple load balancing. Win9x can be used as a server.
4. Tcorbaconnection: It is equivalent to the open standard of DCOM.
5. TWEBConnection: Allows MIDAS to be transmitted on HTTP or HTTPS. Restrictions:
Do not support callback
Customer must install Wininet.dll
The server side must run IIS4.0 or Netscape3.6 and above.
There are many ways to write client programs:
1. The main form is ActiveForm, calling other normal forms. ActiveForm is actually an ActiveX component, which is also an ActiveX's Container object. This means that it can contain other components. This way we can add ordinary VCL controls to ActiveForm. ActiveForm's creation and release:
Selected in Delphi New | ActiveX | ActiveForm
The Make Control licensed selection item should be aware that it is generally not selected, otherwise ActiveForm requires license when the client downloads, is to copy the license file on the development machine to the client machine. The include version information option is generally selected so that the client can decide whether to download a new version according to the version number on the server when running the program.
Once you have created and edited the form, you can release it. First, install IIS on the server, create a virtual directory, and prepare some files generated after ActiveForm release. Choose Project | Web Deployment Options
Here is the various settings released. Targer Dir is the generated file stored in the directory, the Targer URL is the URL of the client machine access server, HTML Dir is the home page stored directory of the generated ActVeForm Access. The Use Cab file compression option is selected, and the actveform will be downloaded to the client when the CAB file is sent to the client. When it is not selected, it will be compiled into a .ocx file. Include File Version Number Options and when creating ActVeForms, it means that it contains version information to client comparison when publishing. Auto Increment Release Number option, generally to select, so that the program will automatically increase the version number per release. This way the client can download the new version after comparing. DEPLOY Additional Files selected, the publoquence will contain other files added to the Additional Files page, such as Midas.dll.
After these settings, you can point Project | Web Deploy released.
With an ActiveForm, you can easily establish Application based on IE running through ActiveForm. When you create an ordinary form, create a normal form, then show it, but the Form is independent of IE. If you create the same, set the form's Parent to ActiveForm, and set form.visibal: = true, so that this normal form is displayed on ActiveForm. Of course, don't forget to release the Form in the DESTROY event in ActiveForm. In this way, any normal procedure can be converted to IE-based applications.
When using ActiveForm-based applications, you should perform the first execution of the program to download ActiveForm, so that you can accept whether the size of the ActiveForm document is acceptable on some speeds of a slower network. The download time is too long, which may cause the DCOM or Socket. You can use Package and CAB technology to make the document becomes small, but this is limited. Another method is that programmers analyze and design the entire application, write shared application logics into corporate objects, execute in the application server, execute after ActiveForm download. But then if you frequently call a large amount of data, it is sometimes reduced to reduce the efficiency and may be difficult to accept. So how to deal with, the most important thing is the experience and experiment of programmers.
2. All forms use ActiveForm. ActiveForm is not called directly, but to call the OCX to be called as an Internet link. In this way, the client wants to download a large number of ActiveForm, which is unacceptable on the general network, so few use. 3. Use a web way.
ActiveForm is not suitable for use on the Internet because of the relationship between download and execution efficiency. But a general ASP angle language language, is only suitable for simple query multi-layer applications. The best solution today is XML corner language (preferably JavaScript) corporate object intermediary software to meet the needs of e-commerce applications.
Delphi5 provides powerful InternetExPress technology to develop distributed web applications. From the client to the server to the intermediary software, it can be developed with Delphi, and is based on XML.
4. Ordinary form. The client program must be installed and cannot reach the customer-free maintenance requirements, generally not used.
Reference documentation:
l "Delphi5.x distributed multi-layer application system" - Li Wei
l "Delphi5.x distributed multi-layer application e-commerce article" - Li Wei
l "Delphi5 Developer Guide" - Steve Teixeira Xavier Pacheco
l One and thanks to the many excellent Delphi programmers on the Internet