Reputation: 4915
Why is the OperationContract attribute required in a WCF service function?
Upvotes: 5
Views: 7829
Reputation: 22655
The OperationContact attribute explicitly declares that a method is an operation on a ServiceContract.
Why is it required? The main reason is that most of WCF is opt-in and this is no different. WCF does not assume that simply because a method is part of an interface that you want to expose that method as a service operation. It is left to the programmer to decide (and explicitly indicate) what they want to expose.
Upvotes: 7