internal bool Dispatch( CallbackPolicy policy, object target, object callback, bool greedy, IHandler composer, Func <object, bool> results = null) { if (policy == null) { throw new ArgumentNullException(nameof(policy)); } PolicyMethods methods = null; if (_methods?.TryGetValue(policy, out methods) != true) { return(false); } var dispatched = false; var indexes = methods.Keys; var keys = indexes == null ? null : policy.SelectKeys(callback, indexes); foreach (var method in methods.GetMethods(keys)) { dispatched = method.Dispatch(target, callback, composer, results) || dispatched; if (dispatched && !greedy) { return(true); } } return(dispatched); }
public PolicyMethodBinding(MethodRule rule, MethodDispatch dispatch, DefinitionAttribute attribute, CallbackPolicy policy) : base(dispatch) { if (rule == null) { throw new ArgumentNullException(nameof(rule)); } if (dispatch == null) { throw new ArgumentNullException(nameof(dispatch)); } Rule = rule; Attribute = attribute; Policy = policy; }