O'Reilly logo

Essential .NET, Volume 1: The Common Language Runtime by Chris Sells, Don Box

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Message Processing (Revisited)

The previous section illustrated how a custom proxy can pre- and postprocess method calls simply by getting between the transparent proxy and the stack builder sink. What if one wanted to inject more than one stage of pre- and postprocessing? Yes, one could simply layer proxy upon proxy; however, redundant stack-to-message transitions would occur at each stage, resulting in undue performance costs. A far preferable approach is to chain together processing stages at the message level, thus paying the cost of stack-to-message transition only once per call and not once per stage per call. This technique is based on message sinks. To facilitate this in a generic manner, the CLR defines the System.Runtime.Remoting.Messaging.IMessageSink ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required