I'm developiomg a server to only use Service Methods(Using TXDataClient on client side) .
When I insert a Record for example:
function InsertCustomer(const Name: string; const Adress : TStringList): TCustomer;
I'm having a problem when the client use the TCustomer class with many-valued assosiations(for example TAdress), when the client reads the response, executes a SQL to the server loading the TAdress class for the TCustomer returned by the Service Method.
I don't understand exactly what is your issue. The client doesn't execute any SQL statement. It's the server that does it. For many-valued associations, if the client requested that TAddress list should be returned in same request, it will always perform an extra SQL statement (server-side) to retrieve the address list.
Sorry I didn’t make myself clear, Yes I know client doesn’t execute
SQL, but request data to the server when accessing many-valued associations.
What I want to achieve is a Service method only server, Want I mean by
this is that for example I have a TCustomer class with a TAddress many-value
association and I have the service method FindCustomer(const Aid : integer) :
TCsutomer; and the server function doesn’t load the TAddress field. When the client uses
TCsutomer.Address field, the client should not request the data to server or the
server should not execute a SQL to retrieve the TAddress data. I want that data
can only be loaded thru Service Method and not allow direct access to the many-value
associations.
By direct acces to many-valu associations I mean that, If values are not loaded by the service method, The client should not request the data when accesing the field.
It's you that write the client, isn't it? You have full control, just don't call Customer.Address.
Why you don't want to allow that? If you use EntitySetPermission(Address, []), it should be denied by the server with a 403 error and nothing would be loaded.