as in the title, i have:
[ServiceContract]
public interface IService
{
[OperationContract]
[WebGet(UriTemplate="abc")]
Stream GetResponse(Stream in);
}
public class Service : IService
{
public Stream GetResponse(Stream in)
{
some_function()
}
}
is it possible to pass a request context to some other function that will respond to the request?
Yes, within
some_functionyou can access the current WCFOperationContextvia the staticCurrentproperty which will give you full access to everything about the request. Or, better yet, you can designsome_functionto accept an OperationContext parameter and then it doesn’t have to pull it out of thin air itself which actually makes for better testability.In addition to the context, you will also need to take and return the
Streaminstances fromsome_functionif it intends to act on them.So your
some_functionmight look something like this: