1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
unit Client_BOM;
interface
uses
tiObject
,tiOID
,tiOIDGUID
,tiVisitor
;
type
TClient = class;
TClientList = class;
TClientName = String[200];
TClientID = String[9];
TClientList = class(TtiObjectList);
TClient = class(TtiObject)
private
FClientID: TClientID;
FClientName: TClientName;
published
property ClientName: TClientName read FClientName write FClientName;
property ClientID : TClientID read FClientID write FClientID;
end;
TClientVisitor = class(TtiVisitor)
protected
function AcceptVisitor: boolean; override;
public
procedure Execute(const AVisited: TtiVisited); override;
end;
procedure RegisterMappings;
implementation
uses
tiOPFManager
,tiAutoMap
,tiConstants
,tiDialogs
;
procedure RegisterMappings;
begin
// Class, Table, Property, Column, Special Info
gTIOPFManager.ClassDBMappingMgr.RegisterMapping(TClient, 'Client', 'OID', 'OID', [pktDB]);
gTIOPFManager.ClassDBMappingMgr.RegisterMapping(TClient, 'Client', 'ClientName', 'Client_Name' );
gTIOPFManager.ClassDBMappingMgr.RegisterMapping(TClient, 'Client', 'ClientID', 'Client_ID' );
gTIOPFManager.ClassDBMappingMgr.RegisterCollection(TClientList, TClient);
end;
{ TClientVisitor }
function TClientVisitor.AcceptVisitor: boolean;
begin
// Put the code to check if this visitor should act on this object in here.
Result:= Visited is TClient;
// Remove this line and the visitor will touch the TClientList object
// as well as it's owned TClient objects.
end;
procedure TClientVisitor.Execute(const AVisited: TtiVisited);
begin
inherited;
if not AcceptVisitor then
Exit;
tiShowMessage((Visited as TtiObject).AsDebugString);
end;
end.
|