How to have TROArray<T> in interface file?

In a code-first server the TROArray<T> was added. That makes coding much easier. How can we get the interface file that is generated by ServiceBuilder to have the same? I tried with and without the code first checkbox checked.

This is for generating code for a delphi client from a delphi server.

The server project was recently migrated to code first by using the Delphi IDE wizard.

Hi,

you can’t get TROArray<T> type in _Intf file because this type is generated as TROArray descendant for compatibility with old versions of Delphi.

The Code-First attributes can be generated in code if the Code-First Compatibility checkbox is checked. it will allow to use the same _Impl in RODL- and Code-First-based servers w/o modifying code.

Could we have the option to generate the file for newer versions of Delphi?

1 Like

Hi,

in general, it has no sense because TROArray and TROArray<T> do the same.
Also in _Intf you shouldn’t declare those arrays manually - codegen does it for you.

What we want is a base type that has the Items property and the Add method. All codegen arrays would descend from this class.

this is impossible with TROArray because these properties depend on his elements type.

function ListQuery<TROType; TROArrayType: uROArray.TROArray<TROType>>(const pQuery: String; const pOnResult: TQueryResult<TROType>): TROArrayType;

function TMyClass.ListQuery<TROType, TROArrayType>(const pQuery: String; const pOnResult: TQueryResult<TROType>): TROArrayType;
    begin
       result := TROArrayType.Create;
          while ..... do
            result.Add(TROType.Create);
    end;

This code works on the server. We want to use this same type of code on the client. Is that possible?

Thanks, logged as bugs://82269

bugs://82269 got closed with status fixed.

1 Like