From 11fe0116d20bca8673257c30ee8e67e27e8e4b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20M=C3=ADguez=20V=C3=A1zquez?= Date: Tue, 2 Feb 2021 09:39:57 +0100 Subject: [PATCH] Update Quick.ORM.RestClient.pas Add array in MethodInterfaces --- Quick.ORM.RestClient.pas | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Quick.ORM.RestClient.pas b/Quick.ORM.RestClient.pas index e739c1f..03fccf2 100644 --- a/Quick.ORM.RestClient.pas +++ b/Quick.ORM.RestClient.pas @@ -1,10 +1,10 @@ { *************************************************************************** - Copyright (c) 2016-2019 Kike Pérez + Copyright (c) 2016-2019 Kike PĂ©rez Unit : Quick.ORM.RestClient Description : Rest ORM Client access by http, httpapi or websockets - Author : Kike Pérez + Author : Kike PĂ©rez Version : 1.6 Created : 02/06/2017 Modified : 26/09/2019 @@ -100,20 +100,23 @@ TORMDataBaseConnection = class constructor Create; destructor Destroy; override; end; + + TGUIDArray = array of TGUID; TORMServiceClient = class private fORMClient : TORMClient; - fMethodInterface : TGUID; + fMethodInterface : TGUIDArray; fInstanceImplementation : TServiceInstanceImplementation; fEnabled : Boolean; public constructor Create; - property MethodInterface : TGUID read fMethodInterface write fMethodInterface; + property MethodInterface : TGUIDArray read fMethodInterface write fMethodInterface; property InstanceImplementation : TServiceInstanceImplementation read fInstanceImplementation write fInstanceImplementation; property Enabled : Boolean read fEnabled write fEnabled; procedure SetORM(fORM : TORMClient); - function SetRestMethod(out Obj) : Boolean; + function SetRestMethod(out Obj) : Boolean; overload; + function SetRestMethod(const aObjs: array of pointer) : Boolean; overload; end; TConnectEvent = procedure of object; @@ -204,9 +207,21 @@ procedure TORMServiceClient.SetORM(fORM : TORMClient); fORMClient := fORM; end; +function TORMServiceClient.SetRestMethod(const aObjs: array of pointer): Boolean; +begin + try + result := true; + fORMClient.Services.Resolve(fMethodInterface, aObjs, false); + except + result := false; + end; + +end; + function TORMServiceClient.SetRestMethod(out Obj) : Boolean; begin - Result := fORMClient.Services.Resolve(fMethodInterface, obj); + if length(fMethodInterface) > 0 then + Result := fORMClient.Services.Resolve(fMethodInterface[0], obj); end; @@ -352,7 +367,7 @@ function TORMRestClient.Connect : Boolean; if fService.Enabled then begin fService.SetORM(ORM); - ORM.ServiceDefine([fService.fMethodInterface],fService.fInstanceImplementation); + ORM.ServiceDefine(fService.fMethodInterface,fService.fInstanceImplementation); end; //get Auth Group