Exemplo n.º 1
0
        public EndpointDescriptor(
            ActionDescriptor actionDescriptor,
            object[] arguments,
            string host,
            string protocol)
        {
            this.Policies = ComputePolicies(actionDescriptor);

            var parameters = actionDescriptor
                             .Parameters
                             .OfType <ControllerParameterDescriptor>()
                             .ToArray();

            this.Host                = host;
            this.Protocol            = protocol;
            this.Body                = actionDescriptor.PickBodyArgument(arguments);
            this.Template            = actionDescriptor.AttributeRouteInfo.Template.ToLower();
            this.Method              = actionDescriptor.GetHttpMethod().ToUpper();
            this.ArgumentsCollection = new ArgumentCollection(parameters, arguments);

            this.BodyArgument = this.ArgumentsCollection.SingleOrDefault(argument => argument.Descriptor.BindingInfo.BindingSource.Id == "Body");
        }