24 #region Custom Exception Inspector Loader
26 private static string _datePortalInspecorName;
35 if (_datePortalInspecorName ==
null)
37 string setting = ConfigurationManager.AppSettings[
"CslaDataPortalExceptionInspector"];
38 if (!
string.IsNullOrEmpty(setting))
39 _datePortalInspecorName = setting;
41 return _datePortalInspecorName;
45 _datePortalInspecorName = value;
68 #region DataPortal Exception
78 public Exception
InspectException(Type objectType,
object criteria,
string methodName, Exception ex)
80 Exception handledException;
83 if (CallExceptionInspector(objectType,
null, criteria, methodName, ex.InnerException, out handledException))
90 if (CallExceptionInspector(objectType,
null, criteria, methodName, ex, out handledException))
92 ex = handledException;
108 public Exception
InspectException(Type objectType,
object businessObject,
object criteria,
string methodName, Exception ex)
111 Exception handledException;
114 if (CallExceptionInspector(objectType, businessObject, criteria, methodName, ex.InnerException, out handledException))
122 if (CallExceptionInspector(objectType,
null, criteria, methodName, ex, out handledException))
124 ex = handledException;
142 private bool CallExceptionInspector(Type objectType,
object businessObject,
object criteria,
string methodName, Exception exception, out Exception handledException)
144 handledException =
null;
145 var inspector = GetExceptionInspector();
147 if (inspector ==
null)
return false;
152 inspector.InspectException(objectType, businessObject, criteria, methodName, exception);
156 handledException = ex;
A strongly-typed resource class, for looking up localized strings, etc.
static string MethodCallFailed
Looks up a localized string similar to method call failed.
This exception is returned from the CallMethod method in the server-side DataPortal and contains the ...
This class provides a hoook for developers to add custom error handling in the DataPortal.
static string ExceptionInspector
Gets or sets the fully qualified name of the ExceptionInspector class.
Exception InspectException(Type objectType, object businessObject, object criteria, string methodName, Exception ex)
Transforms the exception in a Update, Delete method
Exception InspectException(Type objectType, object criteria, string methodName, Exception ex)
Transforms the exception in a Fetch, Create or Execute method.
Implement this interface to check a DataPortalException before returning Exception to the client.