-
1 Attachment(s)
WCF doubts
Hello,
in my WCF application, i have created two svc files, classes are Employee and Project.
Now i am facing a problem of client application need to call two service references to get two classes.
I have hosted a web application in IIS and created two seperate svc files for calling project and employee.
<%@ ServiceHost Language="C#" Debug="true" Service="ManageWorks.WCF.Employee" %>
<%@ ServiceHost Language="C#" Debug="true" Service="ManageWorks.WCF.Project" %>
In my client i need to add only one service reference and all the classes need to be accessible using that.
I hope my question is clear, even having two svc files, how could we call two different class in one single client service reference.
thankzzzzzzz
-
Re: WCF doubts
You could simply create a interface that implements both services:
Code:
public interface dummyServices : AccountService, MoneyService
{
}
Where dummyService can do all the calls from the AccountService and the MoneyService
-
Re: WCF doubts
Yeah the only options you have as far as I can see are what Lightning suggested or the obvious... combine them both in the same service :) I guess it depends how much separation you need between the two things that the services deal with (in this case: Customers and Employees) - I wouldn't personally go just creating a separate service for every single category of item in your program (unless you have an awful lot of methods in each one) for this precise reason... but then I have only created small programs using WCF so far, so I guess im not the best person to offer advice on the design.
-
Re: WCF doubts
I don't see how that's a problem. I think you might have misunderstood the concept of services here... when you create two services, you create them separately because they serve different purposes. They are therefore two different services, they just happen to sit in the same 'project' or virtual directory in IIS. You'll need both references in place. If you want one reference, you need one service. It's sort of like saying "Well, I have a User class and an Orders class... why can't I just use one class for both?" (Because it doesn't make sense)
Alternatively, you could always move the interface classes out into another class library and references those and then call the services via an IClientChannel but that sort of defeats the purpose of WCF IMEO.
-
Re: WCF doubts
-
Re: WCF doubts
In My Esteemed Opinion.
:p
-
Re: WCF doubts
Hmmmm, you win this round...
:)
-
Re: WCF doubts
Of beer? I graciously accept.
-
Re: WCF doubts