WCF Services—Hello World with Interfaces
|Visual C# Tutorials|
|.NET Framework Tutorials|
|© 2007 Chris Peiris, Dennis Mulder|
"Hello, World" with Interfaces
A best practice in WCF is to define a contract up front, as an interface, and then provide the implementation of that interface in a concrete class. Why? This provides a clear abstraction of the contract from the implementation. The other aspect of this approach is a clear distinction of the service boundary (remember the "boundaries are explicit" SOA tenet) from the implementation. Although the service interface definition is in code, and not in metadata, it’s a clear perimeter that permits some flexibility for exposing only what’s necessary and that provides design-time and configuration-time flexibility.