locked
when to use policy injection? RRS feed

  • Question

  • User1885169913 posted

    Can this be used for scenarios like wrapping code in methods with try/catch statements when they're the same in every method? If so does anyone have a sample with castle windsor or enterprise library?

    Monday, December 21, 2009 8:20 AM

Answers

  • User78336405 posted

    Hi,

    An application block is reusable and extensible source code-based guidance that simplifies development of common policy injection functionality in .NET Framework applications. Crosscutting concerns are the necessary tasks, features, or processes that are common across different objects—for example, logging, authorization, validation, and instrumentation. Developers can use the Policy Injection Application Block to specify crosscutting behavior of objects in terms of a set of policies. A policy is the combination of a series of handlers that execute when client code calls methods of the class and—with the exception of attribute-based policies—a series of matching rules that select the classes and class members (methods and properties) to which the application block attaches the handlers. Attribute-based policies rely on attributes directly applied to the members of the target class to identify those to which the application block will apply policies. The result is a mechanism for declaratively applying a chain of handlers to members of the target class instance. This chain of handlers is a pipeline.

    For more details, please refer:http://msdn.microsoft.com/en-us/library/cc309507.aspx , http://www.devx.com/dotnet/Article/34517 . 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 23, 2009 1:16 AM

All replies

  • User78336405 posted

    Hi,

    An application block is reusable and extensible source code-based guidance that simplifies development of common policy injection functionality in .NET Framework applications. Crosscutting concerns are the necessary tasks, features, or processes that are common across different objects—for example, logging, authorization, validation, and instrumentation. Developers can use the Policy Injection Application Block to specify crosscutting behavior of objects in terms of a set of policies. A policy is the combination of a series of handlers that execute when client code calls methods of the class and—with the exception of attribute-based policies—a series of matching rules that select the classes and class members (methods and properties) to which the application block attaches the handlers. Attribute-based policies rely on attributes directly applied to the members of the target class to identify those to which the application block will apply policies. The result is a mechanism for declaratively applying a chain of handlers to members of the target class instance. This chain of handlers is a pipeline.

    For more details, please refer:http://msdn.microsoft.com/en-us/library/cc309507.aspx , http://www.devx.com/dotnet/Article/34517 . 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 23, 2009 1:16 AM
  • User1885169913 posted

    Thank you for the explanation. I will take a look at these mentioned tutorials and will get back to you.

    Wednesday, December 23, 2009 4:28 AM