Service Development

Using interface to describe the service is preferable, because this constitutes a contract for the operations performed by the service that can be reused with various classes that might implement that same contract in different ways.



  1. Classes or Interfaces
  2. (http://msdn.microsoft.com/en-us/library/ms733070.aspx)

    Both classes and interfaces represent a grouping of functionality and, therefore, both can be used to define a WCF service contract. However, it is recommended that you use interfaces because they directly model service contracts. Without an implementation, interfaces do no more than define a grouping of methods with certain signatures. Likewise, a service contract without an implementation defines a grouping of operations with certain signatures. Implement a service contract interface and you have implemented a WCF service.
    All the benefits of managed interfaces apply to service contract interfaces:
    Service contract interfaces can extend any number of other service contract interfaces.
    A single class can implement any number of service contracts by implementing those service contract interfaces.
    You can modify the implementation of a service contract by changing the interface implementation, while the service contract remains the same.
    You can version your service by implementing the old interface and the new one. Old clients connect to the original version, while newer clients can connect to the newer version.
    You can, however, use a class to define a service contract and implement that contract at the same time. The advantage of creating your services by applying ServiceContractAttribute and OperationContractAttribute directly to the class and the methods on the class, respectively, is speed and simplicity. The disadvantages are that managed classes do not support multiple inheritance, and as a result they can only implement one service contract at a time. In addition, any modification to the class or method signatures modifies the public contract for that service, which can prevent unmodified clients from using your service.


    A WCF service is provided by defining one or more WCF endpoints. An endpoint is defined by an address, a binding and a service contract. The address defines where the service is located. The binding specifies how to communicate with the service. The service contract defines the operations that the service can perform.

  3. Parameters and Return Values


  4. Parameters and Return Values