Due to the current implementation pattern of the TCollection
type in Delphi, it was not possible to implement directly this kind of
parameter.
In fact, the TCollection constructor is defined as such:
constructor Create(ItemClass: TCollectionItemClass);
And, on the server side, we do not know which kind of
TCollectionItemClass is to be passed. Therefore, the
TServiceFactoryServer is unable to properly instantiate the object
instances, supplying the expected item class.
The framework propose two potential solutions:
- You can let your collection class inherit from the new
TInterfaceCollectiontype; - You can call the
TJSONSerializer.RegisterCollectionForJSON()method to register the collection type and its associated item class.
First solution has already
been detailed in this blog.
We will now describe the second (and new) way.
