You are not logged in.
Pages: 1
Hi Ab,
I have a (feature) request (if needed). My projects now use DDD. For storing product information.
TProduct = class(TSynAutoCreateFields)
protected
fProductCode : RawUTF8;
fDetail : TDetails;
published
property ProductCode : RawUTF8 read fProductCode write fProductCode;
property Detail : TDetails read fDetail;
end;
TDetails = class(TPersistent)
...
end;
The TDetails are flattened by default. But I would like to have them more compact as JSON in the database file.
I succeeded in doing so by disabling the "pilSubClassesFlattening" options in mORMotDDD.pas (and adding an autocreated TDetails-field in the record and with RegisterClassForJSON for TDetails).
Could this be made info an options to flatten by default or not in special cases ? Or can this already be accomplished ?
Thanks.
Edit:
Perhaps an idea: scan the ORM instance for a field with the same signature (and name) as the field in the aggregate itself.
Last edited by AOG (2020-11-15 10:32:28)
Offline
Hi,
You can exclude the pilSubClassesFlattening flag by overriding TDDDRepositoryRestFactory.GetAggregateRTTIOptions.
I wanted to do the same, so a virtual method was introduced for that purpose. See: https://github.com/synopse/mORMot/pull/179
Last edited by trx (2020-11-15 19:50:25)
Offline
Thanks very much. Will look into this. I guess this will serve my needs.
Offline
Pages: 1