Rule Definition
A Service Contract basically describes the operations a service exposes to another party (in other words a client). It's recommended to apply the ServiceContract attribute to an interface, although it can be applied to a class as well. Operation Contract is applied to a method to indicate that the method implements a service operation as part of a service contract.
Thus to have a service contract without any meaningful operation contract(method) to do a task indicates missing logic.
Remediation
Always define a service operation method and annotate it with Operation Contract
Violation Code Sample
[ServiceContract]
interface ISimpleService
{
string SimpleOperation(); //Violation
}
Fixed Code Sample
[ServiceContract]
interface ISimpleService
{
[OperationContract] //Violation Fixed
string SimpleOperation();
}
Reference
https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.operationcontractattribute?view=dotnet-plat-ext-3.1
Related Technologies
Technical Criterion
Programming Practices - Structuredness
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.