System.Runtime.Remoting.Contexts.SynchronizationAttribute Class

Enforces a synchronization domain for the current context and all contexts that share the same instance.

See Also: SynchronizationAttribute Members


public class SynchronizationAttribute : ContextAttribute, IContributeClientContextSink, IContributeServerContextSink


When this attribute is applied to an object, only one thread can be executing in all contexts that share an instance of this property. This is done by contributing sinks that intercept and serialize incoming calls for the respective contexts. If the property is marked for reentry, then callouts are intercepted too. The callout interception allows other waiting threads to enter the synchronization domain for maximal throughput.


There are two classes named SynchronizationAttribute : one in the System.Runtime.Remoting.Contexts namespace, and the other in the System.EnterpriseServices namespace. The System.EnterpriseServices.SynchronizationAttribute class supports only synchronous calls, and can be used only with serviced components. (For more information on serviced components, see [<topic://cpconservicedcomponentoverview>].) The System.Runtime.Remoting.Contexts.SynchronizationAttribute supports both synchronous and asynchronous calls, and can be used only with context bound objects. (For more information on context bound objects, see the ContextBoundObject class.)


This class makes a link demand and an inheritance demand at the class level. A System.Security.SecurityException is thrown when either the immediate caller or the derived class does not have infrastructure permission. For details about security demands, see [<topic://cpconLinkDemands>] and [<topic://cpconInheritanceDemands>].


Namespace: System.Runtime.Remoting.Contexts
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,