My Interface and external Webserver
I have an external Web Service that returns back its own object, and I would like to get it to compile to my interfaces is this possible?
(IGetPerson)testAPI.GetPersons();
Where testAPI is the external web service
testAPI.GetPerson returns webservice.GetCarResponse, which is of course from the external webservice.
I need to get the results to开发者_开发知识库 fit in to my interfaces so I can use IoC
Any ideas?
Sounds like a candidate for the Adapter Pattern to me. Have a look at the example provided by doFactory.
Could you have a class that wraps whatever class the webservice returns and implements your interface? The implementation of each property of the interface would simply return or set the corresponding value on the webservice's response object (which would be stored as an instance variable)
The adapter pattern (wikipedia)
精彩评论