In my interface, I will have many functions. All of these will be binded as OperationContract.
Is there a way to avoid typing [OperationContract] on every single one of these functions?
[ServiceContract]
public interface IStudentService
{
[OperationContract]
String GetStudentFullName (int studentId);
[OperationContract]
StudentInformation GetStudentInfo (int studentId);
... about 20 more
}
You should avoid service contracts, containing big number (like 20 or more) of operation contracts.
First you can do, is to change pattern, which your service is build on. Instead of posting and returning single data value as a result of operation, use DTOs (or STE, if this is applicable for you) and operate on object graph:
The second thing – break such contracts into small ones (remember single responsibility principle). You shouldn’t do contracts, which are responsible for all over the world.