Hi,
I am got the following situation and would love to hear peoples feedback on whether i am doing this in the correct way for WCF.
Currently our application has its own context class similar to HttpContext and is accessed using the Current property. This class contains a number of properties such as ClientName, ApplicationName, Status etc etc. We would like to be able to pass this information over the wire to our remote services hosted in WCF, but we dont want to have to explicitly the information on every method call.
My current thinking to have a class that implements the IClientMessageInspector and IDispatchMessageInspector interfaces. In the IClientMessageInspector.BeforeSendRequest i take the current context and then create a new message header for it, this is then added to the request headers collection.
On the service side the IDispatchMessageInspector.AfterReceiveRequest looks for the header and moves it into the understood headers collection. The context object then has a method in it to look through the current OperationContext's understood headers and the deserializes the appropriate header.
Can anyone comment on this approach, the pros and cons of it or whether is a better way of achieveing the same things
Thanks
Dave