From 10d31561af13c9c0f5b4fd7e2db715d1e540ac71 Mon Sep 17 00:00:00 2001 From: Daniele Teti Date: Tue, 16 Apr 2024 00:22:41 +0200 Subject: [PATCH] Removed old code from the old IDE Wizard --- ideexpert/DMVC.Expert.CodeGen.Commands.pas | 24 + ideexpert/DMVC.Expert.CodeGen.Executor.pas | 24 + .../DMVC.Expert.CodeGen.NewControllerUnit.pas | 86 +--- .../DMVC.Expert.CodeGen.NewDMVCProject.pas | 30 -- .../DMVC.Expert.CodeGen.NewWebModuleUnit.pas | 67 --- ideexpert/DMVC.Expert.CodeGen.SourceFile.pas | 1 - ideexpert/DMVC.Expert.CodeGen.Templates.pas | 458 ------------------ ideexpert/DMVC.Expert.Commands.Templates.pas | 24 + ideexpert/DMVC.Expert.Commons.pas | 31 ++ .../DMVC.Expert.Forms.NewProjectWizard.pas | 13 +- ideexpert/DMVC.Expert.Forms.NewUnitWizard.pas | 6 +- ideexpert/DMVC.Expert.NewUnitWizardEx.pas | 8 +- ideexpert/DMVC.Expert.ProjectWizardEx.pas | 14 +- packages/d120/dmvcframeworkDT.dpk | 1 - packages/d120/dmvcframeworkDT.dproj | 1 - 15 files changed, 118 insertions(+), 670 deletions(-) delete mode 100644 ideexpert/DMVC.Expert.CodeGen.Templates.pas diff --git a/ideexpert/DMVC.Expert.CodeGen.Commands.pas b/ideexpert/DMVC.Expert.CodeGen.Commands.pas index 6113fc43..ed72a8ce 100644 --- a/ideexpert/DMVC.Expert.CodeGen.Commands.pas +++ b/ideexpert/DMVC.Expert.CodeGen.Commands.pas @@ -1,3 +1,27 @@ +// *************************************************************************** +// +// Delphi MVC Framework +// +// Copyright (c) 2010-2024 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 DMVC.Expert.CodeGen.Commands; interface diff --git a/ideexpert/DMVC.Expert.CodeGen.Executor.pas b/ideexpert/DMVC.Expert.CodeGen.Executor.pas index 88c63350..7b9e5f40 100644 --- a/ideexpert/DMVC.Expert.CodeGen.Executor.pas +++ b/ideexpert/DMVC.Expert.CodeGen.Executor.pas @@ -1,3 +1,27 @@ +// *************************************************************************** +// +// Delphi MVC Framework +// +// Copyright (c) 2010-2024 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 DMVC.Expert.CodeGen.Executor; interface diff --git a/ideexpert/DMVC.Expert.CodeGen.NewControllerUnit.pas b/ideexpert/DMVC.Expert.CodeGen.NewControllerUnit.pas index 391db4b0..e3974074 100644 --- a/ideexpert/DMVC.Expert.CodeGen.NewControllerUnit.pas +++ b/ideexpert/DMVC.Expert.CodeGen.NewControllerUnit.pas @@ -37,22 +37,17 @@ interface uses ToolsApi, System.IOUtils, - DMVC.Expert.CodeGen.NewUnit, JsonDataObjects; + DMVC.Expert.CodeGen.NewUnit, + JsonDataObjects; type TNewControllerUnitEx = class(TNewUnit) protected - FCreateIndexMethod: Boolean; - FCreateCRUDMethods: Boolean; - FCreateActionFiltersMethods: Boolean; - FControllerClassName: string; function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string) : IOTAFile; override; public constructor Create( const ConfigModelRef: TJSONObject; - const aCreateIndexMethod, aCreateCRUDMethods, aCreateActionFiltersMethods: Boolean; - const AControllerClassName: string; const APersonality: string = ''); reintroduce; end; @@ -71,8 +66,6 @@ implementation uses System.SysUtils, - VCL.Dialogs, - DMVC.Expert.CodeGen.Templates, DMVC.Expert.CodeGen.SourceFile, DMVC.Expert.CodeGen.Executor, DMVC.Expert.Commands.Templates, @@ -80,21 +73,9 @@ uses constructor TNewControllerUnitEx.Create( const ConfigModelRef: TJSONObject; - const aCreateIndexMethod, aCreateCRUDMethods, - aCreateActionFiltersMethods: Boolean; - const AControllerClassName: string; const APersonality: string = ''); begin inherited Create(ConfigModelRef); - Assert(Length(AControllerClassName) > 0); - FAncestorName := ''; - FFormName := ''; - FImplFileName := ''; - FIntfFileName := ''; - FControllerClassName := AControllerClassName; - FCreateIndexMethod := aCreateIndexMethod; - FCreateCRUDMethods := aCreateCRUDMethods; - FCreateActionFiltersMethods := aCreateActionFiltersMethods; Personality := APersonality; end; @@ -104,52 +85,7 @@ var lUnitIdent: string; lFormName: string; lFileName: string; -// lIndexMethodIntf: string; -// lIndexMethodImpl: string; -// lControllerUnit: string; -// lActionFiltersMethodsIntf: string; -// lActionFiltersMethodsImpl: string; -// lCRUDMethodsIntf: string; -// lCRUDMethodsImpl: string; -// lBOClassesIntf: string; -// lBOClassesImpl: string; begin - { - lControllerUnit := sControllerUnit; - - lIndexMethodIntf := sIndexMethodIntf; - lIndexMethodImpl := Format(sIndexMethodImpl, [FControllerClassName]); - - lCRUDMethodsIntf := sCRUDMethodsIntf; - lCRUDMethodsImpl := Format(sCRUDMethodsImpl, [FControllerClassName]); - lBOClassesIntf := sBOClassesIntf; - lBOClassesImpl := Format(sBOClassesImpl, ['TPerson']); - - - if not FCreateIndexMethod then - begin - lIndexMethodIntf := ''; - lIndexMethodImpl := ''; - end; - - if not FCreateCRUDMethods then - begin - lCRUDMethodsIntf := ''; - lCRUDMethodsImpl := ''; - lBOClassesIntf := ''; - lBOClassesImpl := ''; - end; - - lActionFiltersMethodsIntf := sActionFiltersIntf; - lActionFiltersMethodsImpl := Format(sActionFiltersImpl, - [FControllerClassName]); - - if not FCreateActionFiltersMethods then - begin - lActionFiltersMethodsIntf := ''; - lActionFiltersMethodsImpl := ''; - end; - } // http://stackoverflow.com/questions/4196412/how-do-you-retrieve-a-new-unit-name-from-delphis-open-tools-api // So using method mentioned by Marco Cantu. (BorlandIDEServices as IOTAModuleServices).GetNewModuleAndClassName('', @@ -164,19 +100,6 @@ begin FillControllerTemplates(Gen); end, fConfigModelRef); -// Result := TSourceFile.Create(sControllerUnit, -// [ -// lUnitIdent, -// FControllerClassName, -// lIndexMethodIntf, -// lIndexMethodImpl, -// lActionFiltersMethodsIntf, -// lActionFiltersMethodsImpl, -// lCRUDMethodsIntf, -// lCRUDMethodsImpl, -// lBOClassesIntf, -// lBOClassesImpl -// ]); end; { TNewJSONRPCUnitEx } @@ -201,11 +124,6 @@ begin lFileName := ''; (BorlandIDEServices as IOTAModuleServices).GetNewModuleAndClassName('', lUnitIdent, lDummy, lFileName); -// Result := TSourceFile.Create(sJSONRPCUnit, -// [ -// lUnitIdent, -// fJSONRPCClassName -// ]); fConfigModelRef.S[TConfigKey.jsonrpc_unit_name] := lUnitIdent; Result := TSourceFile.Create( procedure (Gen: TMVCCodeGenerator) diff --git a/ideexpert/DMVC.Expert.CodeGen.NewDMVCProject.pas b/ideexpert/DMVC.Expert.CodeGen.NewDMVCProject.pas index 7ad86176..81ce73ba 100644 --- a/ideexpert/DMVC.Expert.CodeGen.NewDMVCProject.pas +++ b/ideexpert/DMVC.Expert.CodeGen.NewDMVCProject.pas @@ -41,26 +41,19 @@ uses type TDMVCProjectFile = class(TNewProjectEx) private - FDefaultPort: Integer; - FUseMSHeapOnWindows: Boolean; fConfigModelRef: TJsonObject; - procedure SetDefaultPort(const Value: Integer); - procedure SetUseMSHeapOnWindows(const Value: Boolean); protected function NewProjectSource(const ProjectName: string): IOTAFile; override; function GetFrameworkType: string; override; public constructor Create; overload; constructor Create(const APersonality: string; const ConfigModelRef: TJSONObject); overload; - property DefaultPort: Integer read FDefaultPort write SetDefaultPort; - property UseMSHeapOnWindows: Boolean read FUseMSHeapOnWindows write SetUseMSHeapOnWindows; end; implementation uses DMVC.Expert.CodeGen.SourceFile, - DMVC.Expert.CodeGen.Templates, System.SysUtils, DMVC.Expert.CodeGen.Executor, DMVC.Expert.Commands.Templates, @@ -72,8 +65,6 @@ begin // Return Blank and the project will be 'ProjectX.dpr' where X is the next available number inherited; FFileName := ''; - FDefaultPort := 0; - FUseMSHeapOnWindows := False; end; constructor TDMVCProjectFile.Create(const APersonality: string; const ConfigModelRef: TJSONObject); @@ -89,19 +80,8 @@ begin end; function TDMVCProjectFile.NewProjectSource(const ProjectName: string): IOTAFile; -var - lCodeForUseMSHeapOnWindows: String; begin - lCodeForUseMSHeapOnWindows := ''; - if FUseMSHeapOnWindows then - begin - lCodeForUseMSHeapOnWindows := '{$IF Defined(MSWINDOWS)}' + sLineBreak + ' MSHeap,' + sLineBreak + '{$ENDIF}'; - end; - //Result := TSourceFile.Create(sDMVCDPR, [ProjectName, FDefaultPort, lCodeForUseMSHeapOnWindows]); - fConfigModelRef.S[TConfigKey.program_name] := ProjectName; - - fConfigModelRef.SaveToFile('C:\todelete\configmodelref.json', False); Result := TSourceFile.Create( procedure (Gen: TMVCCodeGenerator) begin @@ -110,14 +90,4 @@ begin fConfigModelRef); end; -procedure TDMVCProjectFile.SetDefaultPort(const Value: Integer); -begin - FDefaultPort := Value; -end; - -procedure TDMVCProjectFile.SetUseMSHeapOnWindows(const Value: Boolean); -begin - FUseMSHeapOnWindows := Value; -end; - end. diff --git a/ideexpert/DMVC.Expert.CodeGen.NewWebModuleUnit.pas b/ideexpert/DMVC.Expert.CodeGen.NewWebModuleUnit.pas index dab82789..6543da58 100644 --- a/ideexpert/DMVC.Expert.CodeGen.NewWebModuleUnit.pas +++ b/ideexpert/DMVC.Expert.CodeGen.NewWebModuleUnit.pas @@ -42,25 +42,13 @@ type TNewWebModuleUnitEx = class(TNewUnit) private FUnitIdent, FFormName, FFileName : String; - FMiddlewares: TArray; protected - FWebModuleClassName : string; - FControllerClassName: string; - FControllerUnit: string; - FJSONRPCClassName: string; - FJSONRPCClassUnit: string; function GetCreatorType: string; override; function NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile; override; function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; override; public constructor Create( const ConfigModelRef: TJSONObject; - const aWebModuleClassName: string; - const aControllerClassName: string; - const aControllerUnit: string; - const aMiddlewares: TArray; - const aJSONRPCClassName: String; - const aJSONRPCClassUnit: String; const aPersonality : String);reintroduce; end; @@ -70,7 +58,6 @@ uses Winapi.Windows, System.SysUtils, VCL.Dialogs, - DMVC.Expert.CodeGen.Templates, DMVC.Expert.CodeGen.SourceFile, DMVC.Expert.CodeGen.Executor, DMVC.Expert.Commands.Templates, @@ -78,26 +65,9 @@ uses constructor TNewWebModuleUnitEx.Create( const ConfigModelRef: TJSONObject; - const aWebModuleClassName: string; - const aControllerClassName: string; - const aControllerUnit: string; - const aMiddlewares: TArray; - const aJSONRPCClassName: String; - const aJSONRPCClassUnit: String; const aPersonality : String); begin inherited Create(ConfigModelRef); - Assert(Length(aWebModuleClassName) > 0); - FAncestorName := ''; - FFormName := ''; - FImplFileName := ''; - FIntfFileName := ''; - FJSONRPCClassName := aJSONRPCClassName; - FJSONRPCClassUnit := aJSONRPCClassUnit; - FWebModuleClassName := aWebModuleClassName; - FControllerClassName := aControllerClassName; - FControllerUnit := aControllerUnit; - FMiddlewares := AMiddlewares; Personality := APersonality; (BorlandIDEServices as IOTAModuleServices).GetNewModuleAndClassName( '', FUnitIdent, FFormName, FFileName); @@ -110,7 +80,6 @@ end; function TNewWebModuleUnitEx.NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile; begin - //Result := TSourceFile.Create(sWebModuleDFM, [FormIdent, FWebModuleClassName]); Result := TSourceFile.Create( procedure (Gen: TMVCCodeGenerator) begin @@ -120,47 +89,11 @@ begin end; function TNewWebModuleUnitEx.NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; -var - lJSONRPCCode: string; - lMiddlewaresCode: String; - I: Integer; begin - lMiddlewaresCode := sLineBreak; - for I := Low(FMiddlewares) to High(FMiddlewares) do - begin - lMiddlewaresCode := lMiddlewaresCode + ' ' + FMiddlewares[I] + sLineBreak; - end; - - lJSONRPCCode := ''; - if not FJSONRPCClassName.IsEmpty then - begin - lJSONRPCCode := 'FMVC.PublishObject( ' + sLineBreak + - ' function : TObject ' + sLineBreak + - ' begin ' + sLineBreak + - ' Result := ' + FJSONRPCClassName + '.Create; ' + sLineBreak + - ' end, ''/jsonrpc'');' + sLineBreak + sLineBreak; - end; - //ModuleIdent is blank for some reason. // http://stackoverflow.com/questions/4196412/how-do-you-retrieve-a-new-unit-name-from-delphis-open-tools-api - // So using method mentioned by Marco Cantu. - if not lJSONRPCCode.IsEmpty then - begin - if not FJSONRPCClassUnit.IsEmpty then - begin - FJSONRPCClassUnit := FJSONRPCClassUnit + ','; - end; - end; fConfigModelRef.S[TConfigKey.webmodule_unit_name] := FUnitIdent; -// Result := TSourceFile.Create(sWebModuleUnit, [ -// FUnitIdent, -// FWebModuleClassName, -// FControllerUnit, -// FControllerClassName, -// lMiddlewaresCode, -// lJSONRPCCode, -// FJSONRPCClassUnit]); Result := TSourceFile.Create( procedure (Gen: TMVCCodeGenerator) begin diff --git a/ideexpert/DMVC.Expert.CodeGen.SourceFile.pas b/ideexpert/DMVC.Expert.CodeGen.SourceFile.pas index b3f8e2bc..ae47041b 100644 --- a/ideexpert/DMVC.Expert.CodeGen.SourceFile.pas +++ b/ideexpert/DMVC.Expert.CodeGen.SourceFile.pas @@ -77,7 +77,6 @@ end; function TSourceFile.GetSource: string; begin - //Result := FSource; Result := TMVCCodeGenerator.GenerateSource(fJSON, procedure (Gen: TMVCCodeGenerator) begin diff --git a/ideexpert/DMVC.Expert.CodeGen.Templates.pas b/ideexpert/DMVC.Expert.CodeGen.Templates.pas deleted file mode 100644 index 99d8e7ec..00000000 --- a/ideexpert/DMVC.Expert.CodeGen.Templates.pas +++ /dev/null @@ -1,458 +0,0 @@ -// *************************************************************************** -// -// Delphi MVC Framework -// -// Copyright (c) 2010-2024 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. -// -// This IDE expert is based off of the one included with the DUnitX -// project. Original source by Robert Love. Adapted by Nick Hodges and Daniele Teti. -// -// The DUnitX project is run by Vincent Parrett and can be found at: -// -// https://github.com/VSoftTechnologies/DUnitX -// *************************************************************************** - -unit DMVC.Expert.CodeGen.Templates; - -interface - -{$I ..\sources\dmvcframework.inc} - -resourcestring - - { Delphi template code } - // 0 - project name - // 1 - http/s port - // 2 - UseMSHeapOnWindows - sDMVCDPR = - 'program %0:s;' + sLineBreak + - sLineBreak + - '{$APPTYPE CONSOLE}' + sLineBreak + - sLineBreak + - 'uses' + sLineBreak + - ' %2:s' + sLineBreak + - ' System.SysUtils,' + sLineBreak + - ' MVCFramework,' + sLineBreak + - ' MVCFramework.Logger,' + sLineBreak + - ' MVCFramework.DotEnv,' + sLineBreak + - ' MVCFramework.Commons,' + sLineBreak + - ' MVCFramework.Signal,' + sLineBreak + - {$IF Defined(SeattleOrBetter)} - ' Web.ReqMulti, //If you have problem with this unit, see https://quality.embarcadero.com/browse/RSP-17216' + sLineBreak + - ' Web.WebReq,' + sLineBreak + - ' Web.WebBroker,' + sLineBreak + - {$ELSE} - ' ReqMulti, //If you have problem with this unit, see https://quality.embarcadero.com/browse/RSP-17216' + sLineBreak + - ' WebReq,' + sLineBreak + - ' WebBroker,' + sLineBreak + - {$ENDIF} - ' IdContext,' + sLineBreak + - ' IdHTTPWebBrokerBridge;' + sLineBreak + - sLineBreak + - '{$R *.res}' + sLineBreak + - sLineBreak + - sLineBreak + - 'procedure RunServer(APort: Integer);' + sLineBreak + - 'var' + sLineBreak + - ' LServer: TIdHTTPWebBrokerBridge;' + sLineBreak + - 'begin' + sLineBreak + - ' LServer := TIdHTTPWebBrokerBridge.Create(nil);' + sLineBreak + - ' try' + sLineBreak + - ' LServer.OnParseAuthentication := TMVCParseAuthentication.OnParseAuthentication;' + sLineBreak + - ' LServer.DefaultPort := APort;' + sLineBreak + - ' LServer.KeepAlive := True;' + sLineBreak + - ' LServer.MaxConnections := dotEnv.Env(''dmvc.webbroker.max_connections'', 0);' + sLineBreak + - ' LServer.ListenQueue := dotEnv.Env(''dmvc.indy.listen_queue'', 500);' + sLineBreak + sLineBreak + - ' LServer.Active := True;' + sLineBreak + - ' LogI(''Listening on port '' + APort.ToString);' + sLineBreak + - ' LogI(''Application started. Press Ctrl+C to shut down.'');' + sLineBreak + - ' WaitForTerminationSignal; ' + sLineBreak + - ' EnterInShutdownState; ' + sLineBreak + - ' LServer.Active := False; ' + sLineBreak + - ' finally' + sLineBreak + - ' LServer.Free;' + sLineBreak + - ' end;' + sLineBreak + - 'end;' + sLineBreak + - sLineBreak + - 'begin' + sLineBreak + - ' { Enable ReportMemoryLeaksOnShutdown during debug }' + sLineBreak + - ' // ReportMemoryLeaksOnShutdown := True;' + sLineBreak + - ' IsMultiThread := True;' + sLineBreak + sLineBreak + - ' // DMVCFramework Specific Configuration ' + sLineBreak + - ' // When MVCSerializeNulls = True empty nullables and nil are serialized as json null.' + sLineBreak + - ' // When MVCSerializeNulls = False empty nullables and nil are not serialized at all.' + sLineBreak + - ' MVCSerializeNulls := True;' + sLineBreak + - ' UseConsoleLogger := True;' + sLineBreak + sLineBreak + - ' LogI(''** DMVCFramework Server ** build '' + DMVCFRAMEWORK_VERSION);' + sLineBreak + - ' try' + sLineBreak + - ' if WebRequestHandler <> nil then' + sLineBreak + - ' WebRequestHandler.WebModuleClass := WebModuleClass;' + sLineBreak + - '' + sLineBreak + - ' dotEnvConfigure(' + sLineBreak + - ' function: IMVCDotEnv' + sLineBreak + - ' begin' + sLineBreak + - ' Result := NewDotEnv' + sLineBreak + - ' .UseStrategy(TMVCDotEnvPriority.FileThenEnv)' + sLineBreak + - ' //if available, by default, loads default environment (.env)' + sLineBreak + - ' .UseProfile(''test'') //if available loads the test environment (.env.test)' + sLineBreak + - ' .UseProfile(''prod'') //if available loads the prod environment (.env.prod)' + sLineBreak + - ' .UseLogger(procedure(LogItem: String)' + sLineBreak + - ' begin' + sLineBreak + - ' LogD(''dotEnv: '' + LogItem);' + sLineBreak + - ' end)' + sLineBreak + - ' .Build(); //uses the executable folder to look for .env* files' + sLineBreak + - ' end);' + sLineBreak + - '' + sLineBreak + - ' WebRequestHandlerProc.MaxConnections := dotEnv.Env(''dmvc.handler.max_connections'', 1024);' + sLineBreak + - '' + sLineBreak + - '' + sLineBreak + - '{$IF CompilerVersion >= 34}' + sLineBreak + - ' if dotEnv.Env(''dmvc.profiler.enabled'', false) then' + sLineBreak + - ' begin' + sLineBreak + - ' Profiler.ProfileLogger := Log;' + sLineBreak + - ' Profiler.WarningThreshold := dotEnv.Env(''dmvc.profiler.warning_threshold'', 2000);' + sLineBreak + - ' end;' + sLineBreak + - '{$ENDIF}' + sLineBreak + - '' + sLineBreak + - ' RunServer(dotEnv.Env(''dmvc.server.port'', %1:d));' + sLineBreak + - ' except' + sLineBreak + - ' on E: Exception do' + sLineBreak + - ' LogF(E.ClassName + '': '' + E.Message);' + sLineBreak + - ' end;' + sLineBreak + - 'end.' + sLineBreak; - - // 0 - Unit Name - // 1 - Class Name - // 2 - Sample Methods - Interface - // 3 - Sample Methods - Implementation - // 4 - Action Filters - Interface - // 5 - Action Filters - Implementation - // 8 - BO - Interface - // 9 - BO - Implementation - - sControllerUnit = 'unit %0:s;' + sLineBreak + - sLineBreak + - 'interface' + sLineBreak + - sLineBreak + - 'uses' + sLineBreak + - ' MVCFramework, MVCFramework.Commons, MVCFramework.Serializer.Commons, System.Generics.Collections;' + sLineBreak + - sLineBreak + - 'type' + sLineBreak + - '%8:s' + sLineBreak + - ' [MVCPath(''/api'')]' + sLineBreak + - ' %1:s = class(TMVCController) ' + sLineBreak + - ' public' + sLineBreak + - '%2:s' + - '%4:s' + - '%6:s' + - ' end;' + sLineBreak + - sLineBreak + - 'implementation' + sLineBreak + sLineBreak + - 'uses' + sLineBreak + - ' System.SysUtils, MVCFramework.Logger, System.StrUtils;' + sLineBreak + - sLineBreak + - '%3:s' + sLineBreak + - '%5:s' + sLineBreak + - '%7:s' + sLineBreak + - sLineBreak + - '%9:s' + sLineBreak + - 'end.' + sLineBreak; - - sIndexMethodIntf = - ' [MVCPath]' + sLineBreak + - ' [MVCHTTPMethod([httpGET])]' + sLineBreak + - ' function Index: String;' + sLineBreak + sLineBreak + - ' [MVCPath(''/reversedstrings/($Value)'')]' + sLineBreak + - ' [MVCHTTPMethod([httpGET])]' + sLineBreak + - ' [MVCProduces(TMVCMediaType.TEXT_PLAIN)]' + sLineBreak + - ' function GetReversedString(const Value: String): String;' + sLineBreak; - - // 0 - Class Name - sIndexMethodImpl = - 'function %0:s.Index: String;' + sLineBreak + - 'begin' + sLineBreak + - ' //use Context property to access to the HTTP request and response ' + sLineBreak + - ' Result := ''Hello DelphiMVCFramework World'';' + sLineBreak + - 'end;' + sLineBreak + sLineBreak + - 'function %0:s.GetReversedString(const Value: String): String;' + sLineBreak + - 'begin' + sLineBreak + - ' Result := System.StrUtils.ReverseString(Value.Trim);' + sLineBreak + - 'end;' + sLineBreak; - - sCRUDMethodsIntf = - sLineBreak + - ' public' + sLineBreak + - ' //Sample CRUD Actions for a "People" entity' + sLineBreak + - ' [MVCPath(''/people'')]' + sLineBreak + - ' [MVCHTTPMethod([httpGET])]' + sLineBreak + - ' function GetPeople: TObjectList;' + sLineBreak + sLineBreak + - ' [MVCPath(''/people/($ID)'')]' + sLineBreak + - ' [MVCHTTPMethod([httpGET])]' + sLineBreak + - ' function GetPerson(ID: Integer): TPerson;' + sLineBreak + sLineBreak + - ' [MVCPath(''/people'')]' + sLineBreak + - ' [MVCHTTPMethod([httpPOST])]' + sLineBreak + - ' function CreatePerson([MVCFromBody] Person: TPerson): IMVCResponse;' + sLineBreak + sLineBreak + - ' [MVCPath(''/people/($ID)'')]' + sLineBreak + - ' [MVCHTTPMethod([httpPUT])]' + sLineBreak + - ' function UpdatePerson(ID: Integer; [MVCFromBody] Person: TPerson): IMVCResponse;' + sLineBreak + sLineBreak + - ' [MVCPath(''/people/($ID)'')]' + sLineBreak + - ' [MVCHTTPMethod([httpDELETE])]' + sLineBreak + - ' function DeletePerson(ID: Integer): IMVCResponse;' + sLineBreak + sLineBreak; - - sCRUDMethodsImpl = - '//Sample CRUD Actions for a "People" entity' + sLineBreak + - 'function %0:s.GetPeople: TObjectList;' + sLineBreak + - 'var' + sLineBreak + - ' lPeople: TObjectList;' + sLineBreak + - 'begin' + sLineBreak + - ' lPeople := TObjectList.Create(True);' + sLineBreak + - ' try' + sLineBreak + - ' lPeople.Add(TPerson.Create(''Peter'',''Parker'', EncodeDate(1965, 10, 4)));' + sLineBreak + - ' lPeople.Add(TPerson.Create(''Bruce'',''Banner'', EncodeDate(1945, 9, 6)));' + sLineBreak + - ' lPeople.Add(TPerson.Create(''Reed'',''Richards'', EncodeDate(1955, 3, 7)));' + sLineBreak + - ' Result := lPeople;' + sLineBreak + - ' except' + sLineBreak + - ' lPeople.Free;' + sLineBreak + - ' raise;' + sLineBreak + - ' end;' + sLineBreak + - 'end;' + sLineBreak + sLineBreak + - 'function %0:s.GetPerson(ID: Integer): TPerson;' + sLineBreak + - 'var' + sLineBreak + - ' lPeople: TObjectList;' + sLineBreak + - 'begin' + sLineBreak + - ' lPeople := GetPeople;' + sLineBreak + - ' try' + sLineBreak + - ' Result := lPeople.ExtractAt(ID mod lPeople.Count);' + sLineBreak + - ' finally' + sLineBreak + - ' lPeople.Free;' + sLineBreak + - ' end;' + sLineBreak + - 'end;' + sLineBreak + sLineBreak + - 'function %0:s.CreatePerson([MVCFromBody] Person: TPerson): IMVCResponse;' + sLineBreak + - 'begin' + sLineBreak + - ' LogI(''Created '' + Person.FirstName + '' '' + Person.LastName);' + sLineBreak + - ' Result := MVCResponseBuilder' + sLineBreak + - ' .StatusCode(HTTP_STATUS.Created)' + sLineBreak + - ' .Body(''Person created'')' + sLineBreak + - ' .Build;' + sLineBreak + - 'end;' + sLineBreak + sLineBreak + - 'function %0:s.UpdatePerson(ID: Integer; [MVCFromBody] Person: TPerson): IMVCResponse;' + sLineBreak + - 'begin' + sLineBreak + - ' LogI(''Updated '' + Person.FirstName + '' '' + Person.LastName);' + sLineBreak + - ' Result := MVCResponseBuilder' + sLineBreak + - ' .StatusCode(HTTP_STATUS.NoContent)' + sLineBreak + - ' .Build;' + sLineBreak + - 'end;' + sLineBreak + sLineBreak + - 'function %0:s.DeletePerson(ID: Integer): IMVCResponse;' + sLineBreak + - 'begin' + sLineBreak + - ' LogI(''Deleted person with id '' + ID.ToString);' + sLineBreak + - ' Result := MVCResponseBuilder' + sLineBreak + - ' .StatusCode(HTTP_STATUS.NoContent)' + sLineBreak + - ' .Build;' + sLineBreak + - 'end;' + sLineBreak; - - sActionFiltersIntf = - ' protected' + sLineBreak + - ' procedure OnBeforeAction(Context: TWebContext; const AActionName: string; var Handled: Boolean); override;' - + sLineBreak + - ' procedure OnAfterAction(Context: TWebContext; const AActionName: string); override;' + - sLineBreak; - - sActionFiltersImpl = - 'procedure %0:s.OnAfterAction(Context: TWebContext; const AActionName: string); ' + sLineBreak + - 'begin' + sLineBreak + - ' { Executed after each action }' + sLineBreak + - ' inherited;' + sLineBreak + - 'end;' + sLineBreak + - sLineBreak + - 'procedure %0:s.OnBeforeAction(Context: TWebContext; const AActionName: string; var Handled: Boolean);' - + sLineBreak + - 'begin' + sLineBreak + - ' { Executed before each action' + sLineBreak + - ' if handled is true (or an exception is raised) the actual' + sLineBreak + - ' action will not be called }' + sLineBreak + - ' inherited;' + sLineBreak + - 'end;' + sLineBreak; - - sBOClassesIntf = - ' [MVCNameCase(ncCamelCase)]' + sLineBreak + - ' TPerson = class' + sLineBreak + - ' private' + sLineBreak + - ' fFirstName: String;' + sLineBreak + - ' fLastName: String;' + sLineBreak + - ' fDOB: TDate;' + sLineBreak + - ' public' + sLineBreak + - ' property FirstName: String read fFirstName write fFirstName;' + sLineBreak + - ' property LastName: String read fLastName write fLastName;' + sLineBreak + - ' property DOB: TDate read fDOB write fDOB; ' + sLineBreak + - ' constructor Create(FirstName, LastName: String; DOB: TDate);' + sLineBreak + - ' end;' + sLineBreak; - - sBOClassesImpl = - sLineBreak + - 'constructor %0:s.Create(FirstName, LastName: String; DOB: TDate);' + sLineBreak + - 'begin' + sLineBreak + - ' inherited Create;' + sLineBreak + - ' fFirstName := FirstName;' + sLineBreak + - ' fLastName := LastName;' + sLineBreak + - ' fDOB := DOB;' + sLineBreak + - 'end;' + sLineBreak; - - sDefaultControllerName = 'TMyController'; - sDefaultWebModuleName = 'TMyWebModule'; - sDefaultServerPort = '8080'; - - // 0 = unit name - // 1 = webmodule classname - // 2 = controller unit - // 3 - controller class name - // 4 - middlewares - // 5 - jsonrpc registration code - // 6 - jsonrpc class unit - sWebModuleUnit = - 'unit %0:s;' + sLineBreak + - '' + sLineBreak + - 'interface' + sLineBreak + - sLineBreak + - 'uses ' + sLineBreak + - ' System.SysUtils,' + sLineBreak + - ' System.Classes,' + sLineBreak + - ' Web.HTTPApp,' + sLineBreak + - ' MVCFramework;' + sLineBreak + - sLineBreak + - 'type' + sLineBreak + - ' %1:s = class(TWebModule)' + sLineBreak + - ' procedure WebModuleCreate(Sender: TObject);' + sLineBreak + - ' procedure WebModuleDestroy(Sender: TObject);' + sLineBreak + - ' private' + sLineBreak + - ' FMVC: TMVCEngine;' + sLineBreak + - ' public' + sLineBreak + - ' { Public declarations }' + sLineBreak + - ' end;' + sLineBreak + - sLineBreak + - 'var' + sLineBreak + - ' WebModuleClass: TComponentClass = %1:s;' + sLineBreak + - sLineBreak + - 'implementation' + sLineBreak + - sLineBreak + - '{$R *.dfm}' + sLineBreak + - sLineBreak + - 'uses ' + sLineBreak + - ' %2:s, ' + sLineBreak + - ' %6:s ' + sLineBreak + - ' System.IOUtils, ' + sLineBreak + - ' MVCFramework.Commons, ' + sLineBreak + - ' MVCFramework.Middleware.ActiveRecord, ' + sLineBreak + - ' MVCFramework.Middleware.StaticFiles, ' + sLineBreak + - ' MVCFramework.Middleware.Analytics, ' + sLineBreak + - ' MVCFramework.Middleware.Trace, ' + sLineBreak + - ' MVCFramework.Middleware.CORS, ' + sLineBreak + - ' MVCFramework.Middleware.ETag, ' + sLineBreak + - ' MVCFramework.Middleware.Compression;' + sLineBreak + - sLineBreak + - 'procedure %1:s.WebModuleCreate(Sender: TObject);' + sLineBreak + - 'begin' + sLineBreak + - ' FMVC := TMVCEngine.Create(Self,' + sLineBreak + - ' procedure(Config: TMVCConfig)' + sLineBreak + - ' begin' + sLineBreak + - ' Config.dotEnv := dotEnv; ' + sLineBreak + - ' // session timeout (0 means session cookie)' + sLineBreak + - ' Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env(''dmvc.session_timeout'', ''0'');' + sLineBreak + - ' //default content-type' + sLineBreak + - ' Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env(''dmvc.default.content_type'', TMVCConstants.DEFAULT_CONTENT_TYPE);' + - sLineBreak + - ' //default content charset' + sLineBreak + - ' Config[TMVCConfigKey.DefaultContentCharset] := dotEnv.Env(''dmvc.default.content_charset'', TMVCConstants.DEFAULT_CONTENT_CHARSET);' + - sLineBreak + - ' //unhandled actions are permitted?' + sLineBreak + - ' Config[TMVCConfigKey.AllowUnhandledAction] := dotEnv.Env(''dmvc.allow_unhandled_actions'', ''false'');' + sLineBreak + - ' //enables or not system controllers loading (available only from localhost requests)' + sLineBreak + - ' Config[TMVCConfigKey.LoadSystemControllers] := dotEnv.Env(''dmvc.load_system_controllers'', ''true'');' + sLineBreak + - ' //default view file extension' + sLineBreak + - ' Config[TMVCConfigKey.DefaultViewFileExtension] := dotEnv.Env(''dmvc.default.view_file_extension'', ''html'');' + sLineBreak + - ' //view path' + sLineBreak + - ' Config[TMVCConfigKey.ViewPath] := dotEnv.Env(''dmvc.view_path'', ''templates'');' + sLineBreak + - ' //use cache for server side views (use "false" in debug and "true" in production for faster performances' + sLineBreak + - ' Config[TMVCConfigKey.ViewCache] := dotEnv.Env(''dmvc.view_cache'', ''false'');' + sLineBreak + - ' //Max Record Count for automatic Entities CRUD' + sLineBreak + - ' Config[TMVCConfigKey.MaxEntitiesRecordCount] := dotEnv.Env(''dmvc.max_entities_record_count'', IntToStr(TMVCConstants.MAX_RECORD_COUNT));' + sLineBreak + - ' //Enable Server Signature in response' + sLineBreak + - ' Config[TMVCConfigKey.ExposeServerSignature] := dotEnv.Env(''dmvc.expose_server_signature'', ''false'');' + sLineBreak + - ' //Enable X-Powered-By Header in response' + sLineBreak + - ' Config[TMVCConfigKey.ExposeXPoweredBy] := dotEnv.Env(''dmvc.expose_x_powered_by'', ''true'');' + sLineBreak + - ' // Max request size in bytes' + sLineBreak + - ' Config[TMVCConfigKey.MaxRequestSize] := dotEnv.Env(''dmvc.max_request_size'', IntToStr(TMVCConstants.DEFAULT_MAX_REQUEST_SIZE));' + sLineBreak + - ' end);' + sLineBreak + - ' FMVC.AddController(%3:s);' + sLineBreak + sLineBreak + - ' %4:s ' + sLineBreak + - ' %5:s ' + sLineBreak + - ' ' + sLineBreak + - ' {' + sLineBreak + - ' FMVC.OnWebContextCreate( ' + sLineBreak + - ' procedure(const Context: TWebContext) ' + sLineBreak + - ' begin ' + sLineBreak + - ' // Initialize services to make them accessibile from Context ' + sLineBreak + - ' // Context.CustomIntfObject := TMyService.Create; ' + sLineBreak + - ' end); ' + sLineBreak + - ' ' + sLineBreak + - ' FMVC.OnWebContextDestroy(' + sLineBreak + - ' procedure(const Context: TWebContext)' + sLineBreak + - ' begin' + sLineBreak + - ' //Cleanup services, if needed' + sLineBreak + - ' end);' + sLineBreak + - ' }' + sLineBreak + - 'end;' + sLineBreak + - sLineBreak + - 'procedure %1:s.WebModuleDestroy(Sender: TObject);' + sLineBreak + - 'begin' + sLineBreak + - ' FMVC.Free;' + sLineBreak + - 'end;' + sLineBreak + - sLineBreak + - 'end.' + sLineBreak; - - sWebModuleDFM = - 'object %0:s: %1:s' + sLineBreak + - ' OldCreateOrder = False' + sLineBreak + - ' OnCreate = WebModuleCreate' + sLineBreak + - ' OnDestroy = WebModuleDestroy' + sLineBreak + - ' Height = 230' + sLineBreak + - ' Width = 415' + sLineBreak + - 'end'; - - - //0 - unit name - //1 - class name - sJSONRPCUnit = - 'unit %0:s; ' + sLineBreak + sLineBreak + - 'interface' + sLineBreak + sLineBreak + - 'type ' + sLineBreak + - ' %1:s = class' + sLineBreak + - ' public' + sLineBreak + - ' function ReverseString(const Value: String): String;' + sLineBreak + - ' end;' + sLineBreak + sLineBreak + - 'implementation' + sLineBreak + sLineBreak + - 'uses System.StrUtils;' + sLineBreak + sLineBreak + - 'function %1:s.ReverseString(const Value: String): String;' + sLineBreak + - 'begin' + sLineBreak + - ' Result := System.StrUtils.ReverseString(Value);' + sLineBreak + - 'end;' + sLineBreak + sLineBreak + - 'end.' + sLineBreak; - -implementation - -end. diff --git a/ideexpert/DMVC.Expert.Commands.Templates.pas b/ideexpert/DMVC.Expert.Commands.Templates.pas index b14ae178..0b235ccb 100644 --- a/ideexpert/DMVC.Expert.Commands.Templates.pas +++ b/ideexpert/DMVC.Expert.Commands.Templates.pas @@ -1,3 +1,27 @@ +// *************************************************************************** +// +// Delphi MVC Framework +// +// Copyright (c) 2010-2024 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 DMVC.Expert.Commands.Templates; interface diff --git a/ideexpert/DMVC.Expert.Commons.pas b/ideexpert/DMVC.Expert.Commons.pas index b5a8ff00..fb1eba43 100644 --- a/ideexpert/DMVC.Expert.Commons.pas +++ b/ideexpert/DMVC.Expert.Commons.pas @@ -1,3 +1,27 @@ +// *************************************************************************** +// +// Delphi MVC Framework +// +// Copyright (c) 2010-2024 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 DMVC.Expert.Commons; interface @@ -20,6 +44,13 @@ type procedure ExecuteImplementation(Section: TStringBuilder; Model: TJSONObject); virtual; abstract; end; + TDefaultValues = class sealed + public + const sDefaultControllerName = 'TMyController'; + const sDefaultWebModuleName = 'TMyWebModule'; + const sDefaultServerPort = '8080'; + end; + TConfigKey = class sealed public const program_name = 'program.name'; diff --git a/ideexpert/DMVC.Expert.Forms.NewProjectWizard.pas b/ideexpert/DMVC.Expert.Forms.NewProjectWizard.pas index 3275efe2..45eba39d 100644 --- a/ideexpert/DMVC.Expert.Forms.NewProjectWizard.pas +++ b/ideexpert/DMVC.Expert.Forms.NewProjectWizard.pas @@ -145,7 +145,6 @@ var implementation uses - DMVC.Expert.CodeGen.Templates, MVCFramework.Commons, System.StrUtils, DMVC.Expert.Commons; @@ -178,9 +177,9 @@ end; procedure TfrmDMVCNewProject.FormCreate(Sender: TObject); begin - edtControllerClassName.TextHint := sDefaultControllerName; - edtWebModuleName.TextHint := sDefaultWebModuleName; - edtServerPort.TextHint := sDefaultServerPort; + edtControllerClassName.TextHint := TDefaultValues.sDefaultControllerName; + edtWebModuleName.TextHint := TDefaultValues.sDefaultWebModuleName; + edtServerPort.TextHint := TDefaultValues.sDefaultServerPort; lblFrameworkVersion.Caption := 'dmvcframework-' + DMVCFRAMEWORK_VERSION; chkJSONRPC.Checked := False; lblCopyRight.Caption := TMVCConstants.COPYRIGHT; @@ -273,7 +272,7 @@ function TfrmDMVCNewProject.GetServerPort: Integer; var lServerPort: Integer; begin - Result := StrToInt(sDefaultServerPort); + Result := StrToInt(TDefaultValues.sDefaultServerPort); if (Trim(edtServerPort.Text) <> '') and TryStrToInt(edtServerPort.Text, lServerPort) then begin @@ -291,7 +290,7 @@ function TfrmDMVCNewProject.GetWebModuleClassName: string; begin if Trim(edtWebModuleName.Text) = '' then begin - Result := sDefaultWebModuleName + Result := TDefaultValues.sDefaultWebModuleName end else begin @@ -397,7 +396,7 @@ function TfrmDMVCNewProject.GetControllerClassName: string; begin if Trim(edtControllerClassName.Text) = '' then begin - Result := sDefaultControllerName + Result := TDefaultValues.sDefaultControllerName end else begin diff --git a/ideexpert/DMVC.Expert.Forms.NewUnitWizard.pas b/ideexpert/DMVC.Expert.Forms.NewUnitWizard.pas index 6583c486..e65e359b 100644 --- a/ideexpert/DMVC.Expert.Forms.NewUnitWizard.pas +++ b/ideexpert/DMVC.Expert.Forms.NewUnitWizard.pas @@ -82,13 +82,13 @@ var implementation uses - DMVC.Expert.CodeGen.Templates, DMVC.Expert.Commons; + DMVC.Expert.Commons; {$R *.dfm} procedure TfrmDMVCNewUnit.FormCreate(Sender: TObject); begin - edtClassName.TextHint := sDefaultControllerName; + edtClassName.TextHint := TDefaultValues.sDefaultControllerName; fModel := TJsonObject.Create; end; @@ -135,7 +135,7 @@ function TfrmDMVCNewUnit.GetControllerClassName: string; begin if Trim(edtClassName.Text) = '' then begin - Result := sDefaultControllerName + Result := TDefaultValues.sDefaultControllerName end else begin diff --git a/ideexpert/DMVC.Expert.NewUnitWizardEx.pas b/ideexpert/DMVC.Expert.NewUnitWizardEx.pas index bfc6edee..93a45422 100644 --- a/ideexpert/DMVC.Expert.NewUnitWizardEx.pas +++ b/ideexpert/DMVC.Expert.NewUnitWizardEx.pas @@ -82,13 +82,7 @@ begin ModuleServices := (BorlandIDEServices as IOTAModuleServices); Project := GetActiveProject; ControllerUnit := ModuleServices.CreateModule( - TNewControllerUnitEx.Create( - lJSON, - WizardForm.CreateIndexMethod, - WizardForm.CreateCRUDMethods, - WizardForm.CreateActionFiltersMethods, - WizardForm.ControllerClassName, - APersonality)); + TNewControllerUnitEx.Create(lJSON, APersonality)); if Project <> nil then begin Project.AddFile(ControllerUnit.FileName, true); diff --git a/ideexpert/DMVC.Expert.ProjectWizardEx.pas b/ideexpert/DMVC.Expert.ProjectWizardEx.pas index 06586bb1..8a934db9 100644 --- a/ideexpert/DMVC.Expert.ProjectWizardEx.pas +++ b/ideexpert/DMVC.Expert.ProjectWizardEx.pas @@ -112,8 +112,6 @@ begin // Create Project Source lProjectSourceCreator := TDMVCProjectFile.Create(APersonality, lJSON); - TDMVCProjectFile(lProjectSourceCreator).DefaultPort := WizardForm.ServerPort; - TDMVCProjectFile(lProjectSourceCreator).UseMSHeapOnWindows := WizardForm.UseMSHeapOnWindows; ModuleServices.CreateModule(lProjectSourceCreator); Project := GetActiveProject; @@ -123,13 +121,7 @@ begin // Create Controller Unit if WizardForm.CreateControllerUnit then begin - ControllerCreator := TNewControllerUnitEx.Create( - lJSON, - WizardForm.CreateIndexMethod, - WizardForm.CreateCRUDMethods, - WizardForm.CreateActionFiltersMethods, - WizardForm.ControllerClassName, - APersonality); + ControllerCreator := TNewControllerUnitEx.Create(lJSON, APersonality); ControllerUnit := ModuleServices.CreateModule(ControllerCreator); if Project <> nil then begin @@ -143,11 +135,9 @@ begin begin JSONRPCUnitCreator := TNewJSONRPCUnitEx.Create( lJSON, - //WizardForm.JSONRPCClassName, APersonality); JSONRPCUnit := ModuleServices.CreateModule(JSONRPCUnitCreator); lJSONRPCUnitName := GetUnitName(JSONRPCUnit.FileName); - //lJSON.S[TConfigKey.jsonrpc_unit_name] := lJSONRPCUnitName; if Project <> nil then begin Project.AddFile(JSONRPCUnit.FileName, True); @@ -157,12 +147,14 @@ begin // Create Webmodule Unit WebModuleCreator := TNewWebModuleUnitEx.Create( lJSON, + { WizardForm.WebModuleClassName, WizardForm.ControllerClassName, GetUnitName(ControllerUnit.FileName), WizardForm.Middlewares, WizardForm.JSONRPCClassName, lJSONRPCUnitName, + } APersonality); WebModuleUnit := ModuleServices.CreateModule(WebModuleCreator); if Project <> nil then diff --git a/packages/d120/dmvcframeworkDT.dpk b/packages/d120/dmvcframeworkDT.dpk index f637eac4..67f513b7 100644 --- a/packages/d120/dmvcframeworkDT.dpk +++ b/packages/d120/dmvcframeworkDT.dpk @@ -47,7 +47,6 @@ contains DMVC.Expert.CodeGen.NewUnit in '..\..\ideexpert\DMVC.Expert.CodeGen.NewUnit.pas', DMVC.Expert.CodeGen.NewWebModuleUnit in '..\..\ideexpert\DMVC.Expert.CodeGen.NewWebModuleUnit.pas', DMVC.Expert.CodeGen.SourceFile in '..\..\ideexpert\DMVC.Expert.CodeGen.SourceFile.pas', - DMVC.Expert.CodeGen.Templates in '..\..\ideexpert\DMVC.Expert.CodeGen.Templates.pas', DMVC.Expert.Forms.NewProjectWizard in '..\..\ideexpert\DMVC.Expert.Forms.NewProjectWizard.pas' {frmDMVCNewProject}, DMVC.Expert.Forms.NewUnitWizard in '..\..\ideexpert\DMVC.Expert.Forms.NewUnitWizard.pas' {frmDMVCNewUnit}, DMVC.Expert.NewUnitWizardEx in '..\..\ideexpert\DMVC.Expert.NewUnitWizardEx.pas', diff --git a/packages/d120/dmvcframeworkDT.dproj b/packages/d120/dmvcframeworkDT.dproj index 2077149b..9a1a003d 100644 --- a/packages/d120/dmvcframeworkDT.dproj +++ b/packages/d120/dmvcframeworkDT.dproj @@ -131,7 +131,6 @@ -
frmDMVCNewProject