I just started using the Policy Injection Application Block from Microsoft’s Enterprise library. At first, I thought it was worthless and overly complex. I was wrong. It is a very powerful programming tool that allows me to develop a lot faster and cleaner.
Policy Injection is similar to aspect-oriented programming in that it helps to break away cross-cutting concerns (authorization, logging) from the actual business logic. And yes, I basically copied that from the documentation.
Here is what policy injection means for me. I can build business logic, which performs only what I want it to. So I can have a function called AddUser and all that is done is the actual operation of adding that user. I can then attach policies to that function, which specify how to authorize and log it. This has a couple effects. One, it reduces the amount of code which in turn cleans up the code. Second, it allows me to customize cross-cutting concerns for different projects. If I have an administrative application, I need to authorize differently than a user application. Policy injection makes this possible without dirtying up the code.
After the initial few hours of getting used to using it, I am a huge proponent. I definitely recommend checking it out.