private void AddIdConstraint(WebHookAttribute attribute, SelectorModel selector) { if (attribute.Id != null) { var constraint = new WebHookIdConstraint(attribute.Id); selector.ActionConstraints.Add(constraint); } }
private void AddIdConstraint(WebHookAttribute attribute, IList <SelectorModel> selectors) { if (attribute.Id != null) { var constraint = new WebHookIdConstraint(attribute.Id); AddConstraint(constraint, selectors); } }
private void AddConstraints(WebHookAttribute attribute, IList <SelectorModel> selectors) { AddConstraint(_existsConstraint, selectors); if (attribute.ReceiverName != null) { var constraint = new WebHookReceiverNameConstraint(attribute.ReceiverName); AddConstraint(constraint, selectors); } if (attribute.Id != null) { var constraint = new WebHookIdConstraint(attribute.Id); AddConstraint(constraint, selectors); } }
// Set the template for given SelectorModel. Similar to WebHookActionAttributeBase implementing // IRouteTemplateProvider. private static void AddTemplate(WebHookAttribute attribute, string template, SelectorModel selector) { if (selector.AttributeRouteModel?.Template != null) { var message = string.Format( CultureInfo.CurrentCulture, Resources.RoutingProvider_MixedRouteWithWebHookAttribute, attribute.GetType().Name, selector.AttributeRouteModel.Attribute?.GetType().Name); throw new InvalidOperationException(message); } if (selector.AttributeRouteModel == null) { selector.AttributeRouteModel = new AttributeRouteModel(); } selector.AttributeRouteModel.Template = template; }