I’ve just started learning WCF.
It seems that every single use of the (remote) classes is translated into a request to the server (even just setting values, before sending them as a parameter to the service).
Doesn’t this cause too many unnecessary requests?
What can I do avoid this wasted time & bandwidth? I’m just trying to set some values. The Set section of these properties, has nothing but setting the values of the corresponding fields.
For example,
interface IService
{
int GetResult(MyComplexType1 input);
}
To use this service, I must firstly initialize a MyComplexType1 instance, which makes requests to the server every time I’m setting any value of MyComplexType1.
Invoking a web service is usually an expensive call in your code, so your design needs to consider that. For example, the following service wouldn’t be very effective:
Whereas the following interface reduces the calls required to one: