示例#1
0
            public ApiDescription(System.Web.Http.Description.ApiDescription desc, XmlDocumentationProvider xmlDocProvider)
                : this()
            {
                this.Name          = desc.ActionDescriptor.ActionName;
                this.RelativePath  = desc.RelativePath;
                this.HttpMethod    = desc.HttpMethod.Method;
                this.Controller    = desc.ActionDescriptor.ControllerDescriptor.ControllerName;
                this.Documentation = xmlDocProvider.GetDocumentation(desc.ActionDescriptor);
                this.ReturnType    = xmlDocProvider.GetResponseDocumentation(desc.ActionDescriptor);

                string permissionCref = null;

                this.PermissionDescription = xmlDocProvider.GetPermissionDocumentation(desc.ActionDescriptor, out permissionCref);
                this.PermissionCref        = permissionCref;

                foreach (var paramDesc in desc.ParameterDescriptions)
                {
                    if (paramDesc.Source == ApiParameterSource.FromBody)
                    {
                        this.BodyType = paramDesc.ParameterDescriptor.ParameterType.ToString();
                    }
                    else
                    {
                        this.Parameters.Add(new ApiParameter(paramDesc, xmlDocProvider));
                    }
                }
            }