Hi,
I have annoying issue with our DB design.
We have dates in few tables presented as yyyymmdd string. (pure string)
We would love to switch them to real db's own date field but that requires a lot of change and
we cannot delay api so long.
My wish was that i would have declared it something like this
[FColumn('invoicedate') ];
Finvoicedatestr: string;
[Calculated]
Finvoicedate: Tdatetime;
Property InvoiceDate: TdateTime read FInvoiceDate Write SetInvoiceDate;
When data is retrieved from tables
aurelius would invoke "afterLoadFromdataset" event;
When InvoiceDate is set trough Xdata InvoiceData Setter is invoked.
so in json it would be presented like ..., "invoicedatestr":"20201218", "invoicedate":"2020-12-18", ...
If that would work we could at same moment in future update db structure and switch declarations so that FInvoiceDateStr would be calculated and FinvoiceDate would be db field.
But you can do that right now. Just create the properties and fields as you mentioned. Do not forget to also set GetInvoiceDate, to translate from FInvoicedatestr to the TDateTime format.