xData memory management exclude single object

I'm using a seperate task where a new TXDataClient is created, apart from the main thread. I asumed that the TXDataClient isn't thread safe. The loaded TSKbedrijf from the xData server should be available in the main thread after the thread finishes.


Simplified code in the task:

TSKClient := TXDataClient.Create;
TSKbedrijf := TSKClient.Get<Tbedrijven>(id);
TSKClient.Free;

As expected, the TSKClient.Free frees TSKbedrijf as well. I found:
TSKClient.ReturnedInstancesOwnership := TInstanceOwnership.None;

but this seems to turn off the client data management for all TXDataClients created. (which makes me think that using this statement isn't thread safe, even though the TSKclientdata is created and destroyed within the thread)

Is there a way to exclude TSKbedrijf from being destroyed automatically? Or is there a way to make the TInstanceOwnership.None only effective for a single TXDataClient?

Thank you!


That's not true. It's per TXDataClient, and that's the way to use it.
I tested the code in a smaller environment and you're right. Somehow other objects aren't freed after calling the ownership statement, but I'll discuss that with internally.

Thanks again.