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); } }
private void AddReceiverNameConstraint(IDictionary <object, object> properties, SelectorModel selector) { var bodyTypeMetadataObject = properties[typeof(IWebHookBodyTypeMetadataService)]; WebHookReceiverNameConstraint constraint; if (bodyTypeMetadataObject is IWebHookBodyTypeMetadataService bodyTypeMetadata) { constraint = new WebHookReceiverNameConstraint(bodyTypeMetadata); } else { constraint = new WebHookReceiverNameConstraint(_metadataProvider); } selector.ActionConstraints.Add(constraint); }
private void AddReceiverExistsConstraint( IDictionary <object, object> properties, IList <SelectorModel> selectors) { var bodyTypeMetadataObject = properties[typeof(IWebHookBodyTypeMetadataService)]; WebHookReceiverNameConstraint constraint; if (bodyTypeMetadataObject is IWebHookBodyTypeMetadataService bodyTypeMetadata) { constraint = new WebHookReceiverNameConstraint(bodyTypeMetadata); } else { constraint = new WebHookReceiverNameConstraint(_metadataProvider); } AddConstraint(constraint, selectors); }