Service contracts
The Service Contract Attribute is defined as:
[AttributeUsage(AttributeTargets.Interface|AttributeTargets.Class,
Inherited = false)]
public sealed class ServiceContractAttribute : Attribute
{
public string Name
{get;set;}
public string Namespace
{get;set;}
//More members
}
Defining and implementing a service contract:
[ServiceContract]
interface IMyContract
{
[OperationContract]
string show(string text);
//Will not be part of the contract
string show(string text);
}
class MyService : IMyContract
{
public string show(string text)
{
return "Hello " + text;
}
public string show(string text)
{
return "Cannot call this method over WCF";
}
}