Daniele Teti 2022-12-09 09:58:55 +01:00
parent e8f611c1b6
commit dad88f85b6
6 changed files with 110 additions and 97 deletions

View File

@ -594,7 +594,9 @@ function TCustomer.ToString: String;
begin
Result := '';
if PKIsNull then
Result := '<null>';
Result := '<null>'
else
Result := fID.ValueOrDefault.ToString;
Result := Format('[ID: %6s][CODE: %6s][CompanyName: %18s][City: %16s][Rating: %3d][Note: %s]',[
Result, fCode.ValueOrDefault, fCompanyName.ValueOrDefault, fCity, fRating.ValueOrDefault, fNote]);
end;

View File

@ -511,11 +511,11 @@ begin
end, fGeneralErrorHandler);
end;
procedure TMainForm.btnSubtractClick(Sender: TObject);
var
procedure TMainForm.btnSubtractClick(Sender: TObject);
var
lReq: IJSONRPCRequest;
lExecutorAsync: IMVCJSONRPCExecutorAsync;
begin
begin
lExecutorAsync := TMVCJSONRPCExecutor.Create('http://localhost:8080');
lReq := TJSONRPCRequest.Create;
lReq.Method := 'subtract';
@ -528,7 +528,7 @@ end;
begin
edtResult.Text := JSONRPCResp.Result.AsInteger.ToString;
end);
end;
end;
procedure TMainForm.btnSubtractWithNamedParamsClick(Sender: TObject);
var

View File

@ -91,7 +91,9 @@ begin
TJWTCheckableClaim.NotBefore,
TJWTCheckableClaim.IssuedAt
], 300))
.AddMiddleware(TMVCJWTBlackListMiddleware.Create(lOnAcceptToken, lOnNewJWTToBlackList));
.AddMiddleware(
TMVCJWTBlackListMiddleware.Create(lOnAcceptToken, lOnNewJWTToBlackList)
);
end;
end.

View File

@ -1,5 +1,6 @@
unit SSEControllerU;
interface
uses

View File

@ -33,7 +33,9 @@ end;
procedure TMyController.DoSum(const a, b: Integer);
begin
Render((Context.CustomIntfObject as ICalculator).DoCalc(a,b).ToString);
var lSvc := Context.CustomIntfObject as ICalculator;
Render(lSvc.DoCalc(a,b).ToString);
end;
end.

View File

@ -71,6 +71,8 @@ type
AContext: TWebContext;
const AHandled: Boolean);
public
constructor Create(
const DefaultConnectionDefName: string); overload; virtual;
constructor Create(
const DefaultConnectionDefName: string;
const ConnectionDefFileName: string{ = 'FDConnectionDefs.ini'}); overload; virtual;
@ -96,10 +98,7 @@ var
constructor TMVCActiveRecordMiddleware.Create(const DefaultConnectionDefName: string;
const ConnectionDefFileName: string);
begin
inherited Create;
fConnectionLoaded := False;
fDefaultConnectionDefName := DefaultConnectionDefName;
fConnectionDefFileName := ConnectionDefFileName;
Create(DefaultConnectionDefName, [], [], ConnectionDefFileName);
end;
constructor TMVCActiveRecordMiddleware.Create(
@ -107,6 +106,7 @@ constructor TMVCActiveRecordMiddleware.Create(
const AdditionalARConnectionNames, AdditionalConnectionDefNames: TArray<String>;
const ConnectionDefFileName: string);
begin
inherited Create;
fConnectionLoaded := False;
fDefaultConnectionDefName := DefaultConnectionDefName;
fConnectionDefFileName := ConnectionDefFileName;
@ -114,6 +114,12 @@ begin
fAdditionalConnectionDefNames := AdditionalConnectionDefNames;
end;
constructor TMVCActiveRecordMiddleware.Create(
const DefaultConnectionDefName: string);
begin
Create(DefaultConnectionDefName, 'FDConnectionDefs.ini');
end;
procedure TMVCActiveRecordMiddleware.EnsureConnection;
var
I: Integer;