Dynamic Properties and Dynamic Sinks provide an extensibility mechanism for user to monitor calls to and from objects.
Context.RegisterDynamicProperty allows users to register a property implementing the IDynamicProperty and IContributeDynamicSink interfaces with the remoting service. Based on the obj and ctx parameters, the property is asked to contribute a sink that is placed at some location in the path of remoting calls.
If multiple properties are registered, their sinks may be called in an arbitrary order that may change between calls.
Parameters to Context.RegisterDynamicProperty
Parameters | Description |
---|---|
name | String name for property |
property | An object that implements IContributeDynamicSink |
obj | The object/proxy for which the property is registered , may be null. |
ctx | The context for which the property is registered. |
If obj is non null then if it is a proxy, all calls made on the proxy are intercepted otherwise if it is a real object, all calls on the object are intercepted the ctx argument must be null
If ctx is non-null then the obj argument must be null and all calls entering and leaving the context are intercepted
If both ctx and obj are null then all calls entering and leaving all contexts are intercepted.
Context.UnregisterDynamicProperty enables the user to unregister the property, which implies that the sink will be dropped for subsequent remoting calls.
Unregister dynamic property. See RegisterDynamicProperty. Name, obj, ctx arguments should be exactly the same as a previous RegisterDynamicProperty call.
The IDynamicProperty interface is implemented by properties that are registered at runtime through the RemotingServices.RegisterDynamicProperty API..
public interface IDynamicProperty { String Name {get;} }
Returns the name of the dynamic property.
The IContributeDynamicSink interface is implemented by properties that are registered at runtime through the RemotingServices.RegisterDynamicProperty API. These properties can contribute sinks that are notified when remoting calls start/finish.
interface IContributeDynamicSink { public IDynamicMessageSink GetDynamicSink(); }
Returns the message sink that will be notified of call start/finish events through the IDynamicMessageSink interface.
IDynamicMessageSink is implemented by message sinks provided by dynamically registered properties. These sinks are provided notifications of call-start and call-finish with flags indicating whether the call is currently on the client-side or server-side (this is useful for the context level sinks).
interface IDynamicMessageSink { public IMessageProcessMessageStart( IMessage reqMsg, bool bCliSide, bool bAsync); public IMessage ProcessMessageFinish( IMessage replyMsg, bool bCliSide, bool bAsync); }
Indicates that a call is starting. The booleans tell whether we are on the client side or the server side and whether the call is using AsyncProcessMessage.
Parameter | Description |
---|---|
ReqMsg | Request Message |
bCliSide | True if client side |
Basync | True if async call |
Indicates that a call is returning. The booleans tell whether we are on the client side or the server side and whether the call is using AsyncProcessMessage.
Parameter | Description |
---|---|
replyMsg | Reply Message |
bCliSide | True if client side |
Basync | True if async call |