Developer
Developer

Reputation: 18649

Creating WCF Services

Can a class have a "Service Contract" attribute and its methods "Operation Contract". Or do these need to be applied to an interface which the class would have to implement?

Upvotes: 0

Views: 132

Answers (1)

casperOne
casperOne

Reputation: 74530

You can place the ServiceContract and OperationContract attributes on a class, but that is considered bad practice. It's better to abstract out to an interface and then place the attributes (that are contract related, not implementation related, as those do exist in WCF) on the contract.

Upvotes: 1

Related Questions