I have a forms project that will allow user to connect to a local database or a webservice hosting the data. So the flow goes something like: App builds request object (SearchCriteria) defined in a class library. Local data access layer and webservice both use the SearchCriteria object to run queries, and return a Results object (also defined in the class library). So my desktop app has a ClassLibrary project which defines the Request and Results classes. This dll is imported into the Webservice solution. I’ve developed an interface to define the contracts between the desktop app and the data provider (either the local DAL or the Webservice).
public interface IDataAccess
{
DataTable GetCompanyMatches(SearchCriteria searchCriteria, out Results results);
…
}
One edit to the Reference.cs file tells the compiler that my Webservice implements the interface. internal interface WSSoap : ITPDataAccess
The problem is that when the Webservice returns the Results object the desktop app sees the type as Webservice.Results instead of ClassLibrary.Results, so the Webservice does not implement IDataAccess (even though I specify, in the webservice, webservice inherits from/implements IDataAccess.
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : ITPDataAccess
{…..}
Is there a way to tell the WS to not put the ClassLibrary classes into the Webservice namespace? Is there some way on the app side to use the locally defined classes when interacting with the webservice? Basically how do i tell the compiler that they are the same thing, without rewriting the Reference.cs file??