我們再看看生成的單元內容是什麼
unit ServerMethodsUnit1;
1 unit ServerMethodsUnit1;
2
3 interface
4
5 uses
6 SysUtils, Classes, DSServer;
7
8 type
9 TServerMethods1 = class(TDSServerModule)
10 private
11 { Private declarations }
12 public
13 { Public declarations }
14 function EchoString(Value: string): string;
15 end;
16
17 implementation
18
19 {$R *.dfm}
20
21 function TServerMethods1.EchoString(Value: string): string;
22 begin
23 Result := Value;
24 end;
25
26 end.
unit ServerContainerUnit1;
1 unit ServerContainerUnit1;
2
3 interface
4
5 uses
6 SysUtils, Classes,
7 DSTCPServerTransport,
8 DSServer, DSCommonServer;
9
10 type
11 TServerContainer1 = class(TDataModule)
12 DSServer1: TDSServer;
13 DSTCPServerTransport1: TDSTCPServerTransport;
14 DSServerClass1: TDSServerClass;
15 procedure DSServerClass1GetClass(DSServerClass: TDSServerClass;
16 var PersistentClass: TPersistentClass);
17 private
18 { Private declarations }
19 public
20 end;
21
22 var
23 ServerContainer1: TServerContainer1;
24
25 implementation
26
27 uses Windows, ServerMethodsUnit1;
28
29 {$R *.dfm}
30
31 procedure TServerContainer1.DSServerClass1GetClass(
32 DSServerClass: TDSServerClass; var PersistentClass: TPersistentClass);
33 begin
34 PersistentClass := ServerMethodsUnit1.TServerMethods1;
35 end;
36
37 end.