using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;

namespace BeWo.Multitenancy
{
    public class MultitenancyInterceptor : IClientMessageInspector
    {
        public void AfterReceiveReply(ref Message reply, object correlationState)
        {
        }

        public object BeforeSendRequest(ref Message request, IClientChannel channel)
        {
            request.Headers.Add(new MultitenancyHeader { Tenant = BeWoApp.Tenant });
            return null;
        }
    }
}