Using TDynamicProperties in XData

We have some endpoints providing just parts of our entities also provided by CRUD endpoints.

For Example:
CRUD:

TEntity = class...
private
  FId: Integer;
  FName: string;
  FHiddenName: string;
  FProps: TDynamicProperties;
public
  property...
end;

XData:

TDataclass = class...
private
  FId: Integer;
  FName: string;
public
  property...
end;

this works realy fine.

In future, we also have to provide dynamic properties this way.
How could this easily be handled without defining TDataclass as Entity?

This is because apps using our api could define their own dynamic properties, and we will provide these as database-fields.

for example:
third party app inventory needs some fields like inventory date.
This app could define these using dynamic properties.

Another third party app planning needs other fields and will define this.

Customer a uses both apps, so he got all fields.
Customer b uses inventory app only, and so on.

I know, that this would be an issue with api-versioning, but at the end apps, that defines their own fields would like to easily access them and they really know, which fields they generated at all.

Btw. since you gave us the possibility to define associations in dynamic props we seperated these fields from our base entity-classes.
Meaning all these fields are stored in several tables mapped to our defined table.

Using CRUD Endpoints this all works fine, but it would be nice providing these fields in our defined XData interfaces.

Maybe this will help you understand, why we would need this.

Dynamic properties is an Aurelius feature, not XData.

Currently one way to achieve what you want is exactly use Aurelius entities as your TDataClass. Create a separate Aurelius model (which you won't use in any real database), then create entities there with dynamic properties, that will be used only for the purpose of sending/receiving XData objects.

Another option is, if your system needs such level of flexibility, you can simply return a TJSONObject as the result and fill the JSON properties yourself from the fixed and dynamic properties.