According to OData-CSDL, section 14.4.4 services can define client-side functions outside the odata namespace.
- Can they be defined like server-side functions, through edm:Function? (I think yes, because the client should be able to delegate their execution to the server.)
- Does edm:Function need an attribute ClientSide="true"? (I think yes, if this means: can only be executed by the client.)
- Or perhaps a new core annotation (no need to wait for the next CSDL version):
But such a tag is dangerous, since clients that do not understand might wrongly invoke the function on the server.
A function without this tag can occur in an annotation that is contributed by a proxy between OData client and server. Continuing the example from
ODATA-1420, assume the proxy contributes the following annotation:
The proxy would then convert the request
forward the converted request to the SalesOrderServer and rename JSON property PriceSection2 to @PAngV.PriceSection2 in the response, effectively handling the instance annotation @PAngV.PriceSection2 like an additional property.
This examples assumes that the SalesOrderServer.PricePerPiece function is implemented on the server. If the server declared that function ClientSideOnly, or if the function was contributed by the proxy instead, then the proxy would send the following metadata to the client:
and the proxy would request
from the server and perform the computation of @PAngV.PriceSection2 itself.