mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
Improved Wizard (commeneted code to show how to use context events)
This commit is contained in:
parent
886f8b8f9b
commit
487cf8ec8b
@ -218,6 +218,8 @@ Congratulations to Daniele Teti and all the staff for the excellent work!" -- Ma
|
|||||||
|
|
||||||
- ⚡ Support for Delphi 11.3 Alexandria
|
- ⚡ Support for Delphi 11.3 Alexandria
|
||||||
- ⚡ Ability to use records in swagger param and response attributes [Issue 649](https://github.com/danieleteti/delphimvcframework/issues/649)
|
- ⚡ Ability to use records in swagger param and response attributes [Issue 649](https://github.com/danieleteti/delphimvcframework/issues/649)
|
||||||
|
- ⚡ Improved Wizard - now it produces commented code to show how to use `ContextEvents`
|
||||||
|
- ⚡ Improved compatibility with Delphi 10.2 Tokyo and older versions (Thanks Mark Lobanov)
|
||||||
- 🐞 FIX [Issue 648](https://github.com/danieleteti/delphimvcframework/issues/648) Thanks to [sf-spb](https://github.com/sf-spb)
|
- 🐞 FIX [Issue 648](https://github.com/danieleteti/delphimvcframework/issues/648) Thanks to [sf-spb](https://github.com/sf-spb)
|
||||||
|
|
||||||
## What's New in dmvcframework-3.2.3-radium
|
## What's New in dmvcframework-3.2.3-radium
|
||||||
|
@ -308,18 +308,31 @@ resourcestring
|
|||||||
' Config[TMVCConfigKey.ViewPath] := ''templates'';' + sLineBreak +
|
' Config[TMVCConfigKey.ViewPath] := ''templates'';' + sLineBreak +
|
||||||
' //Max Record Count for automatic Entities CRUD' + sLineBreak +
|
' //Max Record Count for automatic Entities CRUD' + sLineBreak +
|
||||||
' Config[TMVCConfigKey.MaxEntitiesRecordCount] := ''20'';' + sLineBreak +
|
' Config[TMVCConfigKey.MaxEntitiesRecordCount] := ''20'';' + sLineBreak +
|
||||||
' //Enable Server Signature in response' + sLineBreak +
|
' //Enable Server Signature in response' + sLineBreak +
|
||||||
' Config[TMVCConfigKey.ExposeServerSignature] := ''true'';' + sLineBreak +
|
' Config[TMVCConfigKey.ExposeServerSignature] := ''true'';' + sLineBreak +
|
||||||
' //Enable X-Powered-By Header in response' + sLineBreak +
|
' //Enable X-Powered-By Header in response' + sLineBreak +
|
||||||
' Config[TMVCConfigKey.ExposeXPoweredBy] := ''true'';' + sLineBreak +
|
' Config[TMVCConfigKey.ExposeXPoweredBy] := ''true'';' + sLineBreak +
|
||||||
// ' // Define a default URL for requests that don''t map to a route or a file (useful for client side web app)' + sLineBreak +
|
|
||||||
// ' Config[TMVCConfigKey.FallbackResource] := ''index.html'';' + sLineBreak +
|
|
||||||
' // Max request size in bytes' + sLineBreak +
|
' // Max request size in bytes' + sLineBreak +
|
||||||
' Config[TMVCConfigKey.MaxRequestSize] := IntToStr(TMVCConstants.DEFAULT_MAX_REQUEST_SIZE);' + sLineBreak +
|
' Config[TMVCConfigKey.MaxRequestSize] := IntToStr(TMVCConstants.DEFAULT_MAX_REQUEST_SIZE);' + sLineBreak +
|
||||||
' end);' + sLineBreak +
|
' end);' + sLineBreak +
|
||||||
' FMVC.AddController(%3:s);' + sLineBreak + sLineBreak +
|
' FMVC.AddController(%3:s);' + sLineBreak + sLineBreak +
|
||||||
' %4:s ' + sLineBreak +
|
' %4:s ' + sLineBreak +
|
||||||
' %5: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 +
|
'end;' + sLineBreak +
|
||||||
sLineBreak +
|
sLineBreak +
|
||||||
'procedure %1:s.WebModuleDestroy(Sender: TObject);' + sLineBreak +
|
'procedure %1:s.WebModuleDestroy(Sender: TObject);' + sLineBreak +
|
||||||
|
@ -347,8 +347,10 @@ uses
|
|||||||
Json.Schema.Field.Booleans;
|
Json.Schema.Field.Booleans;
|
||||||
|
|
||||||
function GetRecordType(const aQualifiedName: String): TRttiType;
|
function GetRecordType(const aQualifiedName: String): TRttiType;
|
||||||
|
var
|
||||||
|
lContext: TRttiContext;
|
||||||
begin
|
begin
|
||||||
var lContext := TRttiContext.Create;
|
lContext := TRttiContext.Create;
|
||||||
try
|
try
|
||||||
result := lContext.FindType(aQualifiedName);
|
result := lContext.FindType(aQualifiedName);
|
||||||
finally
|
finally
|
||||||
@ -705,7 +707,6 @@ var
|
|||||||
lEnumMappedValues: TList<string>;
|
lEnumMappedValues: TList<string>;
|
||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
var lContext := TRttiContext.Create;
|
|
||||||
for lField in aRttiType.GetFields do
|
for lField in aRttiType.GetFields do
|
||||||
begin
|
begin
|
||||||
lSkipProp := False;
|
lSkipProp := False;
|
||||||
@ -823,7 +824,9 @@ begin
|
|||||||
lJsonField.Required := lFieldSchemaDef.Required;
|
lJsonField.Required := lFieldSchemaDef.Required;
|
||||||
lJsonField.Nullable := lFieldSchemaDef.Nullable;
|
lJsonField.Nullable := lFieldSchemaDef.Nullable;
|
||||||
if not lFieldSchemaDef.Description.IsEmpty then
|
if not lFieldSchemaDef.Description.IsEmpty then
|
||||||
|
begin
|
||||||
TJsonFieldInteger(lJsonField).Description := lFieldSchemaDef.Description;
|
TJsonFieldInteger(lJsonField).Description := lFieldSchemaDef.Description;
|
||||||
|
end;
|
||||||
|
|
||||||
aJsonFieldRoot.AddField(lJsonField);
|
aJsonFieldRoot.AddField(lJsonField);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user