A couple of integer constants are computed by WCF client before making the call to the WCF service. I would want these integer constants to be available on WCF service. Please note that I would not want them to be used as method arguments, because these constants are required irrespective of the method in the Service. Having the same argument for every method would be redundant.
To be clear, client keeps computing values for 'a' and 'b' before making a WCF service call. Once the call is made, throughout the entire call 'a' and 'b' can be accessed by the service. This is similar to using them as arguments of the method. Only difference here is that, 'a' and 'b' are needed by every method in the WCF service. So, I would prefer a better solution than adding 'a' and 'b' as arguments to every method in the WCF call.
So, let's say I have 3 methods in WCF service->
void Count1()
void Count2()
void Count3()
Client will compute different 'a' and 'b' values for each WCF method call. One solution is to keep the methods in this format.
void Count1(int a, int b)
void Count2(int a, int b)
void Count3(int a, int b)
But, I would like a better solution if possible.
Sorry about this long question.
You could create a "Request" class for your service as a data contract, and include in this request
a
,b
and any other value(s) you might want to get from the client. A basic request would only keepa
andb
, but other requests might derive from it.This way you only send one parameter to the service for every method.