You are not logged in.
Pages: 1
Hallo!
I'm just taking my first steps with generics (Delphi XE). My question: Can generic versions
of RetrieveListObjArray be included?
function TSQLRest.RetrieveListObjArray<T>(const aCustomFieldsCSV: RawUTF8): TArray<T>;
function TSQLRest.RetrieveListObjArray<T>(const FormatSQLWhere: RawUTF8;
const BoundsSQLWhere: array of const; const aCustomFieldsCSV: RawUTF8): TArray<T>;
With best regards
Thomas
Offline
I am not sure that TArray<T> will completely work as expected with the serialization/registration mechanism.
For instance, I doubt that TypeInfo(TArray<TMyObject>) would match TypeInfo(TMyObjectObjArray) with TMyObjectObjArray = array of TMyObject as we expect...
Offline
Hallo!
Sorry, I'm no help at generics. I started testing with Spring4D.
The following works for me.
type
TSQLMyObject = class(TSQLCustomRecord)
...
end;
TSQLMyObjectList = class(Spring.Collections.Lists.TObjectList<TSQLMyObject>);
FDataList: Spring.Collections.IList<TSQLMyObject>;
procedure LoadMyObjects;
var
tmpArr: TArray<TSQLMyObject>;
begin
Client.RetrieveListObjArray(tmpArr, TSQLMyObject, 'ObjectID = ?', [0]);
FDataList := TSQLMyObjectList.Create(tmpArr);
...
end;
With best regards
Offline
Pages: 1