Q:

Operation synchronization different from class synchronization

I have a WebService (.svc) class with  
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single)]

and I want to make some of it operations multiple not single and some single.
How can I do it?

A:

You could mark class as ConcurrencyMode.Multiple, make private synchronization field, and lock on that field on method entrancies which need to be Single.
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
class SomeSvc : ContractInterface
{
    private readonly Object _syncLock = new Object();

    // this method is ConcurrencyMode.Single
    public String SingleMethod1()
    {
         lock (_syncLock)
         {
             // method code here
         }
    }

    // this method is ConcurrencyMode.Single
    public String SingleMethod2()
    {
         lock (_syncLock)
         {
             // method code here
         }
    }

    // this method is ConcurrencyMode.Multiple
    public String MultipleMethod()
    {
        // ...
    }
 }

