public WebHookTriggerBinding(WebHookDispatcher dispatcher, ParameterInfo parameter, bool isUserTypeBinding, WebHookTriggerAttribute attribute) { _dispatcher = dispatcher; _parameter = parameter; _isUserTypeBinding = isUserTypeBinding; _attribute = attribute; if (_isUserTypeBinding) { // Create the BindingDataProvider from the user Type. The BindingDataProvider // is used to define the binding parameters that the binding exposes to other // bindings (i.e. the properties of the POCO can be bound to by other bindings). // It is also used to extract the binding data from an instance of the Type. _bindingDataProvider = BindingDataProvider.FromType(parameter.ParameterType); } Uri baseAddress = new Uri(string.Format("http://localhost:{0}", dispatcher.Port)); _route = FormatWebHookUri(baseAddress, attribute, parameter); }
internal static Uri FormatWebHookUri(Uri baseAddress, WebHookTriggerAttribute attribute, ParameterInfo parameter) { // build the full route from the base route string subRoute; if (!string.IsNullOrEmpty(attribute.Route)) { subRoute = attribute.Route; } else { MethodInfo method = (MethodInfo)parameter.Member; subRoute = string.Format("{0}/{1}", method.DeclaringType.Name, method.Name); } return new Uri(baseAddress, subRoute); }