-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sco.Provider.Domain.Table.pas
97 lines (74 loc) · 1.53 KB
/
Sco.Provider.Domain.Table.pas
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
unit Sco.Provider.Domain.Table;
interface
uses
System.Generics.Collections, Sco.Provider;
type
TTable = class(TInterfacedObject, ITable)
private
FID: string;
FName: string;
FFields: TTableFields;
FObs: string;
public
constructor Create;
class function New: ITable;
destructor Destroy; override;
function ID: string; overload;
function ID(const Value: string): ITable; overload;
function Name: string; overload;
function Name(const Value: string): ITable; overload;
function Fields: TTableFields;
function Obs: string; overload;
function Obs(const Value: string): ITable; overload;
end;
implementation
uses
system.strutils, System.SysUtils;
{ TTable }
constructor TTable.Create;
begin
FID := TGUID.NewGuid.ToString;
FFields := TTableFields.Create;
FObs := EmptyStr;
end;
class function TTable.New: ITable;
begin
Result := Self.Create;
end;
destructor TTable.Destroy;
begin
FFields.Free;
inherited;
end;
function TTable.Fields: TTableFields;
begin
Result := FFields;
end;
function TTable.ID(const Value: string): ITable;
begin
Result := Self;
FID := Value;
end;
function TTable.ID: string;
begin
Result := FID;
end;
function TTable.Name(const Value: string): ITable;
begin
Result := Self;
FName := ReplaceStr(Value, '"', '');
end;
function TTable.Obs(const Value: string): ITable;
begin
Result := Self;
FObs := Value;
end;
function TTable.Obs: string;
begin
Result := FObs;
end;
function TTable.Name: string;
begin
Result := FName;
end;
end.