views:

61

answers:

2

Do you use auto-generated WCF service references in line of business applications? Or do you roll your own? And why?

EDIT

For anyone looking to roll their own, I found this article which may prove useful: Understanding WCF Services in Silverlight 2. There's another article on the site for Silverlight 3 which may be a useful addition: Understanding WCF Faults in Silverlight 3.

+3  A: 

I typically roll my own, or tweak the ones generated by the auto-generated wizard.

I have two scenarios, most of the time:

  1. I control both ends of the wire - in that case, I share the assembly with the service and data contracts between the service and client, and in that case, I write my own clients from scratch, as ClientBase<T> descendants or using a ChannelFactory<T>. Unfortunately, this is not an option with a Silverlight client, as far as I know :-(

  2. I get WSDL+XSD from a third party - in that case, I typically use svcutil.exe to generate a first version of the client proxy, and then I tweak that to suit my needs (especially the configs generated by svcutil or VS "Add Service Reference" are horrendously bad.....)

I just like to have that extra control of doing it myself and totally knowing what's going on.

marc_s
Exactly the approach I've followed. Plus, when I've been given (shudder) a Java service, I've thrown svcutil against the metadata that it generated and tweaked that. For interesting (e.g. polymorphic) XML schema svcutil is the best way to get started, sometimes it generates <i>very</i> interesting code.
Jeremy McGee
Right on. {#15#}
Jason Punyon
Thanks for the reply. It is Silverlight I'm thinking about. I've rolled my own for a non-Silverlight app but haven't tried for SL, yet. I guess I need to find some Silverlight-specific WCF articles to find out what the probs are with your approach and what the alternatives are.
serialhobbyist
+1  A: 

I haven't had to use Silverlight to access a service I didn't control, but in accessing a WCF service that I do control, yeah, I use the standard auto-generated WCF references. Rolling my own would just be too painful when the service is changing regularly.

If you control both ends of the service, you should also strongly investigate RIA Services, which implements a much more elegant way of keeping your Siverlight client in sync with your WCF service than having to manually regenerating your service references each time the interface changes.

Ken Smith
Thanks. RIA Service do look quite interesting.
serialhobbyist