Im creating a service contract in my wcf application and it contains a lot of methods.
I find it very annoying to write an OperationContract attribute to all of them.
Is there any simple way how to say "every method in my ServiceContract interface is an OperationContract" ?
thank you
Yes, you can use AOP framework for that. E.g. with PostSharp:
This attribute used to mark methods which should not be operation contracts:
Now all you need to do is apply
AutoServiceContractattribute to service interface. That will addServiceContractattribute to interface, and all public methods will be marked withOperationContactattribute (except those which haveNotOperationContractattribute):