We help IT Professionals succeed at work.

WCF Services - how to organise large numbers or methods?

Solar_Flare asked
Medium Priority
Last Modified: 2013-12-17
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.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.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?
Watch Question

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


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.
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
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


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.