My application uses Exception Handling Application Block to handle exception handling. Now, I need to include additional functionality found in the Enterprise Library.
Enterprise Library has LogEntry class to log additional context information such as
ManagedSecurityContextInformationProvider, and UnmanagedSecurityContextInformationProvider.
But it's unclear how to attach these extra information into Exception Handling Application Block. The document only demonstrates these function as code, but I cannot tell how to incorporate these code decoratively as part of
Exception Handling Application Block.
Can someone share his thought on how to make this possible?
Thanks in advance.
As stated in the documentation - "The ExtraInformation providers add the information to a dictionary. You can choose which providers to use (if any) and add the resulting dictionary to the
LogEntry.ExtendedProperties property.". Given this, the approach I can think of is to iterate thru the values of the extra information dictionary object and add it in the exception Data collection property that will then be handled
by your EHAB.
It may look something like this;
ExceptionManager exManager = EnterpriseLibraryContainer.Current.GetInstance<ExceptionManager>();
throw new Exception("test exception with extra info");
catch (Exception ex)
DebugInformationProvider debugProvider = new DebugInformationProvider();
IDictionary<string, object> dict = new Dictionary<string, object>();
foreach (var item in dict)
Hope this helps.
Global Technologies and Solutions