Saturday, July 10, 2004
more ...
http://weblogs.asp.net/cschittko/
Inside of ChainStream()
This good post is from
http://hyperthink.net/blog/CommentView,guid,eafeef67-c240-44cc-8550-974f5d378a8f.aspx
This post analyzed SoapExtension in detail and recommended MSE custom filters.
----
public override Stream ChainStream(Stream stream)
{
//This flag will be set to true during the AfterDeserialize
//handler in ProcessMessage()
if( !bPostDeserialize)
{
//We’re deserializing the message, so stream is our input
//stream
this.inputStream = stream;
this.outputStream = new MemoryStream();
return outputStream;
}
else
{
//We’re serializing the message, so stream is the
//destination of our bits
this.inputStream = new MemoryStream();
this.outputStrem = stream;
return inputStream;
}
}
Implementing ChainStream in this way allows code that actually does the message processing to always be able to read from this.inputStream and write to this.outputStream, regardless of where in the message processing cycle the code currently is.