mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 07:45:54 +01:00
Changes to the custom type serializer interface
This commit is contained in:
parent
828bb00e6c
commit
132e169542
@ -81,6 +81,7 @@
|
||||
- New! Added `gzip` and `deflate` support in `TRestClient` when reading responses
|
||||
- `TCompressionMiddleware` has been renamed in `TMVCCompressionMiddleware`
|
||||
- New! `TMVCCompressionMiddleware` is added by IDE Expert by default
|
||||
- Removed the old JSON serializer based on `System.JSON.pas', now the only available JSON serializer is based on [JsonDataObjects](https://github.com/ahausladen/JsonDataObjects) parser (Thank you Andreas Hausladen).
|
||||
|
||||
|
||||
## How to correctly get the source
|
||||
|
4
dodo.py
4
dodo.py
@ -80,12 +80,10 @@ def run_unit_tests():
|
||||
import os
|
||||
apppath = os.path.dirname(os.path.realpath(__file__))
|
||||
res = True
|
||||
tests = [
|
||||
"unittests\serializer\systemjson\TestSerializerJSON.dproj",
|
||||
tests = [
|
||||
"unittests\serializer\jsondataobjects\TestSerializerJsonDataObjects.dproj"
|
||||
]
|
||||
testsexe = [
|
||||
"unittests\serializer\systemjson\Win32\CI\TestSerializerJSON.exe",
|
||||
"unittests\serializer\jsondataobjects\Win32\CI\TestSerializerJsonDataObjects.exe"
|
||||
]
|
||||
i = 0
|
||||
|
@ -49,7 +49,7 @@ type
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
[MVCPath('/customers')]
|
||||
[MVCProduces('application/json')]
|
||||
procedure GetCustomers_AsDataSet(CTX: TWebContext);
|
||||
procedure GetCustomers_AsDataSet;
|
||||
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
[MVCPath('/customers/metadata')]
|
||||
@ -225,7 +225,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRenderSampleController.GetCustomers_AsDataSet(CTX: TWebContext);
|
||||
procedure TRenderSampleController.GetCustomers_AsDataSet;
|
||||
var
|
||||
lDM: TMyDataModule;
|
||||
begin
|
||||
|
132
samples/renders_spring4d_nullables/BusinessObjectsU.pas
Normal file
132
samples/renders_spring4d_nullables/BusinessObjectsU.pas
Normal file
@ -0,0 +1,132 @@
|
||||
unit BusinessObjectsU;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.Classes,
|
||||
Spring,
|
||||
MVCFramework.Commons,
|
||||
MVCFramework.Serializer.Commons;
|
||||
|
||||
type
|
||||
|
||||
[MVCNameCase(ncLowerCase)]
|
||||
TPerson = class
|
||||
private
|
||||
FID: Int64;
|
||||
FIDManager: TNullableInteger;
|
||||
FSalary: TNullableCurrency;
|
||||
FLastName: string;
|
||||
FMiddleName: TNullableString;
|
||||
FFirstName: string;
|
||||
FPhoto: TMemoryStream;
|
||||
FNotes: TStringStream;
|
||||
procedure SetID(const Value: Int64);
|
||||
procedure SetIDManager(const Value: TNullableInteger);
|
||||
procedure SetSalary(const Value: TNullableCurrency);
|
||||
procedure SetFirstName(const Value: string);
|
||||
procedure SetLastName(const Value: string);
|
||||
procedure SetMiddleName(const Value: TNullableString);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
property ID: Int64 read FID write SetID;
|
||||
property IDManager: TNullableInteger read FIDManager write SetIDManager;
|
||||
property Salary: TNullableCurrency read FSalary write SetSalary;
|
||||
property FirstName: string read FFirstName write SetFirstName;
|
||||
property LastName: string read FLastName write SetLastName;
|
||||
property MiddleName: TNullableString read FMiddleName write SetMiddleName;
|
||||
property Photo: TMemoryStream read FPhoto;
|
||||
[MVCSerializeAsString]
|
||||
property Notes: TStringStream read FNotes;
|
||||
end;
|
||||
|
||||
[MVCNameCase(ncLowerCase)]
|
||||
TParent = class
|
||||
private
|
||||
FPerson: TPerson;
|
||||
FFullName: TNullableString;
|
||||
procedure SetPerson(const Value: TPerson);
|
||||
procedure SetFullName(const Value: TNullableString);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
property FullName: TNullableString read FFullName write SetFullName;
|
||||
property Person: TPerson read FPerson write SetPerson;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TPerson }
|
||||
|
||||
constructor TPerson.Create;
|
||||
begin
|
||||
inherited;
|
||||
FPhoto := TMemoryStream.Create;
|
||||
FNotes := TStringStream.Create;
|
||||
FNotes.WriteString('This is a note');
|
||||
FPhoto.CopyFrom(FNotes, 0);
|
||||
end;
|
||||
|
||||
destructor TPerson.Destroy;
|
||||
begin
|
||||
FPhoto.Free;
|
||||
FNotes.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TPerson.SetFirstName(const Value: string);
|
||||
begin
|
||||
FFirstName := Value;
|
||||
end;
|
||||
|
||||
procedure TPerson.SetID(const Value: Int64);
|
||||
begin
|
||||
FID := Value;
|
||||
end;
|
||||
|
||||
procedure TPerson.SetIDManager(const Value: TNullableInteger);
|
||||
begin
|
||||
FIDManager := Value;
|
||||
end;
|
||||
|
||||
procedure TPerson.SetLastName(const Value: string);
|
||||
begin
|
||||
FLastName := Value;
|
||||
end;
|
||||
|
||||
procedure TPerson.SetMiddleName(const Value: TNullableString);
|
||||
begin
|
||||
FMiddleName := Value;
|
||||
end;
|
||||
|
||||
procedure TPerson.SetSalary(const Value: TNullableCurrency);
|
||||
begin
|
||||
FSalary := Value;
|
||||
end;
|
||||
|
||||
{ TParent }
|
||||
|
||||
constructor TParent.Create;
|
||||
begin
|
||||
inherited;
|
||||
FPerson := TPerson.Create;
|
||||
end;
|
||||
|
||||
destructor TParent.Destroy;
|
||||
begin
|
||||
FPerson.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TParent.SetFullName(const Value: TNullableString);
|
||||
begin
|
||||
FFullName := Value;
|
||||
end;
|
||||
|
||||
procedure TParent.SetPerson(const Value: TPerson);
|
||||
begin
|
||||
FPerson := Value;
|
||||
end;
|
||||
|
||||
end.
|
398
samples/renders_spring4d_nullables/CustomTypesSerializersU.pas
Normal file
398
samples/renders_spring4d_nullables/CustomTypesSerializersU.pas
Normal file
@ -0,0 +1,398 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Delphi MVC Framework
|
||||
//
|
||||
// Copyright (c) 2010-2018 Daniele Teti and the DMVCFramework Team
|
||||
//
|
||||
// https://github.com/danieleteti/delphimvcframework
|
||||
//
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
unit CustomTypesSerializersU;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
MVCFramework.Serializer.Intf,
|
||||
System.Rtti;
|
||||
|
||||
type
|
||||
// Custom serializer for TNullableAliasSerializer type
|
||||
TNullableIntegerSerializer = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
public
|
||||
procedure SerializeAttribute(
|
||||
const AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure SerializeRoot(
|
||||
const AObject: TObject;
|
||||
out ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeRoot(
|
||||
const ASerializerObject: TObject;
|
||||
const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure Deserialize(
|
||||
const ASerializedObject: TObject;
|
||||
var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
end;
|
||||
|
||||
TNullableCurrencySerializer = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
public
|
||||
procedure SerializeAttribute(
|
||||
const AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure SerializeRoot(
|
||||
const AObject: TObject;
|
||||
out ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeRoot(
|
||||
const ASerializerObject: TObject;
|
||||
const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure Deserialize(
|
||||
const ASerializedObject: TObject;
|
||||
var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
end;
|
||||
|
||||
TNullableStringSerializer = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
public
|
||||
procedure SerializeAttribute(
|
||||
const AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure SerializeRoot(
|
||||
const AObject: TObject;
|
||||
out ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeRoot(
|
||||
const ASerializerObject: TObject;
|
||||
const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure Deserialize(
|
||||
const ASerializedObject: TObject;
|
||||
var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
end;
|
||||
|
||||
TPersonSerializer = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
public
|
||||
procedure SerializeAttribute(
|
||||
const AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure SerializeRoot(
|
||||
const AObject: TObject;
|
||||
out ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure DeserializeRoot(
|
||||
const ASerializerObject: TObject;
|
||||
const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure Deserialize(
|
||||
const ASerializedObject: TObject;
|
||||
var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
JsonDataObjects,
|
||||
Spring,
|
||||
MVCFramework.Serializer.JsonDataObjects,
|
||||
BusinessObjectsU,
|
||||
System.SysUtils,
|
||||
MVCFramework.Serializer.Commons;
|
||||
|
||||
procedure TNullableIntegerSerializer.Deserialize(const ASerializedObject: TObject;
|
||||
var AElementValue: TValue; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TNullableIntegerSerializer.DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
var
|
||||
lJSON: TJDOJsonObject;
|
||||
lNullInt: Nullable<Integer>;
|
||||
begin
|
||||
lJSON := ASerializerObject as TJDOJsonObject;
|
||||
lNullInt := AElementValue.AsType<Nullable<Integer>>;
|
||||
if lJSON.Values[APropertyName].Typ in [jdtNone, jdtObject { json nulls are recognized as jdtObject } ] then
|
||||
begin
|
||||
lNullInt := nil;
|
||||
end
|
||||
else
|
||||
begin
|
||||
lNullInt := lJSON.I[APropertyName];
|
||||
end;
|
||||
AElementValue := TValue.From < Nullable < Integer >> (lNullInt);
|
||||
end;
|
||||
|
||||
procedure TNullableIntegerSerializer.DeserializeRoot(const ASerializerObject,
|
||||
AObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
raise Exception.Create('Not implemented');
|
||||
end;
|
||||
|
||||
procedure TNullableIntegerSerializer.SerializeAttribute(const AElementValue: TValue;
|
||||
const APropertyName: string; const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
lNullInteger: Nullable<Integer>;
|
||||
begin
|
||||
lNullInteger := AElementValue.AsType<TNullableInteger>;
|
||||
if lNullInteger.HasValue then
|
||||
(ASerializerObject as TJDOJsonObject).I[APropertyName] := lNullInteger.Value
|
||||
else
|
||||
(ASerializerObject as TJDOJsonObject).Values[APropertyName] := nil;
|
||||
end;
|
||||
|
||||
procedure TNullableIntegerSerializer.SerializeRoot(const AObject: TObject;
|
||||
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
raise EMVCSerializationException.Create('Not supported');
|
||||
end;
|
||||
|
||||
{ TNullableCurrencySerializer }
|
||||
|
||||
procedure TNullableCurrencySerializer.Deserialize(
|
||||
const ASerializedObject: TObject; var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TNullableCurrencySerializer.DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
var
|
||||
lJSON: TJDOJsonObject;
|
||||
lNullCurrency: Nullable<Currency>;
|
||||
begin
|
||||
lJSON := ASerializerObject as TJDOJsonObject;
|
||||
lNullCurrency := AElementValue.AsType<Nullable<Currency>>;
|
||||
if lJSON.Values[APropertyName].Typ in [jdtNone, jdtObject { json nulls are recognized as jdtObject } ] then
|
||||
begin
|
||||
lNullCurrency := nil;
|
||||
end
|
||||
else
|
||||
begin
|
||||
lNullCurrency := Currency(lJSON.F[APropertyName]);
|
||||
end;
|
||||
AElementValue := TValue.From < Nullable < Currency >> (lNullCurrency);
|
||||
end;
|
||||
|
||||
procedure TNullableCurrencySerializer.DeserializeRoot(const ASerializerObject,
|
||||
AObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
raise Exception.Create('Not implemented');
|
||||
end;
|
||||
|
||||
procedure TNullableCurrencySerializer.SerializeAttribute(const AElementValue: TValue;
|
||||
const APropertyName: string; const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
lNullCurrency: Nullable<Currency>;
|
||||
begin
|
||||
lNullCurrency := AElementValue.AsType<TNullableCurrency>;
|
||||
if lNullCurrency.HasValue then
|
||||
(ASerializerObject as TJDOJsonObject).F[APropertyName] := lNullCurrency.Value
|
||||
else
|
||||
(ASerializerObject as TJDOJsonObject).Values[APropertyName] := nil;
|
||||
end;
|
||||
|
||||
procedure TNullableCurrencySerializer.SerializeRoot(const AObject: TObject;
|
||||
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
raise EMVCSerializationException.Create('Not supported');
|
||||
end;
|
||||
|
||||
{ TNullableStringSerializer }
|
||||
|
||||
procedure TNullableStringSerializer.Deserialize(
|
||||
const ASerializedObject: TObject; var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TNullableStringSerializer.DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
var
|
||||
lJSON: TJDOJsonObject;
|
||||
lNullString: Nullable<string>;
|
||||
begin
|
||||
lJSON := ASerializerObject as TJDOJsonObject;
|
||||
lNullString := AElementValue.AsType<Nullable<string>>;
|
||||
if lJSON.Values[APropertyName].Typ in [jdtNone, jdtObject { json nulls are recognized as jdtObject } ] then
|
||||
begin
|
||||
lNullString := nil;
|
||||
end
|
||||
else
|
||||
begin
|
||||
lNullString := lJSON.S[APropertyName];
|
||||
end;
|
||||
AElementValue := TValue.From < Nullable < string >> (lNullString);
|
||||
end;
|
||||
|
||||
procedure TNullableStringSerializer.DeserializeRoot(const ASerializerObject,
|
||||
AObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
raise Exception.Create('Not implemented');
|
||||
end;
|
||||
|
||||
procedure TNullableStringSerializer.SerializeAttribute(const AElementValue: TValue;
|
||||
const APropertyName: string; const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
lNullString: Nullable<string>;
|
||||
begin
|
||||
lNullString := AElementValue.AsType<TNullableString>;
|
||||
if lNullString.HasValue then
|
||||
(ASerializerObject as TJDOJsonObject).S[APropertyName] := lNullString.Value
|
||||
else
|
||||
(ASerializerObject as TJDOJsonObject).Values[APropertyName] := nil;
|
||||
end;
|
||||
|
||||
procedure TNullableStringSerializer.SerializeRoot(const AObject: TObject;
|
||||
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
raise EMVCSerializationException.Create('Not supported');
|
||||
end;
|
||||
|
||||
{ TPersonSerializer }
|
||||
|
||||
procedure TPersonSerializer.Deserialize(const ASerializedObject: TObject;
|
||||
var AElementValue: TValue; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TPersonSerializer.DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
begin
|
||||
raise Exception.Create('Not implemented');
|
||||
end;
|
||||
|
||||
procedure TPersonSerializer.DeserializeRoot(const ASerializerObject,
|
||||
AObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
raise Exception.Create('Not implemented');
|
||||
end;
|
||||
|
||||
procedure TPersonSerializer.SerializeAttribute(const AElementValue: TValue;
|
||||
const APropertyName: string; const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
lPerson: TPerson;
|
||||
lJSON: TJDOJsonObject;
|
||||
begin
|
||||
lPerson := AElementValue.AsObject as TPerson;
|
||||
lJSON := TJDOJsonObject.Create;
|
||||
lJSON.S['firstname'] := lPerson.FirstName;
|
||||
lJSON.B['customserialization'] := True;
|
||||
TJDOJsonObject(ASerializerObject).O[APropertyName] := lJSON;
|
||||
end;
|
||||
|
||||
procedure TPersonSerializer.SerializeRoot(const AObject: TObject;
|
||||
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
lPerson: TPerson;
|
||||
lJSON: TJDOJsonObject;
|
||||
begin
|
||||
lPerson := AObject as TPerson;
|
||||
lJSON := TJDOJsonObject.Create;
|
||||
lJSON.S['firstname'] := lPerson.FirstName;
|
||||
lJSON.B['customserialization'] := True;
|
||||
ASerializerObject := lJSON;
|
||||
end;
|
||||
|
||||
end.
|
137
samples/renders_spring4d_nullables/MainControllerU.pas
Normal file
137
samples/renders_spring4d_nullables/MainControllerU.pas
Normal file
@ -0,0 +1,137 @@
|
||||
unit MainControllerU;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
MVCFramework,
|
||||
MVCFramework.Commons;
|
||||
|
||||
type
|
||||
|
||||
[MVCPath('/api')]
|
||||
TMyController = class(TMVCController)
|
||||
public
|
||||
[MVCPath('/')]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure Index;
|
||||
public
|
||||
// Sample CRUD Actions for a "Customer" entity
|
||||
[MVCPath('/dictionary')]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure GetDictionary;
|
||||
|
||||
[MVCPath('/people')]
|
||||
[MVCHTTPMethod([httpPOST])]
|
||||
procedure CreatePerson;
|
||||
|
||||
[MVCPath('/people/($id)')]
|
||||
[MVCHTTPMethod([httpPUT])]
|
||||
procedure UpdatePerson(id: Integer);
|
||||
|
||||
[MVCPath('/people/($id)')]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure GetPerson(id: Integer);
|
||||
|
||||
[MVCPath('/people/($id)')]
|
||||
[MVCHTTPMethod([httpDELETE])]
|
||||
procedure DeletePerson(id: Integer);
|
||||
|
||||
[MVCPath('/parent/($id)')]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure GetParent(id: Integer);
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
MVCFramework.Logger,
|
||||
System.StrUtils,
|
||||
BusinessObjectsU,
|
||||
Spring;
|
||||
|
||||
procedure TMyController.Index;
|
||||
begin
|
||||
// use Context property to access to the HTTP request and response
|
||||
Render('Hello DelphiMVCFramework World');
|
||||
end;
|
||||
|
||||
// Sample CRUD Actions for a "Customer" entity
|
||||
procedure TMyController.GetDictionary;
|
||||
var
|
||||
lDict: TMVCStringDictionary;
|
||||
begin
|
||||
lDict := TMVCStringDictionary.Create;
|
||||
lDict.AddProperty('prop1', 'one');
|
||||
lDict.AddProperty('prop2', 'two');
|
||||
lDict.AddProperty('prop3', 'three');
|
||||
Render(lDict);
|
||||
end;
|
||||
|
||||
procedure TMyController.GetParent(id: Integer);
|
||||
var
|
||||
lParent: TParent;
|
||||
begin
|
||||
lParent := TParent.Create;
|
||||
try
|
||||
lParent.FullName := 'Hello World';
|
||||
lParent.Person.id := id;
|
||||
lParent.Person.FirstName := 'Daniele';
|
||||
lParent.Person.LastName := 'Teti';
|
||||
lParent.Person.MiddleName := nil;
|
||||
Render(lParent, False);
|
||||
finally
|
||||
lParent.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMyController.GetPerson(id: Integer);
|
||||
var
|
||||
lPerson: TPerson;
|
||||
begin
|
||||
lPerson := TPerson.Create;
|
||||
try
|
||||
lPerson.id := id;
|
||||
lPerson.FirstName := 'Daniele';
|
||||
lPerson.LastName := 'Teti';
|
||||
lPerson.MiddleName := nil;
|
||||
Render(lPerson, False);
|
||||
finally
|
||||
lPerson.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMyController.CreatePerson;
|
||||
var
|
||||
lPerson: TPerson;
|
||||
begin
|
||||
lPerson := Context.Request.BodyAs<TPerson>;
|
||||
try
|
||||
Render(lPerson, False);
|
||||
finally
|
||||
lPerson.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMyController.UpdatePerson(id: Integer);
|
||||
var
|
||||
lPerson: TPerson;
|
||||
begin
|
||||
lPerson := Context.Request.BodyAs<TPerson>;
|
||||
try
|
||||
lPerson.id := id;
|
||||
lPerson.FirstName := lPerson.FirstName + ' (updated)';
|
||||
lPerson.LastName := lPerson.LastName + ' (updated)';
|
||||
Render(lPerson, False);
|
||||
finally
|
||||
lPerson.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMyController.DeletePerson(id: Integer);
|
||||
begin
|
||||
Render(http_status.OK, 'Deleted');
|
||||
end;
|
||||
|
||||
end.
|
8
samples/renders_spring4d_nullables/WebModuleU.dfm
Normal file
8
samples/renders_spring4d_nullables/WebModuleU.dfm
Normal file
@ -0,0 +1,8 @@
|
||||
object MyWebModule: TMyWebModule
|
||||
OldCreateOrder = False
|
||||
OnCreate = WebModuleCreate
|
||||
OnDestroy = WebModuleDestroy
|
||||
Actions = <>
|
||||
Height = 230
|
||||
Width = 415
|
||||
end
|
82
samples/renders_spring4d_nullables/WebModuleU.pas
Normal file
82
samples/renders_spring4d_nullables/WebModuleU.pas
Normal file
@ -0,0 +1,82 @@
|
||||
unit WebModuleU;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
System.Classes,
|
||||
Web.HTTPApp,
|
||||
MVCFramework;
|
||||
|
||||
type
|
||||
TMyWebModule = class(TWebModule)
|
||||
procedure WebModuleCreate(Sender: TObject);
|
||||
procedure WebModuleDestroy(Sender: TObject);
|
||||
private
|
||||
FMVC: TMVCEngine;
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
WebModuleClass: TComponentClass = TMyWebModule;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
|
||||
uses
|
||||
MainControllerU,
|
||||
System.IOUtils,
|
||||
MVCFramework.Commons,
|
||||
MVCFramework.Middleware.Compression,
|
||||
CustomTypesSerializersU,
|
||||
Spring,
|
||||
BusinessObjectsU;
|
||||
|
||||
procedure TMyWebModule.WebModuleCreate(Sender: TObject);
|
||||
begin
|
||||
FMVC := TMVCEngine.Create(Self,
|
||||
procedure(Config: TMVCConfig)
|
||||
begin
|
||||
// enable static files
|
||||
Config[TMVCConfigKey.DocumentRoot] := TPath.Combine(ExtractFilePath(GetModuleName(HInstance)), 'www');
|
||||
// session timeout (0 means session cookie)
|
||||
Config[TMVCConfigKey.SessionTimeout] := '0';
|
||||
// default content-type
|
||||
Config[TMVCConfigKey.DefaultContentType] := TMVCConstants.DEFAULT_CONTENT_TYPE;
|
||||
// default content charset
|
||||
Config[TMVCConfigKey.DefaultContentCharset] := TMVCConstants.DEFAULT_CONTENT_CHARSET;
|
||||
// unhandled actions are permitted?
|
||||
Config[TMVCConfigKey.AllowUnhandledAction] := 'false';
|
||||
// default view file extension
|
||||
Config[TMVCConfigKey.DefaultViewFileExtension] := 'html';
|
||||
// view path
|
||||
Config[TMVCConfigKey.ViewPath] := 'templates';
|
||||
// Max Record Count for automatic Entities CRUD
|
||||
Config[TMVCConfigKey.MaxEntitiesRecordCount] := '20';
|
||||
// Enable Server Signature in response
|
||||
Config[TMVCConfigKey.ExposeServerSignature] := 'true';
|
||||
// Define a default URL for requests that don't map to a route or a file (useful for client side web app)
|
||||
Config[TMVCConfigKey.FallbackResource] := 'index.html';
|
||||
end);
|
||||
FMVC.AddController(TMyController);
|
||||
// To enable compression (deflate, gzip) just add this middleware as the last one
|
||||
FMVC.AddMiddleware(TMVCCompressionMiddleware.Create);
|
||||
FMVC.Serializers.Items[BuildContentType('application/json', 'utf-8')]
|
||||
.RegisterTypeSerializer(typeinfo(Nullable<System.Integer>), TNullableIntegerSerializer.Create);
|
||||
FMVC.Serializers.Items[BuildContentType('application/json', 'utf-8')]
|
||||
.RegisterTypeSerializer(typeinfo(Nullable<System.Currency>), TNullableCurrencySerializer.Create);
|
||||
FMVC.Serializers.Items[BuildContentType('application/json', 'utf-8')]
|
||||
.RegisterTypeSerializer(typeinfo(Nullable<System.string>), TNullableStringSerializer.Create);
|
||||
// FMVC.Serializers.Items[BuildContentType('application/json', 'utf-8')]
|
||||
// .RegisterTypeSerializer(typeinfo(TPerson), TPersonSerializer.Create);
|
||||
end;
|
||||
|
||||
procedure TMyWebModule.WebModuleDestroy(Sender: TObject);
|
||||
begin
|
||||
FMVC.Free;
|
||||
end;
|
||||
|
||||
end.
|
@ -0,0 +1,111 @@
|
||||
program renders_spring4d_nullables;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
MVCFramework.Logger,
|
||||
MVCFramework.Commons,
|
||||
MVCFramework.REPLCommandsHandlerU,
|
||||
Web.ReqMulti,
|
||||
Web.WebReq,
|
||||
Web.WebBroker,
|
||||
IdHTTPWebBrokerBridge,
|
||||
MainControllerU in 'MainControllerU.pas',
|
||||
WebModuleU in 'WebModuleU.pas' {MyWebModule: TWebModule},
|
||||
BusinessObjectsU in 'BusinessObjectsU.pas',
|
||||
CustomTypesSerializersU in 'CustomTypesSerializersU.pas';
|
||||
|
||||
{$R *.res}
|
||||
|
||||
procedure RunServer(APort: Integer);
|
||||
var
|
||||
lServer: TIdHTTPWebBrokerBridge;
|
||||
lCustomHandler: TMVCCustomREPLCommandsHandler;
|
||||
lCmd: string;
|
||||
begin
|
||||
Writeln('** DMVCFramework Server ** build ' + DMVCFRAMEWORK_VERSION);
|
||||
if ParamCount >= 1 then
|
||||
lCmd := ParamStr(1)
|
||||
else
|
||||
lCmd := 'start';
|
||||
|
||||
lCustomHandler := function(const Value: String; const Server: TIdHTTPWebBrokerBridge; out Handled: Boolean): THandleCommandResult
|
||||
begin
|
||||
Handled := False;
|
||||
Result := THandleCommandResult.Unknown;
|
||||
|
||||
// Write here your custom command for the REPL using the following form...
|
||||
// ***
|
||||
// Handled := False;
|
||||
// if (Value = 'apiversion') then
|
||||
// begin
|
||||
// REPLEmit('Print my API version number');
|
||||
// Result := THandleCommandResult.Continue;
|
||||
// Handled := True;
|
||||
// end
|
||||
// else if (Value = 'datetime') then
|
||||
// begin
|
||||
// REPLEmit(DateTimeToStr(Now));
|
||||
// Result := THandleCommandResult.Continue;
|
||||
// Handled := True;
|
||||
// end;
|
||||
end;
|
||||
|
||||
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
||||
try
|
||||
LServer.DefaultPort := APort;
|
||||
|
||||
{ more info about MaxConnections
|
||||
http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_MaxConnections.html }
|
||||
LServer.MaxConnections := 0;
|
||||
|
||||
{ more info about ListenQueue
|
||||
http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_ListenQueue.html }
|
||||
LServer.ListenQueue := 200;
|
||||
|
||||
WriteLn('Write "quit" or "exit" to shutdown the server');
|
||||
repeat
|
||||
if lCmd.IsEmpty then
|
||||
begin
|
||||
Write('-> ');
|
||||
ReadLn(lCmd)
|
||||
end;
|
||||
try
|
||||
case HandleCommand(lCmd.ToLower, LServer, lCustomHandler) of
|
||||
THandleCommandResult.Continue:
|
||||
begin
|
||||
Continue;
|
||||
end;
|
||||
THandleCommandResult.Break:
|
||||
begin
|
||||
Break;
|
||||
end;
|
||||
THandleCommandResult.Unknown:
|
||||
begin
|
||||
REPLEmit('Unknown command: ' + lCmd);
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
lCmd := '';
|
||||
end;
|
||||
until false;
|
||||
|
||||
finally
|
||||
LServer.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
ReportMemoryLeaksOnShutdown := True;
|
||||
IsMultiThread := True;
|
||||
try
|
||||
if WebRequestHandler <> nil then
|
||||
WebRequestHandler.WebModuleClass := WebModuleClass;
|
||||
WebRequestHandlerProc.MaxConnections := 1024;
|
||||
RunServer(8080);
|
||||
except
|
||||
on E: Exception do
|
||||
Writeln(E.ClassName, ': ', E.Message);
|
||||
end;
|
||||
end.
|
@ -1,18 +1,48 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{BE4B26EC-1B9E-425C-8EA8-F7134959A506}</ProjectGuid>
|
||||
<ProjectGuid>{6EE1DB07-C1AE-4A17-ADD8-F3EB7A3BB010}</ProjectGuid>
|
||||
<ProjectVersion>18.4</ProjectVersion>
|
||||
<FrameworkType>None</FrameworkType>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<MainSource>renders_spring4d_nullables.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">CONSOLE</Config>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>1</TargetedPlatforms>
|
||||
<AppType>Console</AppType>
|
||||
<MainSource>TestSerializerJSON.dpr</MainSource>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
|
||||
<Base_Android>true</Base_Android>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''">
|
||||
<Base_iOSDevice32>true</Base_iOSDevice32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''">
|
||||
<Base_iOSDevice64>true</Base_iOSDevice64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''">
|
||||
<Base_iOSSimulator>true</Base_iOSSimulator>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Linux64' and '$(Base)'=='true') or '$(Base_Linux64)'!=''">
|
||||
<Base_Linux64>true</Base_Linux64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='OSX32' and '$(Base)'=='true') or '$(Base_OSX32)'!=''">
|
||||
<Base_OSX32>true</Base_OSX32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||
<Base_Win32>true</Base_Win32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
@ -34,50 +64,56 @@
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='CONSOLE' or '$(Cfg_3)'!=''">
|
||||
<Cfg_3>true</Cfg_3>
|
||||
<CfgParent>Cfg_1</CfgParent>
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_3)'=='true') or '$(Cfg_3_Win32)'!=''">
|
||||
<Cfg_3_Win32>true</Cfg_3_Win32>
|
||||
<CfgParent>Cfg_3</CfgParent>
|
||||
<Cfg_3>true</Cfg_3>
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<SanitizedProjectName>TestSerializerJSON</SanitizedProjectName>
|
||||
<DCC_UnitSearchPath>$(BDS)\Source\DUnit\src;..\..\..\sources;..\..\..\lib\loggerpro;..\..\..\lib\dmustache;..\..\..\lib\delphistompclient;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<VerInfo_Locale>1046</VerInfo_Locale>
|
||||
<DCC_DcpOutput>.\$(Platform)\$(Config)\dcp</DCC_DcpOutput>
|
||||
<DCC_BplOutput>.\$(Platform)\$(Config)\pkg</DCC_BplOutput>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||
<DCC_Define>_CONSOLE_TESTRUNNER;TESTINSIGHT;$(DCC_Define)</DCC_Define>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<DCC_DcuOutput>.\$(Platform)\$(Config)\dcu</DCC_DcuOutput>
|
||||
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
|
||||
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
|
||||
<DCC_E>false</DCC_E>
|
||||
<DCC_N>false</DCC_N>
|
||||
<DCC_S>false</DCC_S>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
<DCC_UsePackage>RESTComponents;emsclientfiredac;DataSnapFireDAC;FireDACIBDriver;emsclient;FireDACCommon;RESTBackendComponents;soapserver;CloudService;FireDACCommonDriver;inet;FireDAC;FireDACSqliteDriver;soaprtl;soapmidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||
<UsingDelphiRTL>true</UsingDelphiRTL>
|
||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||
<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
|
||||
<DCC_UnitSearchPath>$(DMVC);$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<DCC_Framework>VCL;$(DCC_Framework)</DCC_Framework>
|
||||
<SanitizedProjectName>renders_spring4d_nullables</SanitizedProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Android)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;DBXInterBaseDriver;tethering;bindcompfmx;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;DbxCommonDriver;xmlrtl;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar</EnabledSysJars>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSDevice32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;fmxase;DBXInterBaseDriver;tethering;bindcompfmx;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;DbxCommonDriver;xmlrtl;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSDevice64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;fmxase;DBXInterBaseDriver;tethering;rtcSDK;PythonVCL_D;bindcompfmx;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;rtcSDK_DBA;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;DbxCommonDriver;xmlrtl;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSSimulator)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;fmxase;DBXInterBaseDriver;tethering;bindcompfmx;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;DbxCommonDriver;xmlrtl;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Linux64)'!=''">
|
||||
<DCC_UsePackage>FireDACADSDriver;rtcSDK;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;PythonVCL_D;inetdb;emsedge;dbexpress;IndyCore;dsnap;DataSnapCommon;DataSnapConnectors;bindengine;FireDACOracleDriver;FireDACMySQLDriver;FireDACCommonODBC;DataSnapClient;rtcSDK_DBA;IndySystem;FireDACDb2Driver;FireDACInfxDriver;emshosting;FireDACPgDriver;FireDACASADriver;FireDACTDataDriver;DbxCommonDriver;DataSnapServer;xmlrtl;DataSnapNativeClient;rtl;DbxClientDriver;CustomIPTransport;bindcomp;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;dbrtl;IndyProtocols;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_OSX32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;fmxase;DBXInterBaseDriver;tethering;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;emsedge;fmx;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;emshosting;FireDACPgDriver;FireDACASADriver;FireDACTDataDriver;DbxCommonDriver;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;FireDACDSDriver;rtl;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;dxSkinBlueprintRS24;dxPSDBTeeChartRS24;dxPSdxGaugeControlLnkRS24;vclactnband;dxSpreadSheetRS24;vclFireDAC;dxDockingRS24;fs24;tethering;dxSkinVisualStudio2013BlueRS24;dxPScxTLLnkRS24;dxBarExtItemsRS24;FireDACADSDriver;dxFireDACServerModeRS24;dxPSTeeChartRS24;dxSkinOffice2007BlackRS24;FireDACMSSQLDriver;vcltouch;ACBr_NFe;ACBr_NFeDanfeFR;vcldb;Intraweb;svn;dxSkinXmas2008BlueRS24;dxSkinscxSchedulerPainterRS24;Spring.Data;ACBr_NFeDanfeESCPOS;dxSkinsdxBarPainterRS24;dxSkinOffice2010BlackRS24;dxADOServerModeRS24;dxGDIPlusRS24;dxPSdxDBTVLnkRS24;frx24;vclib;dxSkinLilianRS24;FireDACDBXDriver;ACBr_NFSeDanfseFR;dxNavBarRS24;vclx;cxTreeListRS24;dxSkinDevExpressDarkStyleRS24;dxtrmdRS24;ACBr_SATExtratoRL;RESTBackendComponents;dxRibbonRS24;VCLRESTComponents;cxExportRS24;cxPivotGridChartRS24;cxTreeListdxBarPopupMenuRS24;dxSkinOffice2013LightGrayRS24;dxTabbedMDIRS24;vclie;dxSkinVisualStudio2013LightRS24;bindengine;CloudService;remotedb;ACBr_PAF;FireDACMySQLDriver;cxPivotGridOLAPRS24;ACBr_SATECFVirtual;dxSkinSharpRS24;dxSkinBlackRS24;DataSnapClient;dxPSLnksRS24;bindcompdbx;ACBr_CTeDacteRL;dxSkinCoffeeRS24;ACBr_TCP;IndyIPServer;ACBr_CTe;dxSkinsdxRibbonPainterRS24;dxCoreRS24;IndySystem;dxSkinOffice2013DarkGrayRS24;dsnapcon;ACBr_synapse;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;ACBr_SPEDImportar;ACBr_SPED;ACBr_MDFe;emshosting;dxBarDBNavRS24;dxSkinDarkSideRS24;ACBr_BoletoRL;ACBr_LFD;dxSkinOffice2013WhiteRS24;FireDACTDataDriver;dxPSdxLCLnkRS24;FMXTee;dxPScxExtCommonRS24;dxPScxPivotGridLnkRS24;soaprtl;DbxCommonDriver;ACBr_NFSeDanfseRL;xmlrtl;soapmidas;fmxobj;dxSkinMcSkinRS24;rtl;dxLayoutControlRS24;DbxClientDriver;cxGridRS24;dxSkinBlueRS24;dxSpellCheckerRS24;cxLibraryRS24;dxSkinStardustRS24;dxSkinCaramelRS24;ACBr_Convenio115;appanalytics;dxSkinsCoreRS24;dxDBXServerModeRS24;dxMapControlRS24;IndyIPClient;dxSkinHighContrastRS24;bindcompvcl;dxSkinTheAsphaltWorldRS24;frxe24;TeeUI;cxPageControlRS24;cxEditorsRS24;dxPsPrVwAdvRS24;dxSkinSevenClassicRS24;VclSmp;cxSchedulerRibbonStyleEventEditorRS24;FireDACODBCDriver;dxSkinPumpkinRS24;aurelius;dxSkinscxPCPainterRS24;dxPSPrVwRibbonRS24;ACBr_Boleto;ACBr_SEF2;FireDACMongoDBDriver;dxSkinSevenRS24;ACBr_MDFeDamdfeFR;ACBr_NFSe;dxdborRS24;dxmdsRS24;cxSchedulerGridRS24;RESTComponents;dxHttpIndyRequestRS24;cxPivotGridRS24;DBXInterBaseDriver;ACBr_TEFD;emsclientfiredac;DataSnapFireDAC;svnui;dxdbtrRS24;dxSkinMetropolisRS24;dxSkinMoneyTwinsRS24;dxPScxPCProdRS24;ACBr_MDFeDamdfeRL;dxWizardControlRS24;bindcompfmx;dxPSdxOCLnkRS24;dxBarExtDBItemsRS24;dxPSdxFCLnkRS24;inetdb;cxSchedulerTreeBrowserRS24;dxSkinOffice2016ColorfulRS24;ACBr_Diversos;ACBr_TXTComum;ACBr_GNREGuiaFR;FmxTeeUI;emsedge;FireDACIBDriver;fmx;fmxdae;dxSkinSpringTimeRS24;dxSkinValentineRS24;dxSkinLondonLiquidSkyRS24;ACBr_CTeDacteFR;dxSkinWhiteprintRS24;ACBr_Ponto;dbexpress;IndyCore;dxSkiniMaginaryRS24;dxTileControlRS24;dxSkinOffice2016DarkRS24;dsnap;emsclient;DataSnapCommon;cxDataRS24;FireDACCommon;dxSkinOffice2007PinkRS24;dxPSdxSpreadSheetLnkRS24;ACBr_PCNComum;ACBR_DeSTDA;dxSkinDevExpressStyleRS24;soapserver;ACBr_SAT;dxBarRS24;dxSkinMetropolisDarkRS24;FireDACOracleDriver;DBXMySQLDriver;dxPSRichEditControlLnkRS24;dxPScxCommonRS24;ACBr_Sintegra;FireDACCommonODBC;FireDACCommonDriver;ACBr_GNRE;inet;IndyIPCommon;dxSkinVS2010RS24;vcl;ACBr_NFeDanfeRL;dxSkinSharpPlusRS24;ACBr_SATExtratoESCPOS;dxPSdxDBOCLnkRS24;FireDACDb2Driver;dxThemeRS24;dxSkinOffice2007GreenRS24;TeeDB;FireDAC;dxPScxGridLnkRS24;dxPScxVGridLnkRS24;ACBr_Comum;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;dxSkinOffice2010BlueRS24;ACBr_GNREGuiaRL;dxServerModeRS24;ibxpress;Tee;ibxbindings;cxSchedulerRS24;vclwinx;FireDACDSDriver;dxSkinsdxDLPainterRS24;dxPSCoreRS24;dxSkinOffice2007BlueRS24;ACBr_OpenSSL;frxTee24;CustomIPTransport;vcldsnap;dxSkinGlassOceansRS24;dxRibbonCustomizationFormRS24;dxPScxSchedulerLnkRS24;ACBr_DFeComum;dxSkinSummer2008RS24;dxSkinDarkRoomRS24;bindcomp;dxSkinFoggyRS24;ACBr_Serial;dxorgcRS24;dxSkinOffice2010SilverRS24;frce;ACBr_BlocoX;dxRichEditControlRS24;dxSkinsdxNavBarPainterRS24;dbxcds;ACBr_NFCeECFVirtual;adortl;dxSkinSilverRS24;ACBr_BoletoFR;dxSkinVisualStudio2013DarkRS24;dxComnRS24;cxVerticalGridRS24;dxFlowChartRS24;frxDB24;dsnapxml;dbrtl;IndyProtocols;inetdbxpress;dxGaugeControlRS24;dxSkinOffice2007SilverRS24;dxSkinLiquidSkyRS24;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<DCC_UsePackage>DBXSqliteDriver;fmxase;DBXDb2Driver;DBXInterBaseDriver;OverbyteIcsD102Run;vclactnband;vclFireDAC;tethering;svnui;FireDACADSDriver;rtcSDK;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;PythonVCL_D;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;MQTTComponents;VirtualTreesDR;RaizeComponentsVcl;CEF4Delphi;emsedge;RaizeComponentsVclDb;fmx;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;vclx;Python_D;dsnap;DataSnapCommon;Package1;DataSnapConnectors;VCLRESTComponents;JclDeveloperTools;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;pasdoc_package_XE8;FireDACCommonODBC;DataSnapClient;rtcSDK_DBA;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;DMVC_IDE_Expert_D102Tokyo;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;Jcl;emshosting;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;RFindUnit;DbxClientDriver;dclFFMSource250;DBXSybaseASADriver;CustomIPTransport;vcldsnap;SynEditDR;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;dbxcds;VclSmp;adortl;FireDACODBCDriver;JclVcl;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;JclContainers;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;dxSkinBlueprintRS24;dxPSDBTeeChartRS24;dxPSdxGaugeControlLnkRS24;vclactnband;dxSpreadSheetRS24;vclFireDAC;dxDockingRS24;tethering;dxSkinVisualStudio2013BlueRS24;dxPScxTLLnkRS24;dxBarExtItemsRS24;FireDACADSDriver;dxFireDACServerModeRS24;dxPSTeeChartRS24;dxSkinOffice2007BlackRS24;FireDACMSSQLDriver;vcltouch;vcldb;Intraweb;dxSkinXmas2008BlueRS24;dxSkinscxSchedulerPainterRS24;Spring.Data;dxSkinsdxBarPainterRS24;dxSkinOffice2010BlackRS24;dxADOServerModeRS24;dxGDIPlusRS24;dxPSdxDBTVLnkRS24;vclib;dxSkinLilianRS24;FireDACDBXDriver;dxNavBarRS24;vclx;cxTreeListRS24;dxSkinDevExpressDarkStyleRS24;dxtrmdRS24;RESTBackendComponents;dxRibbonRS24;VCLRESTComponents;cxExportRS24;cxPivotGridChartRS24;cxTreeListdxBarPopupMenuRS24;dxSkinOffice2013LightGrayRS24;dxTabbedMDIRS24;vclie;dxSkinVisualStudio2013LightRS24;bindengine;CloudService;remotedb;FireDACMySQLDriver;cxPivotGridOLAPRS24;dxSkinSharpRS24;dxSkinBlackRS24;DataSnapClient;dxPSLnksRS24;bindcompdbx;dxSkinCoffeeRS24;IndyIPServer;dxSkinsdxRibbonPainterRS24;dxCoreRS24;IndySystem;dxSkinOffice2013DarkGrayRS24;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;emshosting;dxBarDBNavRS24;dxSkinDarkSideRS24;dxSkinOffice2013WhiteRS24;FireDACTDataDriver;dxPSdxLCLnkRS24;FMXTee;dxPScxExtCommonRS24;dxPScxPivotGridLnkRS24;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;fmxobj;dxSkinMcSkinRS24;rtl;dxLayoutControlRS24;DbxClientDriver;cxGridRS24;dxSkinBlueRS24;dxSpellCheckerRS24;cxLibraryRS24;dxSkinStardustRS24;dxSkinCaramelRS24;appanalytics;dxSkinsCoreRS24;dxDBXServerModeRS24;dxMapControlRS24;IndyIPClient;dxSkinHighContrastRS24;bindcompvcl;dxSkinTheAsphaltWorldRS24;TeeUI;cxPageControlRS24;cxEditorsRS24;dxPsPrVwAdvRS24;dxSkinSevenClassicRS24;VclSmp;cxSchedulerRibbonStyleEventEditorRS24;FireDACODBCDriver;dxSkinPumpkinRS24;aurelius;dxSkinscxPCPainterRS24;dxPSPrVwRibbonRS24;FireDACMongoDBDriver;dxSkinSevenRS24;dxdborRS24;dxmdsRS24;cxSchedulerGridRS24;RESTComponents;dxHttpIndyRequestRS24;cxPivotGridRS24;DBXInterBaseDriver;emsclientfiredac;DataSnapFireDAC;dxdbtrRS24;dxSkinMetropolisRS24;dxSkinMoneyTwinsRS24;dxPScxPCProdRS24;dxWizardControlRS24;bindcompfmx;dxPSdxOCLnkRS24;dxBarExtDBItemsRS24;dxPSdxFCLnkRS24;inetdb;cxSchedulerTreeBrowserRS24;dxSkinOffice2016ColorfulRS24;FmxTeeUI;emsedge;FireDACIBDriver;fmx;fmxdae;dxSkinSpringTimeRS24;dxSkinValentineRS24;dxSkinLondonLiquidSkyRS24;dxSkinWhiteprintRS24;dbexpress;IndyCore;dxSkiniMaginaryRS24;dxTileControlRS24;dxSkinOffice2016DarkRS24;dsnap;emsclient;DataSnapCommon;cxDataRS24;FireDACCommon;dxSkinOffice2007PinkRS24;dxPSdxSpreadSheetLnkRS24;dxSkinDevExpressStyleRS24;soapserver;dxBarRS24;dxSkinMetropolisDarkRS24;FireDACOracleDriver;DBXMySQLDriver;dxPSRichEditControlLnkRS24;dxPScxCommonRS24;FireDACCommonODBC;FireDACCommonDriver;inet;IndyIPCommon;dxSkinVS2010RS24;vcl;dxSkinSharpPlusRS24;dxPSdxDBOCLnkRS24;FireDACDb2Driver;dxThemeRS24;dxSkinOffice2007GreenRS24;TeeDB;FireDAC;dxPScxGridLnkRS24;dxPScxVGridLnkRS24;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;dxSkinOffice2010BlueRS24;dxServerModeRS24;ibxpress;Tee;ibxbindings;cxSchedulerRS24;vclwinx;FireDACDSDriver;dxSkinsdxDLPainterRS24;dxPSCoreRS24;dxSkinOffice2007BlueRS24;CustomIPTransport;vcldsnap;dxSkinGlassOceansRS24;dxRibbonCustomizationFormRS24;dxPScxSchedulerLnkRS24;dxSkinSummer2008RS24;dxSkinDarkRoomRS24;bindcomp;dxSkinFoggyRS24;dxorgcRS24;dxSkinOffice2010SilverRS24;dxRichEditControlRS24;dxSkinsdxNavBarPainterRS24;dbxcds;adortl;dxSkinSilverRS24;dxSkinVisualStudio2013DarkRS24;dxComnRS24;cxVerticalGridRS24;dxFlowChartRS24;dsnapxml;dbrtl;IndyProtocols;inetdbxpress;dxGaugeControlRS24;dxSkinOffice2007SilverRS24;dxSkinLiquidSkyRS24;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<DCC_UsePackage>DBXSqliteDriver;fmxase;DBXDb2Driver;DBXInterBaseDriver;OverbyteIcsD102Run;vclactnband;vclFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;DBXOracleDriver;inetdb;VirtualTreesDR;RaizeComponentsVcl;emsedge;RaizeComponentsVclDb;fmx;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;emshosting;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;SynEditDR;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
@ -88,13 +124,8 @@
|
||||
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<Manifest_File>(None)</Manifest_File>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_3_Win32)'!=''">
|
||||
<DCC_Define>CONSOLE_TESTRUNNER;$(DCC_Define)</DCC_Define>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<Debugger_DebugSourcePath>C:\DEV\dmvcframework\sources\;$(Debugger_DebugSourcePath)</Debugger_DebugSourcePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
@ -106,25 +137,20 @@
|
||||
<DelphiCompile Include="$(MainSource)">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="MVCFramework.Tests.Serializer.JSON.pas"/>
|
||||
<DCCReference Include="..\..\common\MVCFramework.Tests.Serializer.Entities.pas"/>
|
||||
<DCCReference Include="..\..\..\sources\MVCFramework.Serializer.JSON.pas"/>
|
||||
<DCCReference Include="..\..\..\sources\MVCFramework.Serializer.JSON.CustomTypes.pas"/>
|
||||
<DCCReference Include="..\..\common\MVCFramework.Tests.Serializer.Intf.pas"/>
|
||||
<DCCReference Include="..\..\common\MVCFramework.Tests.Serializer.EntitiesModule.pas">
|
||||
<Form>EntitiesModule</Form>
|
||||
<DesignClass>TDataModule</DesignClass>
|
||||
<DCCReference Include="MainControllerU.pas"/>
|
||||
<DCCReference Include="WebModuleU.pas">
|
||||
<Form>MyWebModule</Form>
|
||||
<FormType>dfm</FormType>
|
||||
<DesignClass>TWebModule</DesignClass>
|
||||
</DCCReference>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<DCCReference Include="BusinessObjectsU.pas"/>
|
||||
<DCCReference Include="CustomTypesSerializersU.pas"/>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="CONSOLE">
|
||||
<Key>Cfg_3</Key>
|
||||
<CfgParent>Cfg_1</CfgParent>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_1</Key>
|
||||
@ -133,17 +159,11 @@
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>Application</Borland.ProjectType>
|
||||
<Borland.ProjectType>Console</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k250.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp250.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
<Source>
|
||||
<Source Name="MainSource">TestSerializerJSON.dpr</Source>
|
||||
<Source Name="MainSource">renders_spring4d_nullables.dpr</Source>
|
||||
</Source>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
@ -167,18 +187,14 @@
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="Win32\Debug\TestSerializerJSON.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
<DeployFile LocalName="Win32\Debug\renders_spring4d_nullables.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
<Platform Name="Win32">
|
||||
<RemoteName>TestSerializerJSON.exe</RemoteName>
|
||||
<RemoteName>renders_spring4d_nullables.exe</RemoteName>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
@ -293,7 +309,6 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
@ -302,7 +317,6 @@
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyFramework">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
@ -311,20 +325,7 @@
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyModule">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
@ -347,7 +348,6 @@
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
@ -370,7 +370,6 @@
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
@ -469,35 +468,9 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSEntitlements">
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSInfoPList">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
|
||||
<DeployClass Name="ProjectiOSEntitlements"/>
|
||||
<DeployClass Name="ProjectiOSInfoPList"/>
|
||||
<DeployClass Name="ProjectiOSResource">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
@ -509,18 +482,8 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXEntitlements">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXInfoPList">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXEntitlements"/>
|
||||
<DeployClass Name="ProjectOSXInfoPList"/>
|
||||
<DeployClass Name="ProjectOSXResource">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
@ -545,7 +508,6 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
@ -585,21 +547,20 @@
|
||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="Android">False</Platform>
|
||||
<Platform value="iOSDevice32">False</Platform>
|
||||
<Platform value="iOSDevice64">False</Platform>
|
||||
<Platform value="iOSSimulator">False</Platform>
|
||||
<Platform value="Linux64">False</Platform>
|
||||
<Platform value="OSX32">False</Platform>
|
||||
<Platform value="Win32">True</Platform>
|
||||
<Platform value="Win64">False</Platform>
|
||||
</Platforms>
|
||||
<UnitTesting>
|
||||
<TestFramework>DUnit / Delphi Win32</TestFramework>
|
||||
<TestRunner>GUI</TestRunner>
|
||||
<TestProjectName/>
|
||||
<SourceProjectName/>
|
||||
</UnitTesting>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
@ -1,7 +1,7 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{7B54055A-5749-4136-9FE2-35FDBEEA874C}</ProjectGuid>
|
||||
<ProjectVersion>18.2</ProjectVersion>
|
||||
<ProjectVersion>18.4</ProjectVersion>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<MainSource>BasicDemo.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
|
@ -10,7 +10,7 @@ uses
|
||||
Web.WebReq,
|
||||
Web.WebBroker,
|
||||
IdHTTPWebBrokerBridge,
|
||||
WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule},
|
||||
WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule} ,
|
||||
AppControllerU in 'AppControllerU.pas',
|
||||
MemoryWebSessionController in 'MemoryWebSessionController.pas';
|
||||
|
||||
@ -19,9 +19,6 @@ uses
|
||||
|
||||
procedure RunServer(APort: Integer);
|
||||
var
|
||||
LInputRecord: TInputRecord;
|
||||
LEvent: DWord;
|
||||
LHandle: THandle;
|
||||
LServer: TIdHTTPWebBrokerBridge;
|
||||
begin
|
||||
Writeln(Format('Starting HTTP Server or port %d', [APort]));
|
||||
@ -29,17 +26,9 @@ begin
|
||||
try
|
||||
LServer.DefaultPort := APort;
|
||||
LServer.Active := True;
|
||||
Writeln('Press ESC to stop the server');
|
||||
LHandle := GetStdHandle(STD_INPUT_HANDLE);
|
||||
ShellExecute(0, 'open', PChar('http://localhost:' + IntToStr(APort)+'/login/john'), nil, nil, SW_SHOW);
|
||||
while True do
|
||||
begin
|
||||
Win32Check(ReadConsoleInput(LHandle, LInputRecord, 1, LEvent));
|
||||
if (LInputRecord.EventType = KEY_EVENT) and
|
||||
LInputRecord.Event.KeyEvent.bKeyDown and
|
||||
(LInputRecord.Event.KeyEvent.wVirtualKeyCode = VK_ESCAPE) then
|
||||
break;
|
||||
end;
|
||||
ShellExecute(0, 'open', PChar('http://localhost:' + IntToStr(APort) + '/login/john'), nil, nil, SW_SHOW);
|
||||
Writeln('Press RETURN to Exit');
|
||||
ReadLn;
|
||||
finally
|
||||
LServer.Free;
|
||||
end;
|
||||
@ -55,6 +44,6 @@ begin
|
||||
except
|
||||
on E: Exception do
|
||||
Writeln(E.ClassName, ': ', E.Message);
|
||||
end
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{180D0369-D404-417C-8F18-6DE283368DE3}</ProjectGuid>
|
||||
<ProjectVersion>18.2</ProjectVersion>
|
||||
<ProjectVersion>18.4</ProjectVersion>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<MainSource>CustomSessionSample.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
@ -161,20 +161,13 @@
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployClass Name="DependencyModule">
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.dll;.bpl</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXResource">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidClassesDexFile">
|
||||
@ -183,18 +176,15 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon144">
|
||||
<DeployClass Name="AndroidGDBServer">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<DeployClass Name="AndroidLibnativeArmeabiFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
@ -204,49 +194,294 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch768">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<DeployClass Name="AndroidLibnativeX86File"/>
|
||||
<DeployClass Name="AndroidServiceOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="ProjectOutput">
|
||||
<Platform Name="iOSDevice64">
|
||||
<DeployClass Name="AndroidSplashImageDef">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStyles">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_DefaultAppIcon">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon144">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage426">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage470">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage640">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage960">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyFramework">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyModule">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.dll;.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="DependencyPackage">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="File">
|
||||
<Platform Name="Android">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1024">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1536">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2048">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch768">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch320">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640x1136">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectAndroidManifest">
|
||||
<Platform Name="Android">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
|
||||
<DeployClass Name="ProjectiOSEntitlements"/>
|
||||
<DeployClass Name="ProjectiOSInfoPList"/>
|
||||
<DeployClass Name="ProjectiOSResource">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXEntitlements"/>
|
||||
<DeployClass Name="ProjectOSXInfoPList"/>
|
||||
<DeployClass Name="ProjectOSXResource">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="ProjectOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Linux64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyFramework">
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectUWPManifest">
|
||||
<Platform Name="Win32">
|
||||
@ -256,105 +491,13 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeX86File"/>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1024">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch320">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSInfoPList"/>
|
||||
<DeployClass Name="AndroidLibnativeArmeabiFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DebugSymbols">
|
||||
<DeployClass Name="UWP_DelphiLogo150">
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1536">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage470">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage640">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640x1136">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
@ -368,149 +511,6 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSEntitlements"/>
|
||||
<DeployClass Name="AndroidGDBServer">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXInfoPList"/>
|
||||
<DeployClass Name="ProjectOSXEntitlements"/>
|
||||
<DeployClass Name="UWP_DelphiLogo150">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2048">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStyles">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage426">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashImageDef">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSResource">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectAndroidManifest">
|
||||
<Platform Name="Android">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_DefaultAppIcon">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="File">
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidServiceOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="DependencyPackage">
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.bpl</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage960">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
|
||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||
|
@ -64,7 +64,9 @@ implementation
|
||||
|
||||
{ TMVCAbstractSerializer }
|
||||
|
||||
uses MVCFramework.Cache;
|
||||
uses
|
||||
MVCFramework.Cache,
|
||||
MVCFramework.Logger;
|
||||
|
||||
constructor TMVCAbstractSerializer.Create;
|
||||
begin
|
||||
@ -92,7 +94,8 @@ begin
|
||||
Exit(MVCNameCaseAttribute(Att).KeyCase);
|
||||
end;
|
||||
|
||||
function TMVCAbstractSerializer.GetDataType(const AOwner: TComponent; const AComponentName: string; const ADefaultValue: TMVCDataType): TMVCDataType;
|
||||
function TMVCAbstractSerializer.GetDataType(const AOwner: TComponent; const AComponentName: string; const ADefaultValue: TMVCDataType)
|
||||
: TMVCDataType;
|
||||
var
|
||||
ObjType: TRttiType;
|
||||
ObjFld: TRttiField;
|
||||
@ -228,6 +231,7 @@ end;
|
||||
|
||||
procedure TMVCAbstractSerializer.RegisterTypeSerializer(const ATypeInfo: PTypeInfo; AInstance: IMVCTypeSerializer);
|
||||
begin
|
||||
LogD('Registering TypeSerializer for: ' + string(ATypeInfo.Name));
|
||||
FTypeSerializers.AddOrSetValue(ATypeInfo, AInstance);
|
||||
end;
|
||||
|
||||
|
@ -36,24 +36,32 @@ uses
|
||||
Data.DB,
|
||||
MVCFramework.Serializer.Commons;
|
||||
|
||||
const
|
||||
DMVC_CLASSNAME = '$dmvc_classname';
|
||||
|
||||
type
|
||||
|
||||
IMVCTypeSerializer = interface
|
||||
['{806EC547-D1CB-4DA9-92D3-A8A7C0BD4009}']
|
||||
procedure Serialize(
|
||||
procedure SerializeAttribute(
|
||||
const AElementValue: TValue;
|
||||
{TODO -oDanieleT -cGeneral : Valutare TValue}
|
||||
var ASerializerObject: TObject;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure Deserialize(
|
||||
{TODO -oDanieleT -cGeneral : Valutare TValue}
|
||||
const ASerializedObject: TObject;
|
||||
procedure SerializeRoot(
|
||||
const AObject: TObject;
|
||||
out ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeRoot(
|
||||
const ASerializerObject: TObject;
|
||||
const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
end;
|
||||
|
@ -1,132 +0,0 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Delphi MVC Framework
|
||||
//
|
||||
// Copyright (c) 2010-2018 Daniele Teti and the DMVCFramework Team
|
||||
//
|
||||
// https://github.com/danieleteti/delphimvcframework
|
||||
//
|
||||
// Collaborators with this file: Ezequiel Juliano Müller (ezequieljuliano@gmail.com)
|
||||
//
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
unit MVCFramework.Serializer.JSON.CustomTypes;
|
||||
|
||||
{$I dmvcframework.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.Rtti,
|
||||
System.Classes,
|
||||
System.SysUtils,
|
||||
System.JSON,
|
||||
MVCFramework.Serializer.Intf,
|
||||
MVCFramework.Serializer.Commons;
|
||||
|
||||
type
|
||||
|
||||
TStreamSerializerJSON = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
private
|
||||
{ private declarations }
|
||||
protected
|
||||
procedure Serialize(const AElementValue: TValue; var ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
procedure Deserialize(const ASerializedObject: TObject; var AElementValue: TValue; const AAttributes: TArray<TCustomAttribute>);
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TStreamSerializerJSON }
|
||||
|
||||
procedure TStreamSerializerJSON.Deserialize(
|
||||
const ASerializedObject: TObject; var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
JSONValue: TJSONValue;
|
||||
Stream: TStream;
|
||||
SS: TStringStream;
|
||||
begin
|
||||
JSONValue := ASerializedObject as TJSONValue;
|
||||
if Assigned(JSONValue) then
|
||||
begin
|
||||
Stream := AElementValue.AsObject as TStream;
|
||||
if Assigned(Stream) then
|
||||
begin
|
||||
if TMVCSerializerHelpful.AttributeExists<MVCSerializeAsStringAttribute>(AAttributes) then
|
||||
begin
|
||||
SS := TStringStream.Create(JSONValue.Value);
|
||||
try
|
||||
SS.Position := 0;
|
||||
Stream.CopyFrom(SS, SS.Size);
|
||||
finally
|
||||
SS.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
SS := TStringStream.Create(JSONValue.Value);
|
||||
try
|
||||
SS.Position := 0;
|
||||
TMVCSerializerHelpful.DecodeStream(SS, Stream);
|
||||
finally
|
||||
SS.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TStreamSerializerJSON.Serialize(const AElementValue: TValue;
|
||||
var ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
Stream: TStream;
|
||||
SS: TStringStream;
|
||||
DataString: string;
|
||||
begin
|
||||
Stream := AElementValue.AsObject as TStream;
|
||||
if Assigned(Stream) then
|
||||
begin
|
||||
if TMVCSerializerHelpful.AttributeExists<MVCSerializeAsStringAttribute>(AAttributes) then
|
||||
begin
|
||||
Stream.Position := 0;
|
||||
SS := TStringStream.Create;
|
||||
try
|
||||
SS.CopyFrom(Stream, Stream.Size);
|
||||
DataString := SS.DataString;
|
||||
ASerializerObject := TJSONString.Create(SS.DataString);
|
||||
finally
|
||||
SS.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
SS := TStringStream.Create;
|
||||
try
|
||||
Stream.Position := 0;
|
||||
TMVCSerializerHelpful.EncodeStream(Stream, SS);
|
||||
ASerializerObject := TJSONString.Create(SS.DataString);
|
||||
finally
|
||||
SS.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
File diff suppressed because it is too large
Load Diff
@ -43,8 +43,31 @@ type
|
||||
private
|
||||
{ private declarations }
|
||||
protected
|
||||
procedure Serialize(const AElementValue: TValue; var ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
// procedure Serialize(const AElementValue: TValue; var ASerializerObject: TObject;
|
||||
// const AAttributes: TArray<TCustomAttribute>);
|
||||
procedure SerializeAttribute(
|
||||
const AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure SerializeRoot(
|
||||
const AObject: TObject;
|
||||
out ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeRoot(
|
||||
const ASerializerObject: TObject; const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
|
||||
procedure Deserialize(const ASerializedObject: TObject; var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
public
|
||||
@ -53,8 +76,30 @@ type
|
||||
|
||||
TMVCStringDictionarySerializer = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
public
|
||||
procedure Serialize(const AElementValue: TValue; var ASerializerObject: TObject;
|
||||
const AAttributes: System.TArray<System.TCustomAttribute>);
|
||||
procedure SerializeAttribute(
|
||||
const AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure SerializeRoot(
|
||||
const AObject: TObject;
|
||||
out ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
procedure DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure DeserializeRoot(
|
||||
const ASerializerObject: TObject;
|
||||
const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
|
||||
procedure Deserialize(const ASerializedObject: TObject; var AElementValue: TValue;
|
||||
const AAttributes: System.TArray<System.TCustomAttribute>);
|
||||
end;
|
||||
@ -107,24 +152,77 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TStreamSerializerJsonDataObject.Serialize(const AElementValue: TValue; var ASerializerObject: TObject;
|
||||
// procedure TStreamSerializerJsonDataObject.Serialize(const AElementValue: TValue; var ASerializerObject: TObject;
|
||||
// const AAttributes: TArray<TCustomAttribute>);
|
||||
// var
|
||||
// Stream: TStream;
|
||||
// SS: TStringStream;
|
||||
// DataString: string;
|
||||
// begin
|
||||
// Stream := AElementValue.AsObject as TStream;
|
||||
// if Assigned(Stream) then
|
||||
// begin
|
||||
// if TMVCSerializerHelpful.AttributeExists<MVCSerializeAsStringAttribute>(AAttributes) then
|
||||
// begin
|
||||
// Stream.Position := 0;
|
||||
// SS := TStringStream.Create;
|
||||
// try
|
||||
// SS.CopyFrom(Stream, Stream.Size);
|
||||
// DataString := SS.DataString;
|
||||
// ASerializerObject := TJsonValue.Create(SS.DataString);
|
||||
// finally
|
||||
// SS.Free;
|
||||
// end;
|
||||
// end
|
||||
// else
|
||||
// begin
|
||||
// SS := TStringStream.Create;
|
||||
// try
|
||||
// Stream.Position := 0;
|
||||
// TMVCSerializerHelpful.EncodeStream(Stream, SS);
|
||||
// ASerializerObject := TJsonValue.Create(SS.DataString);
|
||||
// finally
|
||||
// SS.Free;
|
||||
// end;
|
||||
// end;
|
||||
// end;
|
||||
// end;
|
||||
|
||||
procedure TStreamSerializerJsonDataObject.DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TStreamSerializerJsonDataObject.DeserializeRoot(
|
||||
const ASerializerObject: TObject; const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
raise Exception.Create('Not implemented');
|
||||
end;
|
||||
|
||||
procedure TStreamSerializerJsonDataObject.SerializeAttribute(
|
||||
const AElementValue: TValue; const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
Stream: TStream;
|
||||
SS: TStringStream;
|
||||
DataString: string;
|
||||
begin
|
||||
Stream := AElementValue.AsObject as TStream;
|
||||
if Assigned(Stream) then
|
||||
begin
|
||||
if TMVCSerializerHelpful.AttributeExists<MVCSerializeAsStringAttribute>(AAttributes) then
|
||||
begin
|
||||
Stream.Position := 0;
|
||||
SS := TStringStream.Create;
|
||||
try
|
||||
Stream.Position := 0;
|
||||
SS.CopyFrom(Stream, Stream.Size);
|
||||
DataString := SS.DataString;
|
||||
ASerializerObject := TJsonValue.Create(SS.DataString);
|
||||
TJsonObject(ASerializerObject).S[APropertyName] := SS.DataString;
|
||||
finally
|
||||
SS.Free;
|
||||
end;
|
||||
@ -135,11 +233,29 @@ begin
|
||||
try
|
||||
Stream.Position := 0;
|
||||
TMVCSerializerHelpful.EncodeStream(Stream, SS);
|
||||
ASerializerObject := TJsonValue.Create(SS.DataString);
|
||||
TJsonObject(ASerializerObject).S[APropertyName] := SS.DataString;
|
||||
finally
|
||||
SS.Free;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
TJsonObject(ASerializerObject).Values[APropertyName] := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TStreamSerializerJsonDataObject.SerializeRoot(const AObject: TObject;
|
||||
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
lSerializerObject: TJsonObject;
|
||||
begin
|
||||
lSerializerObject := TJsonObject.Create;
|
||||
try
|
||||
SerializeAttribute(AObject, 'data', ASerializerObject, AAttributes);
|
||||
except
|
||||
lSerializerObject.Free;
|
||||
raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -151,23 +267,65 @@ begin
|
||||
raise EMVCDeserializationException.Create('Not Implemented');
|
||||
end;
|
||||
|
||||
procedure TMVCStringDictionarySerializer.Serialize(const AElementValue: TValue; var ASerializerObject: TObject;
|
||||
const AAttributes: System.TArray<System.TCustomAttribute>);
|
||||
procedure TMVCStringDictionarySerializer.DeserializeAttribute(
|
||||
var AElementValue: TValue;
|
||||
const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TMVCStringDictionarySerializer.DeserializeRoot(
|
||||
const ASerializerObject: TObject;
|
||||
const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>
|
||||
);
|
||||
begin
|
||||
raise Exception.Create('Not implemented');
|
||||
end;
|
||||
|
||||
procedure TMVCStringDictionarySerializer.SerializeAttribute(
|
||||
const AElementValue: TValue; const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
lStringDict: TMVCStringDictionary;
|
||||
lPair: TPair<string, string>;
|
||||
lJSONObject: TJsonObject;
|
||||
lOutObject: TJsonObject;
|
||||
lJsonDict: TJsonObject;
|
||||
begin
|
||||
lStringDict := AElementValue.AsObject as TMVCStringDictionary;
|
||||
lOutObject := ASerializerObject as TJsonObject;
|
||||
lOutObject.O[APropertyName] := TJsonObject.Create;
|
||||
lJsonDict := lOutObject.O[APropertyName];
|
||||
if Assigned(lStringDict) then
|
||||
begin
|
||||
lJSONObject := TJsonObject.Create;
|
||||
for lPair in lStringDict do
|
||||
begin
|
||||
lJSONObject.S[lPair.Key] := lPair.Value;
|
||||
lJsonDict.S[lPair.Key] := lPair.Value;
|
||||
end;
|
||||
ASerializerObject := lJSONObject;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMVCStringDictionarySerializer.SerializeRoot(const AObject: TObject;
|
||||
out ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
var
|
||||
lStringDict: TMVCStringDictionary;
|
||||
lPair: TPair<string, string>;
|
||||
lOutObject: TJsonObject;
|
||||
begin
|
||||
lStringDict := AObject as TMVCStringDictionary;
|
||||
lOutObject := TJsonObject.Create;
|
||||
if Assigned(lStringDict) then
|
||||
begin
|
||||
for lPair in lStringDict do
|
||||
begin
|
||||
lOutObject.S[lPair.Key] := lPair.Value;
|
||||
end;
|
||||
end;
|
||||
ASerializerObject := lOutObject;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -47,7 +47,6 @@ uses
|
||||
JsonDataObjects {JsonDataObjects must be after MVCFramework.TypesAliases};
|
||||
|
||||
type
|
||||
|
||||
TJsonValue = class
|
||||
private
|
||||
FValue: string;
|
||||
@ -126,6 +125,7 @@ implementation
|
||||
uses
|
||||
MVCFramework.Serializer.JsonDataObjects.CustomTypes,
|
||||
MVCFramework.Commons,
|
||||
MVCFramework.Logger,
|
||||
System.SysUtils;
|
||||
|
||||
{ TMVCJsonDataObjectsSerializer }
|
||||
@ -152,7 +152,7 @@ var
|
||||
ChildValue: TValue;
|
||||
ChildObject, Obj: TObject;
|
||||
ChildList: IMVCList;
|
||||
ChildJsonValue: TObject;
|
||||
// ChildJsonValue: TObject;
|
||||
ValueTypeAtt: MVCValueAsTypeAttribute;
|
||||
CastValue, CastedValue: TValue;
|
||||
begin
|
||||
@ -164,25 +164,26 @@ begin
|
||||
|
||||
if GetTypeSerializers.ContainsKey(AValue.TypeInfo) then
|
||||
begin
|
||||
ChildJsonValue := nil;
|
||||
GetTypeSerializers.Items[AValue.TypeInfo].Serialize(AValue, ChildJsonValue, ACustomAttributes);
|
||||
if Assigned(ChildJsonValue) then
|
||||
begin
|
||||
if ChildJsonValue is TJsonObject then
|
||||
AJsonObject.O[AName] := TJsonObject(ChildJsonValue)
|
||||
else if ChildJsonValue is TJsonArray then
|
||||
AJsonObject.A[AName] := TJsonArray(ChildJsonValue)
|
||||
else if ChildJsonValue is TJsonBaseObject then
|
||||
AJsonObject[AName] := ChildJsonValue
|
||||
else if ChildJsonValue is TJsonValue then
|
||||
begin
|
||||
AJsonObject[AName] := TJsonValue(ChildJsonValue).Value;
|
||||
ChildJsonValue.Free;
|
||||
end
|
||||
else
|
||||
raise EMVCSerializationException.CreateFmt
|
||||
('Cannot serialize %s the serializer does not have a valid TJsonBaseObject type.', [AName]);
|
||||
end;
|
||||
// ChildJsonValue := nil;
|
||||
// GetTypeSerializers.Items[AValue.TypeInfo].Serialize(AValue, ChildJsonValue, ACustomAttributes);
|
||||
GetTypeSerializers.Items[AValue.TypeInfo].SerializeAttribute(AValue, AName, AJsonObject, ACustomAttributes);
|
||||
// if Assigned(ChildJsonValue) then
|
||||
// begin
|
||||
// if ChildJsonValue is TJsonObject then
|
||||
// AJsonObject.O[AName] := TJsonObject(ChildJsonValue)
|
||||
// else if ChildJsonValue is TJsonArray then
|
||||
// AJsonObject.A[AName] := TJsonArray(ChildJsonValue)
|
||||
// else if ChildJsonValue is TJsonBaseObject then
|
||||
// AJsonObject[AName] := ChildJsonValue
|
||||
// else if ChildJsonValue is TJsonValue then
|
||||
// begin
|
||||
// AJsonObject[AName] := TJsonValue(ChildJsonValue).Value;
|
||||
// ChildJsonValue.Free;
|
||||
// end
|
||||
// else
|
||||
// raise EMVCSerializationException.CreateFmt
|
||||
// ('Cannot serialize %s the serializer does not have a valid TJsonBaseObject type.', [AName]);
|
||||
// end;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
@ -353,14 +354,14 @@ begin
|
||||
for I := 0 to ADataSet.FieldCount - 1 do
|
||||
begin
|
||||
FieldName := GetNameAs(ADataSet.Owner, ADataSet.Fields[I].Name, ADataSet.Fields[I].FieldName);
|
||||
case ANameCase of
|
||||
ncUpperCase:
|
||||
FieldName := UpperCase(ADataSet.Fields[I].FieldName);
|
||||
ncLowerCase:
|
||||
FieldName := LowerCase(ADataSet.Fields[I].FieldName);
|
||||
end;
|
||||
if (not IsIgnoredAttribute(AIgnoredFields, FieldName)) and (not IsIgnoredComponent(ADataSet.Owner, ADataSet.Fields[I].Name)) then
|
||||
begin
|
||||
case ANameCase of
|
||||
ncUpperCase:
|
||||
FieldName := UpperCase(ADataSet.Fields[I].FieldName);
|
||||
ncLowerCase:
|
||||
FieldName := LowerCase(ADataSet.Fields[I].FieldName);
|
||||
end;
|
||||
if ADataSet.Fields[I].IsNull then
|
||||
AJsonObject[FieldName] := Null
|
||||
else
|
||||
@ -561,7 +562,6 @@ var
|
||||
ChildObject: TObject;
|
||||
ChildList: IMVCList;
|
||||
ChildListOfAtt: MVCListOfAttribute;
|
||||
ChildJsonValue: TJsonValue;
|
||||
begin
|
||||
if GetTypeSerializers.ContainsKey(AValue.TypeInfo) then
|
||||
begin
|
||||
@ -569,21 +569,11 @@ begin
|
||||
jdtNone:
|
||||
Exit;
|
||||
jdtObject:
|
||||
GetTypeSerializers.Items[AValue.TypeInfo].Deserialize(AJsonObject[AName].ObjectValue, AValue, ACustomAttributes);
|
||||
GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject[AName].ObjectValue, ACustomAttributes);
|
||||
jdtArray:
|
||||
GetTypeSerializers.Items[AValue.TypeInfo].Deserialize(AJsonObject[AName].ArrayValue, AValue, ACustomAttributes);
|
||||
GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject[AName].ArrayValue, ACustomAttributes);
|
||||
else
|
||||
begin
|
||||
{ TODO -oDanieleT -cGeneral : Improve serialization of simple values }
|
||||
// GetTypeSerializers.Items[AValue.TypeInfo].Deserialize(TObject(Pointer(AJsonObject.Items[AJsonObject.IndexOf(AName)])), AValue, ACustomAttributes);
|
||||
ChildJsonValue := TJsonValue.Create;
|
||||
try
|
||||
ChildJsonValue.Value := AJsonObject[AName].Value;
|
||||
GetTypeSerializers.Items[AValue.TypeInfo].Deserialize(ChildJsonValue, AValue, ACustomAttributes);
|
||||
finally
|
||||
ChildJsonValue.Free;
|
||||
end;
|
||||
end;
|
||||
GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject, ACustomAttributes);
|
||||
end;
|
||||
Exit;
|
||||
end;
|
||||
@ -612,9 +602,6 @@ begin
|
||||
|
||||
jdtInt:
|
||||
begin
|
||||
// if (AValue.Kind = tkEnumeration) then
|
||||
// TValue.Make(AJsonObject[AName].IntValue, AValue.TypeInfo, AValue)
|
||||
// else
|
||||
AValue := TValue.From<Integer>(AJsonObject[AName].IntValue);
|
||||
end;
|
||||
|
||||
@ -909,13 +896,13 @@ end;
|
||||
class function TMVCJsonDataObjectsSerializer.ParseArray(
|
||||
const AString: string): TJsonArray;
|
||||
begin
|
||||
Result := Parse<TJSONArray>(AString);
|
||||
Result := Parse<TJsonArray>(AString);
|
||||
end;
|
||||
|
||||
class function TMVCJsonDataObjectsSerializer.ParseObject(
|
||||
const AString: string): TJsonObject;
|
||||
begin
|
||||
Result := Parse<TJSONObject>(AString);
|
||||
Result := Parse<TJsonObject>(AString);
|
||||
end;
|
||||
|
||||
function TMVCJsonDataObjectsSerializer.SerializeCollection(const AList: TObject; const AType: TMVCSerializationType;
|
||||
@ -953,6 +940,7 @@ function TMVCJsonDataObjectsSerializer.SerializeDataSet(const ADataSet: TDataSet
|
||||
var
|
||||
JsonArray: TJsonArray;
|
||||
BookMark: TBookmark;
|
||||
lNameCase: TMVCNameCase;
|
||||
begin
|
||||
Result := EmptyStr;
|
||||
|
||||
@ -962,10 +950,11 @@ begin
|
||||
JsonArray := TJsonArray.Create;
|
||||
try
|
||||
BookMark := ADataSet.BookMark;
|
||||
lNameCase := GetNameCase(ADataSet, ANameCase);
|
||||
ADataSet.First;
|
||||
while not ADataSet.Eof do
|
||||
begin
|
||||
DataSetToJsonObject(ADataSet, JsonArray.AddObject, GetNameCase(ADataSet, ANameCase), AIgnoredFields);
|
||||
DataSetToJsonObject(ADataSet, JsonArray.AddObject, lNameCase, AIgnoredFields);
|
||||
ADataSet.Next;
|
||||
end;
|
||||
Result := JsonArray.ToJSON(True);
|
||||
@ -996,32 +985,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// procedure TMVCJsonDataObjectsSerializer.SerializeDynamicArray(
|
||||
// const AValue: TValue;
|
||||
// const AArray: TJsonArray;
|
||||
// const AType: TMVCSerializationType;
|
||||
// const AIgnoredAttributes: TMVCIgnoredList
|
||||
// );
|
||||
// var
|
||||
// I: Integer;
|
||||
// Obj: TObject;
|
||||
// begin
|
||||
// if AValue.GetArrayLength > 0 then
|
||||
// if not AValue.GetArrayElement(I).IsObject then
|
||||
// raise EMVCSerializationException.Create('Cannot serialize non-object in dynamic (or static) arrays');
|
||||
// for I := 0 to AValue.GetArrayLength - 1 do
|
||||
// begin
|
||||
// Obj := AValue.GetArrayElement(I).AsObject;
|
||||
// if Assigned(Obj) then
|
||||
// ObjectToJsonObject(Obj, AArray.AddObject, GetSerializationType(Obj, AType), AIgnoredAttributes);
|
||||
// end;
|
||||
// end;
|
||||
|
||||
function TMVCJsonDataObjectsSerializer.SerializeObject(const AObject: TObject; const AType: TMVCSerializationType;
|
||||
const AIgnoredAttributes: TMVCIgnoredList; const ASerializationAction: TMVCSerializationAction): string;
|
||||
var
|
||||
JsonObject: TJsonObject;
|
||||
ChildJsonValue: TJsonBaseObject;
|
||||
ObjType: TRttiType;
|
||||
begin
|
||||
Result := EmptyStr;
|
||||
@ -1041,19 +1008,11 @@ begin
|
||||
ObjType := GetRttiContext.GetType(AObject.ClassType);
|
||||
if GetTypeSerializers.ContainsKey(ObjType.Handle) then
|
||||
begin
|
||||
ChildJsonValue := nil;
|
||||
GetTypeSerializers.Items[ObjType.Handle].Serialize(AObject, TObject(ChildJsonValue), []);
|
||||
if Assigned(ChildJsonValue) then
|
||||
begin
|
||||
try
|
||||
if ChildJsonValue is TJsonBaseObject then
|
||||
Result := ChildJsonValue.ToJSON(True)
|
||||
else
|
||||
raise EMVCSerializationException.Create
|
||||
('Cannot serialize, the serializer does not have a valid TJsonBaseObject type.');
|
||||
finally
|
||||
ChildJsonValue.Free;
|
||||
end;
|
||||
GetTypeSerializers.Items[ObjType.Handle].SerializeRoot(AObject, TObject(JsonObject), []);
|
||||
try
|
||||
Result := JsonObject.ToJSON(True);
|
||||
finally
|
||||
JsonObject.Free;
|
||||
end;
|
||||
Exit;
|
||||
end;
|
||||
@ -1072,7 +1031,6 @@ procedure TMVCJsonDataObjectsSerializer.DeserializeObject(const ASerializedObjec
|
||||
var
|
||||
JsonObject: TJsonObject;
|
||||
ObjType: TRttiType;
|
||||
ObjValue: TValue;
|
||||
begin
|
||||
if (ASerializedObject = EmptyStr) then
|
||||
raise Exception.Create('Invalid body');
|
||||
@ -1085,8 +1043,8 @@ begin
|
||||
ObjType := GetRttiContext.GetType(AObject.ClassType);
|
||||
if GetTypeSerializers.ContainsKey(ObjType.Handle) then
|
||||
begin
|
||||
ObjValue := TValue.From<TObject>(AObject);
|
||||
GetTypeSerializers.Items[ObjType.Handle].Deserialize(JsonObject, ObjValue, []);
|
||||
// ObjValue := TValue.From<TObject>(AObject);
|
||||
GetTypeSerializers.Items[ObjType.Handle].DeserializeRoot(JsonObject, AObject, []);
|
||||
Exit;
|
||||
end;
|
||||
JsonObjectToObject(JsonObject, AObject, GetSerializationType(AObject, AType), AIgnoredAttributes);
|
||||
|
@ -51,10 +51,9 @@ type
|
||||
public
|
||||
constructor Create(const ASessionId: string; const ATimeout: UInt64); virtual;
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure MarkAsUsed;
|
||||
procedure MarkAsUsed; virtual;
|
||||
function ToString: string; override;
|
||||
function IsExpired: Boolean;
|
||||
function IsExpired: Boolean; virtual;
|
||||
|
||||
property Items[const AKey: string]: string read GetItems write SetItems; default;
|
||||
property SessionId: string read FSessionId;
|
||||
@ -74,25 +73,24 @@ type
|
||||
constructor Create(const ASessionId: string; const ATimeout: UInt64); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
function ToString: String; override;
|
||||
function ToString: string; override;
|
||||
|
||||
property Data: TDictionary<string, string> read FData;
|
||||
end;
|
||||
|
||||
TMVCSessionFactory = class sealed
|
||||
private
|
||||
FRegisteredSessionTypes: TDictionary<String, TWebSessionClass>;
|
||||
private
|
||||
class var Instance: TMVCSessionFactory;
|
||||
public
|
||||
FRegisteredSessionTypes: TDictionary<string, TWebSessionClass>;
|
||||
protected
|
||||
class var cInstance: TMVCSessionFactory;
|
||||
constructor Create;
|
||||
public
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure RegisterSessionType(const AName: String; AWebSessionClass: TWebSessionClass);
|
||||
procedure RegisterSessionType(const AName: string; AWebSessionClass: TWebSessionClass);
|
||||
function CreateNewByType(const AName, ASessionId: string; const ATimeout: UInt64): TWebSession;
|
||||
|
||||
class function GetInstance: TMVCSessionFactory; static;
|
||||
class procedure DestroyInstance; static;
|
||||
// class procedure DestroyInstance; static;
|
||||
end;
|
||||
|
||||
function GlobalSessionList: TObjectDictionary<string, TWebSession>;
|
||||
@ -202,7 +200,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TWebSessionMemory.ToString: String;
|
||||
function TWebSessionMemory.ToString: string;
|
||||
var
|
||||
LKey: string;
|
||||
begin
|
||||
@ -234,20 +232,20 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
class procedure TMVCSessionFactory.DestroyInstance;
|
||||
begin
|
||||
if Assigned(Instance) then
|
||||
Instance.Free;
|
||||
end;
|
||||
// class procedure TMVCSessionFactory.DestroyInstance;
|
||||
// begin
|
||||
// if Assigned(cInstance) then
|
||||
// cInstance.Free;
|
||||
// end;
|
||||
|
||||
class function TMVCSessionFactory.GetInstance: TMVCSessionFactory;
|
||||
begin
|
||||
if not Assigned(Instance) then
|
||||
Instance := TMVCSessionFactory.Create;
|
||||
Result := Instance;
|
||||
if not Assigned(cInstance) then
|
||||
cInstance := TMVCSessionFactory.Create;
|
||||
Result := cInstance;
|
||||
end;
|
||||
|
||||
procedure TMVCSessionFactory.RegisterSessionType(const AName: String; AWebSessionClass: TWebSessionClass);
|
||||
procedure TMVCSessionFactory.RegisterSessionType(const AName: string; AWebSessionClass: TWebSessionClass);
|
||||
begin
|
||||
FRegisteredSessionTypes.AddOrSetValue(AName, AWebSessionClass);
|
||||
end;
|
||||
@ -259,7 +257,7 @@ GlCriticalSection := TCriticalSection.Create;
|
||||
|
||||
finalization
|
||||
|
||||
TMVCSessionFactory.DestroyInstance;
|
||||
FreeAndNil(TMVCSessionFactory.cInstance);
|
||||
FreeAndNil(GlCriticalSection);
|
||||
|
||||
if Assigned(GlSessionList) then
|
||||
|
@ -54,7 +54,7 @@ uses
|
||||
MVCFramework.ApplicationSession,
|
||||
MVCFramework.Serializer.Intf,
|
||||
MVCFramework.Serializer.Commons,
|
||||
MVCFramework.Serializer.JSON,
|
||||
//MVCFramework.Serializer.JSON,
|
||||
|
||||
{$IFDEF WEBAPACHEHTTP}
|
||||
Web.ApacheHTTP, // Apache Support since XE6 http://docwiki.embarcadero.com/Libraries/XE6/de/Web.ApacheHTTP
|
||||
|
@ -3,9 +3,6 @@
|
||||
<ProjectGuid>{5EBAAE63-B9A8-4F8B-A32A-D85A689B5CA7}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Projects Include="systemjson\TestSerializerJSON.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="jsondataobjects\TestSerializerJsonDataObjects.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
@ -17,15 +14,6 @@
|
||||
<Default.Personality/>
|
||||
</BorlandProject>
|
||||
</ProjectExtensions>
|
||||
<Target Name="TestSerializerJSON">
|
||||
<MSBuild Projects="systemjson\TestSerializerJSON.dproj"/>
|
||||
</Target>
|
||||
<Target Name="TestSerializerJSON:Clean">
|
||||
<MSBuild Projects="systemjson\TestSerializerJSON.dproj" Targets="Clean"/>
|
||||
</Target>
|
||||
<Target Name="TestSerializerJSON:Make">
|
||||
<MSBuild Projects="systemjson\TestSerializerJSON.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="TestSerializerJsonDataObjects">
|
||||
<MSBuild Projects="jsondataobjects\TestSerializerJsonDataObjects.dproj"/>
|
||||
</Target>
|
||||
@ -36,13 +24,13 @@
|
||||
<MSBuild Projects="jsondataobjects\TestSerializerJsonDataObjects.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="Build">
|
||||
<CallTarget Targets="TestSerializerJSON;TestSerializerJsonDataObjects"/>
|
||||
<CallTarget Targets="TestSerializerJsonDataObjects"/>
|
||||
</Target>
|
||||
<Target Name="Clean">
|
||||
<CallTarget Targets="TestSerializerJSON:Clean;TestSerializerJsonDataObjects:Clean"/>
|
||||
<CallTarget Targets="TestSerializerJsonDataObjects:Clean"/>
|
||||
</Target>
|
||||
<Target Name="Make">
|
||||
<CallTarget Targets="TestSerializerJSON:Make;TestSerializerJsonDataObjects:Make"/>
|
||||
<CallTarget Targets="TestSerializerJsonDataObjects:Make"/>
|
||||
</Target>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
|
||||
</Project>
|
||||
|
@ -103,17 +103,12 @@ type
|
||||
procedure Serialize(const AElementValue: TValue; var ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
procedure Deserialize(const ASerializedObject: TObject; var AElementValue: TValue; const AAttributes: TArray<TCustomAttribute>);
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
TMVCNullableSerializerJsonDataObjects = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
private
|
||||
{ private declarations }
|
||||
protected
|
||||
procedure Serialize(const AElementValue: TValue; var ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
procedure Deserialize(const ASerializedObject: TObject; var AElementValue: TValue; const AAttributes: TArray<TCustomAttribute>);
|
||||
public
|
||||
{ public declarations }
|
||||
procedure SerializeRoot(const AObject: TObject;
|
||||
out ASerializerObject: TObject;
|
||||
const AAttributes: System.TArray<System.TCustomAttribute>);
|
||||
procedure SerializeAttribute(const AElementValue: TValue;
|
||||
const APropertyName: string; const ASerializerObject: TObject;
|
||||
const AAttributes: System.TArray<System.TCustomAttribute>);
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -129,7 +124,6 @@ begin
|
||||
inherited;
|
||||
FSerializer := TMVCJsonDataObjectsSerializer.Create;
|
||||
FSerializer.RegisterTypeSerializer(System.TypeInfo(TEntityCustom), TMVCEntityCustomSerializerJsonDataObjects.Create);
|
||||
FSerializer.RegisterTypeSerializer(System.TypeInfo(TMVCNullable<Integer>), TMVCNullableSerializerJsonDataObjects.Create);
|
||||
end;
|
||||
|
||||
procedure TMVCTestSerializerJsonDataObjects.TearDown;
|
||||
@ -1175,30 +1169,41 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TMVCNullableSerializerJsonDataObjects }
|
||||
|
||||
procedure TMVCNullableSerializerJsonDataObjects.Deserialize(
|
||||
const ASerializedObject: TObject; var AElementValue: TValue;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
procedure TMVCEntityCustomSerializerJsonDataObjects.SerializeAttribute(
|
||||
const AElementValue: TValue; const APropertyName: string;
|
||||
const ASerializerObject: TObject;
|
||||
const AAttributes: System.TArray<System.TCustomAttribute>);
|
||||
var
|
||||
lNullInt: TMVCNullableInteger;
|
||||
lEntityCustom: TEntityCustom;
|
||||
begin
|
||||
lNullInt := AElementValue.AsType<TMVCNullableInteger>;
|
||||
if PJsonDataValue(Pointer(ASerializedObject)).Typ = jdtInt then
|
||||
lEntityCustom := AElementValue.AsObject as TEntityCustom;
|
||||
if Assigned(lEntityCustom) then
|
||||
begin
|
||||
lNullInt.Value := PJsonDataValue(Pointer(ASerializedObject)).LongValue;
|
||||
TJsonObject(ASerializerObject).O[APropertyName].L['AId'] := lEntityCustom.Id;
|
||||
TJsonObject(ASerializerObject).O[APropertyName].I['ACode'] := lEntityCustom.Code;
|
||||
TJsonObject(ASerializerObject).O[APropertyName].S['AName'] := lEntityCustom.Name;
|
||||
end
|
||||
else
|
||||
begin
|
||||
lNullInt.Clear;
|
||||
TJsonObject(ASerializerObject).Values[APropertyName] := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMVCNullableSerializerJsonDataObjects.Serialize(
|
||||
const AElementValue: TValue; var ASerializerObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
procedure TMVCEntityCustomSerializerJsonDataObjects.SerializeRoot(
|
||||
const AObject: TObject; out ASerializerObject: TObject;
|
||||
const AAttributes: System.TArray<System.TCustomAttribute>);
|
||||
var
|
||||
lEntityCustom: TEntityCustom;
|
||||
begin
|
||||
|
||||
ASerializerObject := nil;
|
||||
lEntityCustom := AObject as TEntityCustom;
|
||||
if Assigned(lEntityCustom) then
|
||||
begin
|
||||
ASerializerObject := TJsonObject.Create;
|
||||
TJsonObject(ASerializerObject).L['AId'] := lEntityCustom.Id;
|
||||
TJsonObject(ASerializerObject).I['ACode'] := lEntityCustom.Code;
|
||||
TJsonObject(ASerializerObject).S['AName'] := lEntityCustom.Name;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,95 +0,0 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Delphi MVC Framework
|
||||
//
|
||||
// Copyright (c) 2010-2018 Daniele Teti and the DMVCFramework Team
|
||||
//
|
||||
// https://github.com/danieleteti/delphimvcframework
|
||||
//
|
||||
// Collaborators with this file: Ezequiel Juliano Müller (ezequieljuliano@gmail.com)
|
||||
//
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
program TestSerializerJSON;
|
||||
|
||||
{$IFNDEF TESTINSIGHT}
|
||||
{$APPTYPE CONSOLE}
|
||||
{$ENDIF}{$STRONGLINKTYPES ON}
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
{$IFDEF TESTINSIGHT}
|
||||
TestInsight.DUnitX,
|
||||
{$ENDIF }
|
||||
DUnitX.Loggers.Console,
|
||||
DUnitX.Loggers.Xml.NUnit,
|
||||
DUnitX.TestFramework,
|
||||
MVCFramework.Tests.Serializer.JSON in 'MVCFramework.Tests.Serializer.JSON.pas',
|
||||
MVCFramework.Tests.Serializer.Entities in '..\..\common\MVCFramework.Tests.Serializer.Entities.pas',
|
||||
MVCFramework.Serializer.JSON in '..\..\..\sources\MVCFramework.Serializer.JSON.pas',
|
||||
MVCFramework.Serializer.JSON.CustomTypes in '..\..\..\sources\MVCFramework.Serializer.JSON.CustomTypes.pas',
|
||||
MVCFramework.Tests.Serializer.Intf in '..\..\common\MVCFramework.Tests.Serializer.Intf.pas',
|
||||
MVCFramework.Tests.Serializer.EntitiesModule in '..\..\common\MVCFramework.Tests.Serializer.EntitiesModule.pas' {EntitiesModule: TDataModule};
|
||||
|
||||
{$R *.RES}
|
||||
|
||||
var
|
||||
runner : ITestRunner;
|
||||
results : IRunResults;
|
||||
logger : ITestLogger;
|
||||
nunitLogger : ITestLogger;
|
||||
begin
|
||||
FormatSettings.TimeSeparator := ':';
|
||||
{$IFDEF TESTINSIGHT}
|
||||
TestInsight.DUnitX.RunRegisteredTests;
|
||||
exit;
|
||||
{$ENDIF}
|
||||
|
||||
try
|
||||
//Check command line options, will exit if invalid
|
||||
TDUnitX.CheckCommandLine;
|
||||
//Create the test runner
|
||||
runner := TDUnitX.CreateRunner;
|
||||
//Tell the runner to use RTTI to find Fixtures
|
||||
runner.UseRTTI := True;
|
||||
//tell the runner how we will log things
|
||||
//Log to the console window
|
||||
logger := TDUnitXConsoleLogger.Create(true);
|
||||
runner.AddLogger(logger);
|
||||
//Generate an NUnit compatible XML File
|
||||
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
|
||||
runner.AddLogger(nunitLogger);
|
||||
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
|
||||
|
||||
//Run tests
|
||||
results := runner.Execute;
|
||||
if not results.AllPassed then
|
||||
System.ExitCode := EXIT_ERRORS;
|
||||
|
||||
{$IFNDEF CI}
|
||||
//We don't want this happening when running under CI.
|
||||
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
|
||||
begin
|
||||
System.Write('Done.. press <Enter> key to quit.');
|
||||
System.Readln;
|
||||
end;
|
||||
{$ENDIF}
|
||||
except
|
||||
on E: Exception do
|
||||
System.Writeln(E.ClassName, ': ', E.Message);
|
||||
end;
|
||||
end.
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user