locked
Use or Avoid Add Service Reference? RRS feed

  • Question

  • I read in a few articles to avoid using Add Service Reference. But the tool would save a lot of time and effort. If I am using WCF Data Services is it better to avoid or use Add Service Reference?

     

    Wednesday, October 27, 2010 8:24 PM

All replies

  • Hi CrazyTn,

     I am unfamiliar with any guidance to avoid using the ASR dialog.
     Can you please point me to the articles that you referenced ?
     Its just a dialog which invokes custom code generators, it is no different from using the "Add->New File" dialog.
     Is it better ? Of course it is, Its part of a tool thats built to make your code easier to write.
     


    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Thursday, October 28, 2010 3:46 PM
    Moderator
  • Here is one of the article I read it from:

    http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2

     

    Here is the Section, but this was an article for WCF Services, so it might not apply for WCF Data Services.

    Service Access Without Magic

    Now we may turn our attention to the client application.  To begin, let me start off by reminding everyone that you shouldn't ever use "Add Service Reference" in Visual Studio for magical service client creation.  The code is incredibly verbose, hard to manageable, edits are prone to being overwritten, and it's almost always used as an excuse to not actually learn WCF.  There are few things worse than having to deal with people who thing they know a product simply because they know how to use a mouse.  There are reasons why Juval Lowy, in all his books and talks, repeatedly tells people to avoid using this flawed feature.  Fortunately, as professionals, we have the ability to understand how to do things without magic.

    Friday, October 29, 2010 6:57 AM
  • While I subscribe to the belief that you should know what you are working on and that wizard magic should be at a minimum, that's a personal philosophy.

    Following the line of thinking in the article you linked to, I sincerely don't think using code generation for client types is a whole lot of magic.

    The tools only generate client types for a given data service, they don't bring down any code that you would avoid writing while interacting with the Data Service.

    Think of DataSvcUtil.exe as XSD.exe which would create CLR types from an XSD document.

    Can you create the client types by hand ?
    Sure, you can.

    Would doing this lead to a deeper understanding of the domain you are targeting ?
    My experience says that the answer to this is "No".

    As with all things, you can draw your own conclusions from the linked article or my statements above.

    In the end, I would do what it takes to make a great app for the customer.


    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Monday, November 1, 2010 9:25 PM
    Moderator