Wrapper and replace Handlers

Topics: Building and extending application blocks, Caching Application Block , Cryptography Application Block, Data Access Application Block, Enterprise Library Core, Exception Handling Application Block, General discussion, Logging Application Block, Policy Injection Application Block, Pre-release discussions, Security Application Block, Validation Application Block
Oct 26, 2007 at 5:53 AM
Hi,
new to the Enterprise Library.
The product seems fantastic but I am quite amazed I could not find a walkthrough tutorial on the most important part of it.How are you supposed to set up your configuration tool?
I want to use both ExceptionHandling and logging ,they seem fairly straightforward to use.However let's suppose in my "DataLayer Policy" I want to replace all the exceptions that are related to sqlConnections with another,so that you dont see sensitive info.How do you start?I know how should use a replace handler.Do I need to write one and how?Same goes for the wrapper How do use it?
Can we have a simple winform app that explains that shows the exceptions and than explains how/why we configured the exception block that way?

It would save me hours of googling if somebody could post or send me an explanation on how to use a replace /wrapper handle.The silliest of example will do.

thanks again
Oct 26, 2007 at 3:04 PM
Hi,

Have you taken a look at the "Key Scenarios" for the EHAB in the help file? The "Replacing an Exception" topic (ms-help://ms.EntLib.2007May/EnterpriseLibrary/html/05-140-Replacing_an_Exception.htm) describes what you need to do and points you to the QuickStart application that you can run to see it working...

For a more advanced scenario, you might want to look at this post from Tom http://blogs.msdn.com/tomholl/archive/2007/08/01/mapping-sql-server-errors-to-net-exceptions-the-fun-way.aspx.

Hope this helps,
Fernando
Oct 29, 2007 at 10:19 AM

Thanks for your reply.Your first link doesnt work.
Am I correct in saying that when we want to use a replace Handler we need to write a new Class and use the following:?
ConfigurationElementType(typeof(CustomHandlerData))
public class MyReplaceExceptionHandler : IExceptionHandler

etc.....

But still not sure about whether we have to write a class or new project in order to be picked up by ent Lib.

thanks again





fsimonazzi wrote:
Hi,

Have you taken a look at the "Key Scenarios" for the EHAB in the help file? The "Replacing an Exception" topic (ms-help://ms.EntLib.2007May/EnterpriseLibrary/html/05-140-Replacing_an_Exception.htm) describes what you need to do and points you to the QuickStart application that you can run to see it working...

For a more advanced scenario, you might want to look at this post from Tom http://blogs.msdn.com/tomholl/archive/2007/08/01/mapping-sql-server-errors-to-net-exceptions-the-fun-way.aspx.

Hope this helps,
Fernando

Oct 30, 2007 at 1:47 PM
Hi,


devnet247 wrote:

Thanks for your reply.Your first link doesnt work.


Assuming EntLib's help is installed in your computer, it should. Try opening the help explorer and setting the URL manually.


Am I correct in saying that when we want to use a replace Handler we need to write a new Class and use the following:?
ConfigurationElementType(typeof(CustomHandlerData))
public class MyReplaceExceptionHandler : IExceptionHandler

etc.....

But still not sure about whether we have to write a class or new project in order to be picked up by ent Lib.


No, it shouldn't be necessary to create a new one in most cases. Both the help topic I linked and the quick start show how accomplish this without new classes; did the QuickStart work for you?

Fernando