WCF Services - how to organise large numbers or methods?

I am putting together a WCF service application, and my concern is that as it grows all the methods will be appear as methods of the xxxServiceClient proxy on the client. The methods could easily be grouped logically like nested classes, but I can't see a way to do this with wcf.

As an example, a service with methods for cars, truck and distance would look something like this on the client

WCFService.IMyService svc = new MyProject.WCFService.MyServiceClient();
svc.CarMethod1(arg);
svc.TruckMethod1(arg);
svc.CalculateDistance(point1, point2);


But if it grows to hundreds of methods it would be messy, ideally I would end up with code on the client looking like

WCFService.IMyService svc = new MyProject.WCFService.MyServiceClient();
svc.Transport.Cars.CarMethod1(arg);
svc.Transport.Trucks.TruckMethod1(arg);
svc.Utility.CalculateDistance(point1, point2);



Does anyone know if it is possible to do something like this, or what is the best practice for separating/grouping methods in services with large numbers of methods?
LVL 15
Solar_FlareAsked:
Who is Participating?
 
Solar_FlareAuthor Commented:
Please don't comment on a WCF question if you don't know anything about WCF.



For anyone that is interested in the future, I found an post that comes about as close as you can get (I think) to achieving this with WCF.

You can break the interface up and offer each interface via a separate WCF endpoint on one service, but all the methods need to be implemented in a single class which implements all your interfaces

http://www.meineck.net/2008/04/wcf-hosting-multiple-wcf-services-as.html
0
 
ChloesDadCommented:
As with any .Net structure you would need to setup a class that is called something like

Public Class CarMethods

' all Methods go here

public sub Car1

end sub

' etc

end class

The same for trucks etc

then in your myserviceClient class

have public property Cars as mycars
public property Trucks as mytrucks
0
 
Solar_FlareAuthor Commented:
This is WCF, the MyServiceClient class on the client is autogenerated from the WSDL/MEX, and all service methods must be implemented in an interface.
0
 
ChloesDadCommented:
If its auto generated then no you can't. The only way that you can do it is using classes, and as you cant then they will all be in a single class
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.