Make WCF client/proxy IOCable
2009 July 7
For unit-test purpose, it’s necessary to make WCF client/proxy class implement from an interface.
The problem is, we suppose to clean up this WCF client after each service call, which means it should be able to repeatedly contracted and disposed. From IOC container we can only get it once. A factory for WCF client is the only solution.
There is an OSS lib from SoftwareIsHardwork. Very detail document.
I personally like Michael Perry’s POCO better: Client object is created and closed in each service method call, and method is wrapped in lambda expression, very clean and smart.