?
Solved

WCF Services - how to organise large numbers or methods?

Posted on 2009-02-10
4
Medium Priority
?
742 Views
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.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?
0
Comment
Question by:Solar_Flare
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:ChloesDad
ID: 23606615
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
 
LVL 15

Author Comment

by:Solar_Flare
ID: 23606710
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
 
LVL 15

Expert Comment

by:ChloesDad
ID: 23606807
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
 
LVL 15

Accepted Solution

by:
Solar_Flare earned 0 total points
ID: 23616757
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

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question