Skip to content

Commit

Permalink
dmvcframework-3_1_1-beryllium-RC3
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Mar 8, 2019
1 parent beb059a commit 8ee3efc
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 24 deletions.
8 changes: 4 additions & 4 deletions samples/jsonrpc_with_published_objects/MyObjectU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ function TMyObject.GetPeopleDataset: TFDMemTable;
function TMyObject.GetStringDictionary: TMVCStringDictionary;
begin
Result := TMVCStringDictionary.Create;
Result.AddProperty('key1', 'value1');
Result.AddProperty('key2', 'value2');
Result.AddProperty('key3', 'value3');
Result.AddProperty('key4', 'value4');
Result.Add('key1', 'value1');
Result.Add('key2', 'value2');
Result.Add('key3', 'value3');
Result.Add('key4', 'value4');
end;

function TMyObject.GetUser(aUserName: string): TPerson;
Expand Down
49 changes: 34 additions & 15 deletions samples/renders_spring4d_nullables/CustomTypesSerializersU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface

uses
MVCFramework.Serializer.Intf,
System.Rtti;
System.Rtti, MVCFramework.Serializer.Commons;

type
// Custom serializer for TNullableAliasSerializer type
Expand All @@ -43,7 +43,8 @@ TNullableIntegerSerializer = class(TInterfacedObject, IMVCTypeSerializer)
procedure SerializeRoot(
const AObject: TObject;
out ASerializerObject: TObject;
const AAttributes: TArray<TCustomAttribute>
const AAttributes: TArray<TCustomAttribute>;
const ASerializationAction: TMVCSerializationAction = nil
);

procedure DeserializeAttribute(
Expand Down Expand Up @@ -77,7 +78,8 @@ TNullableCurrencySerializer = class(TInterfacedObject, IMVCTypeSerializer)
procedure SerializeRoot(
const AObject: TObject;
out ASerializerObject: TObject;
const AAttributes: TArray<TCustomAttribute>
const AAttributes: TArray<TCustomAttribute>;
const ASerializationAction: TMVCSerializationAction = nil
);

procedure DeserializeAttribute(
Expand Down Expand Up @@ -111,7 +113,8 @@ TNullableStringSerializer = class(TInterfacedObject, IMVCTypeSerializer)
procedure SerializeRoot(
const AObject: TObject;
out ASerializerObject: TObject;
const AAttributes: TArray<TCustomAttribute>
const AAttributes: TArray<TCustomAttribute>;
const ASerializationAction: TMVCSerializationAction = nil
);

procedure DeserializeAttribute(
Expand Down Expand Up @@ -145,7 +148,8 @@ TPersonSerializer = class(TInterfacedObject, IMVCTypeSerializer)
procedure SerializeRoot(
const AObject: TObject;
out ASerializerObject: TObject;
const AAttributes: TArray<TCustomAttribute>
const AAttributes: TArray<TCustomAttribute>;
const ASerializationAction: TMVCSerializationAction = nil
);

procedure DeserializeAttribute(
Expand Down Expand Up @@ -173,8 +177,7 @@ implementation
Spring,
MVCFramework.Serializer.JsonDataObjects,
BusinessObjectsU,
System.SysUtils,
MVCFramework.Serializer.Commons;
System.SysUtils;

procedure TNullableIntegerSerializer.Deserialize(const ASerializedObject: TObject;
var AElementValue: TValue; const AAttributes: TArray<TCustomAttribute>);
Expand Down Expand Up @@ -224,8 +227,12 @@ procedure TNullableIntegerSerializer.SerializeAttribute(const AElementValue: TVa
(ASerializerObject as TJDOJsonObject).Values[APropertyName] := nil;
end;

procedure TNullableIntegerSerializer.SerializeRoot(const AObject: TObject;
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
procedure TNullableIntegerSerializer.SerializeRoot(
const AObject: TObject;
out ASerializerObject: TObject;
const AAttributes: TArray<TCustomAttribute>;
const ASerializationAction: TMVCSerializationAction = nil
);
begin
raise EMVCSerializationException.Create('Not supported');
end;
Expand Down Expand Up @@ -281,8 +288,12 @@ procedure TNullableCurrencySerializer.SerializeAttribute(const AElementValue: TV
(ASerializerObject as TJDOJsonObject).Values[APropertyName] := nil;
end;

procedure TNullableCurrencySerializer.SerializeRoot(const AObject: TObject;
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
procedure TNullableCurrencySerializer.SerializeRoot(
const AObject: TObject;
out ASerializerObject: TObject;
const AAttributes: TArray<TCustomAttribute>;
const ASerializationAction: TMVCSerializationAction = nil
);
begin
raise EMVCSerializationException.Create('Not supported');
end;
Expand Down Expand Up @@ -338,8 +349,12 @@ procedure TNullableStringSerializer.SerializeAttribute(const AElementValue: TVal
(ASerializerObject as TJDOJsonObject).Values[APropertyName] := nil;
end;

procedure TNullableStringSerializer.SerializeRoot(const AObject: TObject;
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
procedure TNullableStringSerializer.SerializeRoot(
const AObject: TObject;
out ASerializerObject: TObject;
const AAttributes: TArray<TCustomAttribute>;
const ASerializationAction: TMVCSerializationAction = nil
);
begin
raise EMVCSerializationException.Create('Not supported');
end;
Expand Down Expand Up @@ -382,8 +397,12 @@ procedure TPersonSerializer.SerializeAttribute(const AElementValue: TValue;
TJDOJsonObject(ASerializerObject).O[APropertyName] := lJSON;
end;

procedure TPersonSerializer.SerializeRoot(const AObject: TObject;
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
procedure TPersonSerializer.SerializeRoot(
const AObject: TObject;
out ASerializerObject: TObject;
const AAttributes: TArray<TCustomAttribute>;
const ASerializationAction: TMVCSerializationAction = nil
);
var
lPerson: TPerson;
lJSON: TJDOJsonObject;
Expand Down
6 changes: 3 additions & 3 deletions samples/renders_spring4d_nullables/MainControllerU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ procedure TMyController.GetDictionary;
lDict: TMVCStringDictionary;
begin
lDict := TMVCStringDictionary.Create;
lDict.AddProperty('prop1', 'one');
lDict.AddProperty('prop2', 'two');
lDict.AddProperty('prop3', 'three');
lDict.Add('prop1', 'one');
lDict.Add('prop2', 'two');
lDict.Add('prop3', 'three');
Render(lDict);
end;

Expand Down
2 changes: 1 addition & 1 deletion sources/MVCFramework.ActiveRecordController.pas
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ procedure TMVCActiveRecordController.GetEntities(const entityname: string);

lResp := TMVCActiveRecordListResponse.Create(TMVCActiveRecord.SelectRQL(lARClassRef, lRQL, GetMaxRecordCount), True);
try
lResp.Metadata.AddProperty('count', lResp.Items.Count.ToString);
lResp.Metadata.Add('count', lResp.Items.Count.ToString);
Render(lResp);
except
lResp.Free;
Expand Down
2 changes: 1 addition & 1 deletion sources/dmvcframeworkbuildconsts.inc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const
DMVCFRAMEWORK_VERSION = '3.1.1 (beryllium) RC2';
DMVCFRAMEWORK_VERSION = '3.1.1 (beryllium) RC3';
1 change: 1 addition & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def copy_sources():
]

folders = [
"d100",
"d101",
"d102",
"d103"
Expand Down

0 comments on commit 8ee3efc

Please sign in to comment.