Skip to content

Commit

Permalink
https://github.com/danieleteti/delphimvcframework/issues/362
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Apr 18, 2020
1 parent fc525e9 commit f853b36
Show file tree
Hide file tree
Showing 11 changed files with 392 additions and 101 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ end;
- Fixed! [issue356](https://github.com/danieleteti/delphimvcframework/issues/356)
- Fixed! [issue362](https://github.com/danieleteti/delphimvcframework/issues/362)
- Fixed! [issue363](https://github.com/danieleteti/delphimvcframework/issues/363)
- **Breaking Change!** In `MVCActiveRecord` attribute `MVCPrimaryKey` has been removed and merged with `MVCTableField`, so now `TMVCActiveRecordFieldOption` is a set of `foPrimaryKey`, `foAutoGenerated`, `foTransient` (check `activerecord_showcase.dproj` sample).
Expand Down
39 changes: 23 additions & 16 deletions samples/commons/BusinessObjectsU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ TPerson = class
procedure SetFirstName(const Value: string);
procedure SetLastName(const Value: string);
procedure SetMarried(const Value: boolean);
function GetFullName: String;
function GetFullName: string;
public
function Equals(Obj: TObject): boolean; override;

property ID: Int64 read fID write fID;
property FirstName: string read FFirstName write SetFirstName;
property LastName: string read FLastName write SetLastName;
property FullName: String read GetFullName;
property FullName: string read GetFullName;
property DOB: TDate read FDOB write SetDOB;
property Married: boolean read FMarried write SetMarried;
constructor Create; virtual;
Expand Down Expand Up @@ -94,6 +94,8 @@ TNullablesTest = class(TMVCActiveRecord)
ff_currency: NullableCurrency;
[MVCTableField('f_blob')]
ff_blob: TStream;
ff_float8_not_null: Double;
ff_float4_not_null: Single;
public
destructor Destroy; override;
function Equals(Obj: TObject): boolean; override;
Expand Down Expand Up @@ -123,31 +125,35 @@ TNullablesTest = class(TMVCActiveRecord)
[MVCSerializeAsString]
property f_blob: TStream read ff_blob write ff_blob;

property f_float4_not_null: Single read ff_float4_not_null write ff_float4_not_null;
// f_float8 float8 NULL,
property f_float8_not_null: Double read ff_float8_not_null write ff_float8_not_null;

procedure LoadSomeData;
end;

IPerson = interface
['{1D00C67A-A6D9-4B31-8291-705B339CDE9B}']
function GetName: String;
procedure SetName(const Value: String);
function GetName: string;
procedure SetName(const Value: string);
function GetAge: Integer;
procedure SetAge(const Value: Integer);
function GetDOB: TDate;
procedure SetDOB(const Value: TDate);
property Name: String read GetName write SetName;
property name: string read GetName write SetName;
property Age: Integer read GetAge write SetAge;
property DOB: TDate read GetDOB write SetDOB;
end;

TObjectWithJSONObject = class
private
fJSONObject: TJSONObject;
FStringProp: String;
procedure SetStringProp(const Value: String);
FStringProp: string;
procedure SetStringProp(const Value: string);
public
constructor Create;
destructor Destroy; override;
property StringProp: String read FStringProp write SetStringProp;
property StringProp: string read FStringProp write SetStringProp;
property JSONObject: TJSONObject read fJSONObject;
end;

Expand All @@ -158,14 +164,14 @@ TInterfacedPerson = class(TInterfacedObject, IPerson)
FDOB: TDate;
fAge: Integer;
protected
function GetName: String;
procedure SetName(const Value: String);
function GetName: string;
procedure SetName(const Value: string);
function GetAge: Integer;
procedure SetAge(const Value: Integer);
function GetDOB: TDate;
procedure SetDOB(const Value: TDate);
public
property Name: String read GetName write SetName;
property name: string read GetName write SetName;
property Age: Integer read GetAge write SetAge;
property DOB: TDate read GetDOB write SetDOB;
end;
Expand Down Expand Up @@ -223,7 +229,7 @@ TCustomer = class
public
constructor Create;
destructor Destroy; override;
property Name: string read fName write SetName;
property name: string read fName write SetName;
[MVCDoNotSerialize]
property ContactFirst: string read FContactFirst write SetContactFirst;
[MVCDoNotSerialize]
Expand Down Expand Up @@ -282,7 +288,7 @@ function TPerson.Equals(Obj: TObject): boolean;
end;
end;

function TPerson.GetFullName: String;
function TPerson.GetFullName: string;
begin
Result := Format('%s, %s', [FFirstName, FLastName]);
end;
Expand Down Expand Up @@ -418,6 +424,7 @@ procedure TCustomer.SetContactLast(const Value: string);

{$IFNDEF LINUX}


procedure TCustomer.SetLogo(const Value: TBitmap);
begin
fLogo := Value;
Expand Down Expand Up @@ -489,7 +496,7 @@ function TInterfacedPerson.GetDOB: TDate;
Result := FDOB;
end;

function TInterfacedPerson.GetName: String;
function TInterfacedPerson.GetName: string;
begin
Result := fName;
end;
Expand All @@ -504,7 +511,7 @@ procedure TInterfacedPerson.SetDOB(const Value: TDate);
FDOB := Value;
end;

procedure TInterfacedPerson.SetName(const Value: String);
procedure TInterfacedPerson.SetName(const Value: string);
begin
fName := Value;
end;
Expand All @@ -523,7 +530,7 @@ destructor TObjectWithJSONObject.Destroy;
inherited;
end;

procedure TObjectWithJSONObject.SetStringProp(const Value: String);
procedure TObjectWithJSONObject.SetStringProp(const Value: string);
begin
FStringProp := Value;
end;
Expand Down
Loading

0 comments on commit f853b36

Please sign in to comment.