private (bool, string) CanLog(ActionDescriptor actionDescriptor) { var nameMethod = actionDescriptor.GetType().GetMethod("get_ActionName"); string name = (string)nameMethod.Invoke(actionDescriptor, null); bool canLog = exclusionList == null || exclusionList.Length == 0 || !exclusionList.Contains(name, StringComparer.CurrentCultureIgnoreCase); return(canLog, name); }
public static ControllerActionDescriptor AsControllerActionDescriptor(ActionDescriptor actionDescriptor) { if (actionDescriptor is not ControllerActionDescriptor controllerActionDescriptor) { throw new InvalidCastException($"{nameof(ActionDescriptor)} cannot convert to {nameof(ControllerActionDescriptor)}," + $"Because of {nameof(ActionDescriptor)} type is : {actionDescriptor.GetType().Name}"); } return(controllerActionDescriptor); }