Exception Handling on Class Library

Topics: Exception Handling Application Block
Dec 4, 2014 at 9:45 AM
Currently I have a class library project, can I implement the exception handling policy on class library? How to implement it?
Dec 6, 2014 at 4:17 AM
I assume you mean you want to configure the class library to use Exception Handling. The usual (and easiest) approach to .NET configuration is to place the required configuration in app/web.config.

If that does not work for your scenario you could manually load the configuration using a FileConfigurationSource with an expected configuration file (or user defined). This could be setup with a bootstrap method that should be called before using the library. Or to try to load automatically you could try some of the more esoteric solutions provided to this question: Initialize library on Assembly load.

Randy Levy
Enterprise Library support engineer
Support How-to