I have one service Service A with 2 operation contract CheckServer and AddService. As the Service is singleton with Concurrey mode as Single [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single)]
public Class Service : Iservice
{
public bool CheckService()
{
//Checks server avilabality and returns bool value
}
public int AddService(int a, int b)
{
return int i = a + b;
}
}
Here my requirement is only one Instace of AddService to be allowed, so I made this as singleton. Now CheckServvice is not necessary to be Singleton so how can I split these 2 method implementation to make AddService as singleton and CheckService as开发者_如何学JAVA multiple.
Thanks in Advance
WCF doesn't provide what you want. Put that logic outside of WCF and write your own synchronization logic. For example implement singleton class exposing CheckService
and AddService
where synchronization will be directly in AddService
method and CheckService
method will be free to call.
Make standard WCF per-call service delegating processing to your singleton class.
精彩评论