NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

IContributeServerContextSink Interface

The IContributeServerContextSink interface is implemented by context properties in a Context that wish to contribute an interception sink at the context boundary on the server end of a remoting call.

The Server Context Chain is composed from those properties in the server context that implement IContributeServerContextSink interface and which contribute a sink via the GetServerContextSink method call. This chain is cached for future use. Thread Affinity could be an example of such a context property i.e. in this case the MessageSink would involve switching to a specific thread before processing a call further.

IContributeServerContextSink

[Visual Basic]
Public Interface IContributeServerContextSink
[C#]
public interface IContributeServerContextSink
[C++]
public __gc __interface IContributeServerContextSink

[JScript] In JScript, you can use the interfaces in the NGWS frameworks, but you cannot define your own.

Classes that Implement IContributeServerContextSink

Class Description
Synchronization [To be supplied.]
ThreadAffinity Key Points:

Refinement of Synchronized Context

Mark type with Thread Affinity Context Attribute

Only a single thread allowed to execute within the Synchronization Domain, hence only that thread can access instance fields and methods

Useful:

User Interface objects

Objects that hold onto OS resource that should only be accessed on the thread that created them

The Thread Affinity Context Property provides a similar capability as the Synchronization Context property with the further constraint that only a single thread is allow to execute within the context or synchronization domain at any time. This is useful for objects that could hold onto OS resources that should only be accessed from a particular thread and only that thread. Thread Affinity is useful when users want to always access the object on the same thread. Certain UI resources should only be accessed on the same thread, on which they were created.

An instance of this property in a context enforces a thread affinity domain for the context (and all contexts that share the same instance). This means that for all contexts sharing an instance of this property, all methods on objects resident in those contexts will execute on the same thread for the lifetime of the objects.

This is done by contributing message sinks that intercept and serialize in-coming calls.

If the property is marked for reentrancy, then call-outs are intercepted too. The call-out interception allows other waiting calls to enter the thread affinity domain.

[ThreadAffinity()]

public class Foo: ContextBoundObject

{

. . .// implementation for Foo

}

// Make an instance of Foo

void SomeOtherMethod(void)

{

. . . Foo foo = new Foo();

}

Remarks

[To be supplied.]

Requirements

Namespace: System.Runtime.Remoting

Assembly: mscorlib.dll

See Also

IContributeServerContextSink Members | System.Runtime.Remoting Namespace