Search code examples
wcfweb-servicesdatacontract

Architectural Advice on designing a WCF contract to expose a desktop app functionality


We're currently working on exposing the functionality of a Windows Forms application via WCF services.

As an example, there is a form with multiple dropdowns in the desktop app. We would like to design a service that will allow a client to submit a request with all required values as if that client filled the info in the desktop app.

My question is:

What is the best way to expose allowable values for the dropdowns in the WCF service contract?

Note that some fields have a lot of allowable values (desktop app uses type ahead search).

How did you handle issues like this in your projects?

Thanks in advance


Solution

  • IMO, the best way is to use an enumeration in the DataContract (first option you listed).

    It's much more interoperable than a .Net assembly (if you expose a SOAP webservice through WCF, you'll be able to consume it from other technologies).

    And you won't need to manually parse a string, an exception will automatically be sent if the client tries to use an invalid value.