I have a project that I am experimenting with DI in. I am using Unity and things seem to work well for normal assemblies and the injections.
I am trying to further break dependencies with WCF services. The WCF service that I want to inject is created at runtime currently without using DI and I don't use the VS .net generated proxies:
MyService = new ChannelFactory<IMyService>("BasicHttpBinding_IMyService").CreateChannel();
Endpoint for the above is in the web.config:
<endpoint address="http://localhost:35806/MyService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
contract="Interfaces.IMyService" name="BasicHttpBinding_IMyService" />
I am trying to figure out how to map this WCF service to an interface via the web.config so that I can use constructor injection
In web.config the normal mapping occurs using the "mapTo" where you would specify the interface alias and an alias to a class you previously defined.
<type type="IMyService" mapTo="MyService">
<lifetime type="singleton"/>
</type>
Since the WCF service proxy is created dynamically at run time I do not have this reference to "MyService" class instead it needs to pull from the "BasicHttpBinding_IMyService"
endpoint for the service.
Any ideas on how this can be accomplished?