Policy Injection, Attributes VS application settings

Topics: Policy Injection Application Block
Jan 11, 2008 at 9:43 PM
Hello,

I just discovered the Enterprise library and think it could help me a lot in my development.

I've been playing with it the entire day. I now got a question.

I've made a CallHandler that just connect to a site web and reports if connection was successful.

I integrated that handler in the policies, in the application settings.

I also made this handler usable as an attributes on methods.

Thing is, when the handler is defined in the application settings and on a method, when I call this particular method, the handler is called twice.
I see and understand why.

My question:

How can I make the handler defined in the application settings the "default" handler, but is not called when a particular method has the same handler as attribute, so only the attributed handler is executed?

I guessed I could make a matching rule to prevent that. But since I just started using this library, I'm not to sure ho I could do that, if it's the right way to do this, if it can be done at all.

Any one has a suggestion, comments, anything.

thank you for reading.
Jan 13, 2008 at 6:38 AM
There isn't any built-in way to prevent the same handler from being added twice.
However you could use the Custom Attribute Matching Rule to search for the attribute-based handler in your config-based policy. However you really want to apply your policy when the attribute isn't there. To accomplish this, you'll want the Boolean matching rule extensions (AND/OR/NOT) which are a part of /entlibcontrib.

HTH
Tom