== Why is this an issue?

The ``++ServiceContract++`` attribute specifies that a class or interface defines the communication contract of a Windows Communication Foundation (WCF) service. The service operations of this class or interface are defined by ``++OperationContract++`` attributes added to methods. It doesn't make sense to define a contract without any service operations; thus, in a ``++ServiceContract++`` class or interface at least one method should be annotated with ``++OperationContract++``. Similarly, WCF only serves ``++OperationContract++`` methods that are defined inside ``++ServiceContract++`` classes or interfaces; thus, this rule also checks that ``++ServiceContract++`` is added to the containing type of ``++OperationContract++`` methods.


=== Noncompliant code example

[source,csharp]
----
[ServiceContract]
interface IMyService // Noncompliant
{
  int MyServiceMethod();
}
----


=== Compliant solution

[source,csharp]
----
[ServiceContract]
interface IMyService
{
  [OperationContract]
  int MyServiceMethod();
}
----


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

* Add the "OperationContract" attribute to the methods of this [class|interface].
* Add the "ServiceContract" attribute to this [class|interface].


=== Highlighting

type name


'''
== Comments And Links
(visible only on this page)

=== on 7 Apr 2016, 15:07:19 Tamas Vajk wrote:
\[~ann.campbell.2] Could you review this spec? Thanks.

=== on 7 Apr 2016, 17:49:47 Ann Campbell wrote:
\[~tamas.vajk] this needs an explanation of _why_ ``++ServiceContract++`` and ``++OperationContract++`` are useless without each other. I'm guessing that will also require a little background on what a ``++ServiceContract++`` is and what an ``++OperationContract++`` is.

=== on 8 Apr 2016, 08:57:59 Tamas Vajk wrote:
\[~ann.campbell.2] What do you think now?

=== on 8 Apr 2016, 16:05:40 Ann Campbell wrote:
Very good [~tamas.vajk]

=== on 11 Apr 2016, 10:18:49 Tamas Vajk wrote:
\[~ann.campbell.2] I added labels to this rule. Let me know if you don't agree with them.


Also, what does "Partial" completeness mean?

=== on 11 Apr 2016, 13:54:49 Ann Campbell wrote:
\[~tamas.vajk] I've dropped the 'convention' tag which is typically only applied to naming and formatting rules; not to "I think you did something wrong" rules.


"Partial" completion means we're not done writing the rule yet. I've bumped this one up to "full".

endif::env-github,rspecator-view[]
