Currently, this is done by instantiating a new OperationContext around each call through the proxy. This can be optimized in several ways:
1) Create a shared OperationContext object and always instatiate the OperationContextScope with it:
using (OperationContextScope scope = new
I don't know if it's a good idea, though. Should OperationContext objects be persisted between calls, or would it have unexpected side effects?
2) Create a wrapper around the OperationContextScope class that fills the OperationContext with the proper headers:
public class MyOperationContextScope : IDisposable
public MyOperationContextScope ()
contextScope = new OperationContextScope();
MessageHeader standardHeader = new
public void Dispose()
if (contextScope != null)
This is a bit cleaner, but still requires me to wrap every proxy call with a using() statement.
Is there a way to interecept all calls and have my headers added automatically?