i'm consuming soap web service. web service designates separate service url each of customers. don't know why that. functions , parameters technically same. if want write program service have know each company intended. means company called "apple" have use following using statement:
using dmdelivery.apple;
and other called "orange"
using dmdelivery.orange;
but program work of them , have name of company or service reference point parameter.
update: if have write separate application each customer have keep of them updated each other every small change , 1 heck of inefficient job number of customers increase.
can think of solution? i'll grateful.
if have base contract (interface) services can use kind of factory instantiate concrete service , have reference interface in client code (calling code).
//service interface public interface ifruitservice{ void someoperation(); } //apple service public class appleservice : ifruitservice{ public void someoperation(){ //implementation } }
having example kind of factory class (you can put using
statements here)
public static class servicefactory{ public static ifruitservice createservice(string kind){ if(kind == "apple") return new appleservice(); else if(kind == "orange") return new orangeservice(); else return null; } }
and in calling code (you add using
statement namespace containing interface):
string fruitkind = //get configuration ifruitservice service = servicefactory.createservice( fruitkind ); service.someoperation();
you can use dependency injection principle.
Comments
Post a Comment