Generate Exception on client, when WCF-Connection has aborted

Generate Exception on client, when WCF-Connection has aborted

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


t.kehl posted on Tuesday, January 29, 2013

Hi

I have developers who are using my BusinessLibrary on the client side. They work with several servers. Switch to one server and Create/Load/Delete and Save BusinessObjects to it. Now, I am searching for a way to throw a ServerNotAvailable Exception when the WCF-Connection has aborted (for example when the server was shutted down or the network has broken). Now, the developers has to handle System.ServiceModel.CommunicationException. I am searching for a central place where I can replace this CommunicationException with a own ServerNotAvailableException.

Can someone help me, how I can do this?

Thank you.

Best Regards, Thomas

JonnyBee replied on Tuesday, January 29, 2013

Hi,

Hook into the static event DataPortalInvokeComplete on the Csla.DataPortal.

This is called immediately after the DataPortal call is completed (whether it failed or not) and you can rethrow your own exception.

Copyright (c) Marimer LLC