/// <summary>
        /// Tries to resolve the action by invoking TryResolveServiceAction on the underlying provider.
        /// This is a lower-level call which does not cache results. Caching should be provided by the caller.
        /// </summary>
        /// <param name="serviceActionName">The name of the service action taken from a segment of the URI.</param>
        /// <param name="bindingType">The current binding type of the action, or null if there is no binding type.</param>
        /// <param name="action">The action if one is returned from the provider.</param>
        /// <returns>Whether or not the provider returned an action for the given inputs.</returns>
        private bool TryResolveServiceActionFromProvider(string serviceActionName, ResourceType bindingType, out ServiceAction action)
        {
            if (!this.TryLoadActionProvider())
            {
                action = null;
                return(false);
            }

            if (this.actionResolver != null)
            {
                var resolverArgs = new ServiceActionResolverArgs(serviceActionName, bindingType);
                return(this.actionResolver.TryResolveServiceAction(this.OperationContext, resolverArgs, out action));
            }

            return(this.actionProvider.TryResolveServiceAction(this.OperationContext, serviceActionName, out action));
        }
        public bool TryResolveServiceAction(DataServiceOperationContext context, ServiceActionResolverArgs resolverArgs, out ServiceAction serviceAction)
        {
            string actionName = resolverArgs.ServiceActionName;
            IEnumerable<ServiceAction> possibleMatches = this.GetServiceActions(context).Where(a => a.Name == actionName);
            if (possibleMatches.Count() == 1)
            {
                serviceAction = possibleMatches.Single();
            }
            else if (resolverArgs.BindingType == null)
            {
                // unbound action
                serviceAction = possibleMatches.SingleOrDefault(a => a.BindingParameter == null);
            }
            else
            {
                serviceAction = possibleMatches.SingleOrDefault(a => a.BindingParameter != null && a.BindingParameter.ParameterType.FullName == resolverArgs.BindingType.FullName);
            }

            return serviceAction != null;
        }