mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
This commit is contained in:
parent
f5f9220f70
commit
f21bb1144b
41
README.md
41
README.md
@ -243,13 +243,52 @@ Congratulations to Daniele Teti and all the staff for the excellent work!" -- Ma
|
|||||||
|
|
||||||
- 🐞 FIX [Issue 680](https://github.com/danieleteti/delphimvcframework/issues/680)
|
- 🐞 FIX [Issue 680](https://github.com/danieleteti/delphimvcframework/issues/680)
|
||||||
|
|
||||||
|
- 🐞 FIX [Issue 682](https://github.com/danieleteti/delphimvcframework/issues/682) (Thanks to [wuhao13](https://github.com/wuhao13))
|
||||||
|
|
||||||
- 🐞 FIX Wrong comparison in checks for ro/RW/PK fields in `TMVCActiveRecord`
|
- 🐞 FIX Wrong comparison in checks for ro/RW/PK fields in `TMVCActiveRecord`
|
||||||
|
|
||||||
- 🐞 FIX wrong default initialization for JWT (thanks to Flavio Basile)
|
- 🐞 FIX wrong default initialization for JWT (thanks to Flavio Basile)
|
||||||
|
|
||||||
- ⚡ Wizard updated to be dotEnv aware
|
- ⚡ Wizard updated to be dotEnv aware
|
||||||
|
|
||||||
- ⚡ Added "Load Style" methods to `TMVCActiveRecord` as suggested by https://github.com/danieleteti/delphimvcframework/issues/675
|
- ⚡ Added "Load Style" methods to `TMVCActiveRecord` (more info https://github.com/danieleteti/delphimvcframework/issues/675)
|
||||||
|
|
||||||
|
- `TMVCActiveRecord` support "Factory Style" and "Load Style" methods when loads data from database.
|
||||||
|
|
||||||
|
Using "Factory Style" methods (available from the first version) the result list is returned by the loader method (as shown in this piece of code from the `activerecord_showcase` sample).
|
||||||
|
|
||||||
|
```delphi
|
||||||
|
Log('>> RQL Query (2) - ' + cRQL2);
|
||||||
|
lCustList := TMVCActiveRecord.SelectRQL<TCustomer>(cRQL2, 20);
|
||||||
|
try
|
||||||
|
Log(lCustList.Count.ToString + ' record/s found');
|
||||||
|
for lCustomer in lCustList do
|
||||||
|
begin
|
||||||
|
Log(Format('%5s - %s (%s)', [lCustomer.Code.ValueOrDefault,
|
||||||
|
lCustomer.CompanyName.ValueOrDefault, lCustomer.City]));
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
lCustList.Free;
|
||||||
|
end;
|
||||||
|
```
|
||||||
|
|
||||||
|
For some scenarios would be useful to have also "Load Style" methods where the list is filled by the loader method (not instantiated internally).
|
||||||
|
|
||||||
|
```delphi
|
||||||
|
Log('>> RQL Query (2) - ' + cRQL2);
|
||||||
|
lCustList := TObjectList<TCustomer>.Create;
|
||||||
|
try
|
||||||
|
lRecCount := TMVCActiveRecord.SelectRQL<TCustomer>(cRQL2, 20, lCustList); //new in 3.4.0-neon
|
||||||
|
Log(lRecCount.ToString + ' record/s found');
|
||||||
|
for lCustomer in lCustList do
|
||||||
|
begin
|
||||||
|
Log(Format('%5s - %s (%s)', [lCustomer.Code.ValueOrDefault,
|
||||||
|
lCustomer.CompanyName.ValueOrDefault, lCustomer.City]));
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
lCustList.Free;
|
||||||
|
end;
|
||||||
|
```
|
||||||
|
|
||||||
- ⚡ Better error message in case of serialization of `TArray<TObject>`
|
- ⚡ Better error message in case of serialization of `TArray<TObject>`
|
||||||
|
|
||||||
|
@ -1617,7 +1617,6 @@ constructor TMVCActiveRecord.Create(aLazyLoadConnection: Boolean);
|
|||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
fConn := nil;
|
fConn := nil;
|
||||||
{ TODO -oDanieleT -cGeneral : Consider lazyconnection }
|
|
||||||
if not aLazyLoadConnection then
|
if not aLazyLoadConnection then
|
||||||
begin
|
begin
|
||||||
GetConnection;
|
GetConnection;
|
||||||
@ -3366,7 +3365,6 @@ end;
|
|||||||
|
|
||||||
class function TMVCActiveRecordHelper.All(const aQualifiedClassName: String): TObjectList<TMVCActiveRecord>;
|
class function TMVCActiveRecordHelper.All(const aQualifiedClassName: String): TObjectList<TMVCActiveRecord>;
|
||||||
var
|
var
|
||||||
lTmp: TObject;
|
|
||||||
lAR: TMVCActiveRecord;
|
lAR: TMVCActiveRecord;
|
||||||
begin
|
begin
|
||||||
lAR := TMVCActiveRecord.CreateMVCActiveRecord<TMVCActiveRecord>(aQualifiedClassName, []);
|
lAR := TMVCActiveRecord.CreateMVCActiveRecord<TMVCActiveRecord>(aQualifiedClassName, []);
|
||||||
|
@ -100,10 +100,6 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
|
||||||
WinAPI.Windows;
|
|
||||||
|
|
||||||
|
|
||||||
{ TObjectPool<T> }
|
{ TObjectPool<T> }
|
||||||
|
|
||||||
constructor TObjectPool<T>.Create(MaxSize: Integer; ShrinkTriggerSize, ShrinkTargetSize: Integer; const Factory: TFunc<T>);
|
constructor TObjectPool<T>.Create(MaxSize: Integer; ShrinkTriggerSize, ShrinkTargetSize: Integer; const Factory: TFunc<T>);
|
||||||
@ -243,7 +239,7 @@ begin
|
|||||||
fObjectPool.Lock;
|
fObjectPool.Lock;
|
||||||
try
|
try
|
||||||
fObjectPool.ShrinkPoolTo(fObjectPool.fShrinkTargetSize);
|
fObjectPool.ShrinkPoolTo(fObjectPool.fShrinkTargetSize);
|
||||||
ZeroMemory(@lAvgSize, SizeOf(lAvgSize));
|
FillChar(lAvgSize, SizeOf(lAvgSize), 0);
|
||||||
finally
|
finally
|
||||||
fObjectPool.UnLock;
|
fObjectPool.UnLock;
|
||||||
end;
|
end;
|
||||||
|
@ -757,14 +757,14 @@ end;
|
|||||||
|
|
||||||
class function TRttiUtils.CreateObject(AQualifiedClassName: string; const AParams: TArray<TValue> = nil): TObject;
|
class function TRttiUtils.CreateObject(AQualifiedClassName: string; const AParams: TArray<TValue> = nil): TObject;
|
||||||
var
|
var
|
||||||
rttitype: TRttiType;
|
lRTTIType: TRttiType;
|
||||||
begin
|
begin
|
||||||
rttitype := GlContext.FindType(AQualifiedClassName);
|
lRTTIType := GlContext.FindType(AQualifiedClassName);
|
||||||
if Assigned(rttitype) then
|
if Assigned(lRTTIType) then
|
||||||
Result := CreateObject(rttitype, AParams)
|
Result := CreateObject(lRTTIType, AParams)
|
||||||
else
|
else
|
||||||
raise Exception.Create('Cannot find RTTI for ' + AQualifiedClassName +
|
raise Exception.Create('Cannot find RTTI for ' + AQualifiedClassName +
|
||||||
'. Hint: Is the specified classtype linked in the module?');
|
'. HINT: Is the specified "QualifiedClassName" linked in the module?');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TRttiUtils.CreateObject(ARttiType: TRttiType; const AParams: TArray<TValue> = nil): TObject;
|
class function TRttiUtils.CreateObject(ARttiType: TRttiType; const AParams: TArray<TValue> = nil): TObject;
|
||||||
|
Loading…
Reference in New Issue
Block a user