You are not logged in.
When I pass object via interfaced service method (with {$M+} and published) then before mORMot deserialize JSON with data of object I must create this object?
example:
service method:
function GetObject(const ObjectId : Integer; out Object : TMyObject);
use of this method:
var
lObject : TMyObject;
//lObject := TMyObject.Create; <-- without create object I get error on next line
GetObject(x, lObject); //<-- error if lObject = nil
mORMot can't autocreate this object?
Offline
The client should create the instances, even for output parameter.
Most of the time it won't be a temporary object but a field.
They will be created on the server side, when running the service implementation.
If you want some transient value, use a record not a class.
You just need to declare it on the stack. No need to call create.
Offline
Thanks for clarification. One more question:
why JSON is different (name quoted) between transfer as object or as record?
See on fields eg. VATID (and others):
send as record (with quotes):
{"VATID":"","PersonKind":76,"PKD":"","PlaceId":"","CommuneId":"","ProductId":268484512,"ProductVersion":0,"ProductReleaseDate":10000,"DemoVersionMode":76,"LastReceivedUUID":"","SystemId":42678,"SystemCodePage":-702306117,"ScreenResolution":-2,"DateOfCommencement":10000}
send as object (without quotes):
{VATID:"87654332",CommuneId:"0",DateOfCommencement:1485632481,LastReceivedUUID:"{3C71F148-5F70-4177-AF94-544E51FDC5D6}",PKD:"pkd",PlaceId:"09",ProductId:1234,ProductReleaseDate:100000,ProductVersion:87675675,ScreenResolution:700,SystemCodePage:987,SystemId:150}
Offline