diff --git a/7z.exe b/7z.exe new file mode 100644 index 00000000..d02b0ae8 Binary files /dev/null and b/7z.exe differ diff --git a/samples/outputcachewithredis/Controllers/PeopleControllerU.pas b/samples/outputcachewithredis/Controllers/PeopleControllerU.pas index 56355f8a..45a06b3a 100644 --- a/samples/outputcachewithredis/Controllers/PeopleControllerU.pas +++ b/samples/outputcachewithredis/Controllers/PeopleControllerU.pas @@ -103,7 +103,7 @@ begin raise; end; Render(lPeople); - SetCache(20); + SetCache(60); end; procedure TPeopleController.CreateBulkData(CTX: TWebContext); diff --git a/samples/renders/CustomTypesSerializersU.pas b/samples/renders/CustomTypesSerializersU.pas index 32597d45..ac232660 100644 --- a/samples/renders/CustomTypesSerializersU.pas +++ b/samples/renders/CustomTypesSerializersU.pas @@ -2,7 +2,7 @@ // // Delphi MVC Framework // -// Copyright (c) 2010-2017 Daniele Teti and the DMVCFramework Team +// Copyright (c) 2010-2018 Daniele Teti and the DMVCFramework Team // // https://github.com/danieleteti/delphimvcframework // diff --git a/samples/renders/CustomTypesU.pas b/samples/renders/CustomTypesU.pas index 91e8a53a..435bd425 100644 --- a/samples/renders/CustomTypesU.pas +++ b/samples/renders/CustomTypesU.pas @@ -2,7 +2,7 @@ // // Delphi MVC Framework // -// Copyright (c) 2010-2017 Daniele Teti and the DMVCFramework Team +// Copyright (c) 2010-2018 Daniele Teti and the DMVCFramework Team // // https://github.com/danieleteti/delphimvcframework // diff --git a/samples/renders/RenderSampleControllerU.pas b/samples/renders/RenderSampleControllerU.pas index 6fa6b88f..17b53b35 100644 --- a/samples/renders/RenderSampleControllerU.pas +++ b/samples/renders/RenderSampleControllerU.pas @@ -2,7 +2,7 @@ // // Delphi MVC Framework // -// Copyright (c) 2010-2017 Daniele Teti and the DMVCFramework Team +// Copyright (c) 2010-2018 Daniele Teti and the DMVCFramework Team // // https://github.com/danieleteti/delphimvcframework // @@ -39,8 +39,7 @@ type [MVCPath('/')] TRenderSampleController = class(TMVCController) protected - procedure OnBeforeAction(AContext: TWebContext; const AActionName: string; - var AHandled: Boolean); override; + procedure OnBeforeAction(AContext: TWebContext; const AActionName: string; var AHandled: Boolean); override; public [MVCHTTPMethod([httpGET])] [MVCPath('/customers/($id)')] @@ -52,6 +51,11 @@ type [MVCProduces('application/json')] procedure GetCustomers_AsDataSet(CTX: TWebContext); + [MVCHTTPMethod([httpGET])] + [MVCPath('/customers/metadata')] + [MVCProduces('application/json')] + procedure GetDataSetWithMetadata; + [MVCHTTPMethod([httpGET])] [MVCPath('/multi')] [MVCProduces('application/json')] @@ -71,7 +75,7 @@ type [MVCPath('/lotofobjects')] procedure GetLotOfPeople; - //this action is polymorphic + // this action is polymorphic [MVCHTTPMethod([httpGET])] [MVCPath('/skilledpeople')] [MVCProduces('application/json')] @@ -91,7 +95,6 @@ type [MVCPath('/customers.csv')] procedure GetPeopleAsCSV; - [MVCHTTPMethod([httpGET])] [MVCPath('/customers/unicode/($id).html')] [MVCProduces('text/html', 'UTF-8')] @@ -157,8 +160,8 @@ begin Render(s); end; -procedure TRenderSampleController.OnBeforeAction(AContext: TWebContext; - const AActionName: string; var AHandled: Boolean); +procedure TRenderSampleController.OnBeforeAction(AContext: TWebContext; const AActionName: string; + var AHandled: Boolean); begin inherited; @@ -207,8 +210,8 @@ begin // We need a non standard representation, let's create a specific serializer. lSer := TMVCJsonDataObjectsSerializer.Create; try - lSer.DataSetToJsonArray(lDM.qryCustomers, lJObj.A['customers'], TMVCNameCase.ncLowerCase, []); - lSer.DataSetToJsonArray(lDM.qryCountry, lJObj.A['countries'], TMVCNameCase.ncLowerCase, []); + lSer.DataSetToJsonArray(lDM.qryCustomers, lJObj.a['customers'], TMVCNameCase.ncLowerCase, []); + lSer.DataSetToJsonArray(lDM.qryCountry, lJObj.a['countries'], TMVCNameCase.ncLowerCase, []); finally lSer.Free; end; @@ -241,6 +244,24 @@ begin Render(TSysUser.Create('daniele', ['poweruser', 'role1', 'role2']), True); end; +procedure TRenderSampleController.GetDataSetWithMetadata; +var + lDM: TMyDataModule; + lHolder: TDataSetHolder; +begin + lDM := TMyDataModule.Create(nil); + try + lDM.qryCustomers.Open; + lHolder := TDataSetHolder.Create(lDM.qryCustomers); + lHolder.Metadata.AddProperty('page', '1'); + lHolder.Metadata.AddProperty('count', lDM.qryCustomers.RecordCount.ToString); + Render(lHolder); + finally + lDM.Free; + end; + +end; + procedure TRenderSampleController.GetLotOfPeople; begin Render(GetPeopleList, False); @@ -248,12 +269,8 @@ end; procedure TRenderSampleController.GetPerson_AsHTML(CTX: TWebContext); begin - ResponseStream - .Append('