TA=class(元素)
public
procedure Delete;
function Attribute:Boolean;
function Save:Boolean;
end;
TAList=class(列表)
protected
procedure LoadFromDB;
public
function Add:Integer;
procedure Refresh;
property Items[Index:Integer]:TA read GetItems;
end;
//显示业务A
TWinAList=class
private
FAList:TAList;
FForm:TForm;
public
constructor Create(AList:TAList);
function Show;
function ShowModal:Integer;
procedure Close;
published
property AList:TAListread FAList;
end;
function TWinAList.ShowModal:Integer;
begin
FForm:=Tfrm_AList.Create;
Tfrm_AList(FForm).WinAList :=Self;
FForm.ShowModal;
Result:=Form.ModalResult;
FreeAndNil(FForm);
end;
前台为每一个业务设计业务对象如 TA TB TC 业务对象的显示用
Tfrm_AList=class(Tform)
TRelationRunner = class
public
procedure Accept(tableMap:TTableMap); abstract;
end;
TTableRelation = class
public
procedure AddTable(node:TTableMap);
procedure AddRelation(node1, node2:TTableMap, relation:TRelationType);
procedure Run(runner:TRelationRunner);
......
end;
TSQLField = class
FName:string;
FAlias:string;
end;
TSQLTable = class
public
constructor Create(name, alias:string);
......
end;
TSQLFunction = class
public
function GetExpression():string;
......
end;
TSQLQuery = class
public
function Select(field:string);
......
procedure AddWhere(...);
......
fucntion GetExpression():string;
......
end;
TValue=class
FFieldMap:TFieldMap;
FValue:variant;
public
procedure SetValue(value:variant);
function GetValue():variant;
......
end;
TObjectBase=class
FTableMap:TTableMap;
FValues:TList; // TList(TValue);
public
function GetValue(index:integer):TValue;
function GetValue(name:string):TValue;
......
end;
TObjectWin=class
FQuery:SQLQuery;
public
procedure GetQuery():SQLQuery;
......
end;