A problem about the "DataPortal_OnDataPortalException" method

A problem about the "DataPortal_OnDataPortalException" method

Old forum URL: forums.lhotka.net/forums/t/10467.aspx


Colorful.MrC posted on Sunday, June 26, 2011

I'm a Chinese programer, and my English is to bad, I hope someone can understand and answer my quesstion.

quesstion:

I want catch the server side exception and record it, I use "DataPortal_OnDataPortalException" method to catch the exception and record the exception in it, but I didn't want the client can see the real exception so I want rewrite the exception in  "DataPortal_OnDataPortalException" method, but I found I can't rewrite the exception in  "DataPortal_OnDataPortalException" method. Now I want to know how to deal with this problem.

 

HK.Lee replied on Monday, June 27, 2011

Hi MrC,

There is CslaDataPortalExceptionInspector settings in DataPortal, which is well explained in DataAccess.pdf of Rocky's new e-book . With this inspector, you can trap exceptions in server side before seding them to client and log them somewhere like event log and also can re-write exception as you wish.

The setting in webconfig is as follows;

<appSettings>

     <add key="CslaDataPortalExceptionInspector" value="MyLibrary.PortalInspector,MyLibrary"/>

</appSettings>

and In your portal instector class, you can implement IDataPortalExceptionInspector interface.

For further details, you had better look into e-book.

HK.Lee

 

 

 

 

Colorful.MrC replied on Monday, June 27, 2011

Thank you very much

Copyright (c) Marimer LLC