Exception Handling with AOP appraoch

Topics: Enterprise Library Core, Exception Handling Application Block, General discussion, Logging Application Block, Policy Injection Application Block
Oct 24, 2008 at 4:14 AM
Hi All,

Is possible to use the exception handling block with AOP approach?

What I want to do is:-
Whatever exception occurred, it will jump to exception handling block to handle this exception without use ExceptionPolicy.HandleException syntax.

Oct 24, 2008 at 5:11 AM
You need to catch the exceptions, but you can create a helper class to avoid writing the try catch blocks and the HandleException method over and over again.  For a sample helper method, see this thread: http://www.codeplex.com/entlib/Thread/View.aspx?ThreadId=37570
Oct 24, 2008 at 11:17 AM

You can use PIAB with the ExceptionCallHandler to get the behavior you are looking for. Note however that there are limitations on when PIAB can be used which might be showstoppers in your scenario; if that's the case then you'll need to use EHAB the usual way adding code to your methods.