Web Services - implementing an interface
-
Hi, here is my scenario... i have the following in my solution... App1 - normal application App2 - normal application CoreApp - library containing classes and 'core' functionality App1 and App2 talk to each other via their sql server databases. now, sometimes app1 and app2 may be installed on the same server, sometimes they are not. so, if they are installed on the same box there will be a connection string to the other apps db in their web.config file. if the connection string does not exist then i must call the other apps web service which will perform the db insert for me. i made an interface, lets says its called IComms this interface is implemented by the web service and the class that performs the direct insert. it defines the method signature that allows app1 to put something in app2s database. so to send a message i write this code in App2..
dim proxy as IComms 'see if we have connection string for app1 database if getConfigSetting("App1ConnectionString").length = 0 then 'use web service proxy = new app1.webservice else proxy = new CoreApp.dbCalls end if proxy.sendmessageToApp1("hello")
this is all very well, but the reference to app1s web service in app2 does not create an implementation of the interface on the proxy class. is there any way round this or should i just design the app without the use of an interface? :~---Guy H (;-)---