private static bool HandlerIsMatchForPolicyName(IPolicyViolationHandler handler, PolicyViolationException exception) { var expectedHandlerName = "{0}ViolationHandler".FormatWith(exception.PolicyType.Name); var actualHandlerName = handler.GetType().Name; return(expectedHandlerName == actualHandlerName); }
private static bool HandlerIsMatchForException(IPolicyViolationHandler handler, string policyName) { var expectedHandlerName = "{0}ViolationHandler".FormatWith(policyName); var actualHandlerName = handler.GetType().Name; return(expectedHandlerName == actualHandlerName); }
private static bool HandlerIsMatchForException(IPolicyViolationHandler handler, PolicyViolationException exception) { var expectedHandlerName = "{0}ViolationHandler".FormatWith(exception.PolicyType.Name); var actualHandlerName = handler.GetType().Name; return expectedHandlerName == actualHandlerName; }
public IPolicyViolationHandler FindHandlerFor(PolicyViolationException exception) { IPolicyViolationHandler matchingHandler = null; foreach (var violationHandlerConvention in _conventions) { var convention = violationHandlerConvention; Publish.RuntimeEvent(() => { var conventionName = convention.ToString(); return("Finding policy violation handler using convention {0}.".FormatWith(conventionName)); }, exception.SecurityContext); matchingHandler = convention.GetHandlerFor(exception); if (matchingHandler != null) { Publish.RuntimeEvent(() => "Found policy violation handler {0}.".FormatWith(matchingHandler.GetType().FullName), exception.SecurityContext); break; } } return(matchingHandler); }
private static bool HandlerIsDefaultPolicyViolationHandler(IPolicyViolationHandler handler) { var actualHandlerName = handler.GetType().Name; return(actualHandlerName == "DefaultPolicyViolationHandler"); }
private static bool HandlerIsDefaultPolicyViolationHandler(IPolicyViolationHandler handler) { var actualHandlerName = handler.GetType().Name; return actualHandlerName == "DefaultPolicyViolationHandler"; }