Hi
I have xdata service method procedure DoSomething(saleData: tSaleData);
As far as In understand i don't need to free saleData
and I don't need to write destructor for TSaledata to free products and payments
But if I use tsaledata outside of Xdata (for example in DunitX tests), I would love to have destructror for Tsaledata and Tsaleproduct to destroy subclasses.
Is only option write destructor like this
inherited;
if (TXDataOperationContext.Current <>nil) and
TXDataOperationContext.Current.Handler.ManagedObjects.Contains(self) then
exit;
Free child objects
Sample classess
TSaleData = Class
products:tarray<tsaleproduct>;
payments:tarray<tpayment>;
end;
Tsaleproduct = class
productid: string;
amount: double;
discount:tDiscount;
end;
TDiscount = class
ispercentage: Boolean;
amount: Boolean;
end;
and so on ...