Previously, the "intercept" attribute (interceptproperty) was added to the context of interceptattribute. Because interceptproperty inherits icontributeobjectsink, we need to implement getobjectsink (), then we need to create a class that inherits imessagesink as the return value.
In this way, the implementation of the interceptsink class is introduced:
public class InterceptSink : IMessageSink { private IMessageSink nextSink = null; public IMessageSink NextSink { get { return nextSink; } } public InterceptSink(IMessageSink nextSink) { Console.WriteLine(" Call 'InterceptSink' - 'Constructor' "); this.nextSink = nextSink; } public IMessage SyncProcessMessage(IMessage msg) { Console.WriteLine("method_name: " + msg.Properties["__MethodName"].ToString()); IMessage returnMsg = nextSink.SyncProcessMessage(msg); return returnMsg; } public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink) { return null; } }
Core Method: syncprocessmessage (iMessage MSG)
In the input parameter MSG, we can find the corresponding data for calling the object method.