GlobalExceptionHandlerDotNet
GlobalExceptionHandlerDotNet copied to clipboard
Is it possible to add a non-generic method of Map<T>() ?
I would like to scan the Implement classes of the interface IException
that I defined to custom StatusCode
in GlobalExceptionHandler, but with generic version of Map<T>()
, I had to use reflection to achieve that, it's a bit of annoying... is it possible to add a non-generic version of Map<T>()
, such as Map(Type t)
?
or add a property of StatusCode
to ExceptionHandlerConfiguration
?
var exceptionList = Assembly.GetExecutingAssembly().GetTypes().Where(t => t != typeof(IException) && typeof(IException).IsAssignableFrom(t)).ToList();
foreach (var item in exceptionList)
{
/// can not use o.Map<T>() here directly.
}