Unity DI with WCF Client

482 views Asked by At

I am using UnityContainer for our Project. I have a requirement to Add a Custom Header for all out going wcf calls so i have implemented IClientMessageInspector and IEndpointBehavior. Now i am trying to get the header value from some object using UnityContainer Property Injection. The Same Property injection is working outside IClientMessageInspector but not inside my custom Clientmessageinspector.

Property Injection

[Dependency]
public IUnityContainer _container { get; set; }

public object BeforeSendRequest(ref Message request, IClientChannel channel){var test= _container; }

_container is always coming as null.

Can we use UnityContainer inside MessageInspector as normal as other classes?.

0

There are 0 answers