views:

463

answers:

2

Take for example a project with 10 services and 20 methods on each service.

All services inherit from a base services which has a security check. The first thing each method does is to make a call to the security check. This throws a security exception if there is a problem.

Question is: Do I need to specify a FaultContract on each method (OperationContract), or can I do it once in a central definition?

+2  A: 

Yes on each operation contract

Preet Sangha
+1  A: 

No, you need to do it on each and every method - WCF is rather picky and requires explicit settings pretty much for everything (which really is a good thing in the end, I am convinced).

Marc

marc_s
Surely you'd agree that it should be possible to implement cross-cutting concerns like security in an orthogonal manner. It seems odd to me that I can implement a nice `ServiceAuthorizationManager` in a decoupled manner, but then I have to go sprinkle my contracts with repetitive junk if I want to throw a custom security fault.
Kent Boogaart
I agree, I'm looking for a method to do the repetitive junk automatically, too.
Joel