当前位置: 首页>>代码示例>>C#>>正文


C# HttpActionDescriptor.GetParameters方法代码示例

本文整理汇总了C#中HttpActionDescriptor.GetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# HttpActionDescriptor.GetParameters方法的具体用法?C# HttpActionDescriptor.GetParameters怎么用?C# HttpActionDescriptor.GetParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpActionDescriptor的用法示例。


在下文中一共展示了HttpActionDescriptor.GetParameters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Map

 public HttpParameterDescriptor Map(Parameter swaggerParameter, int parameterIndex, HttpActionDescriptor actionDescriptor)
 {
     // Maybe the parameter is a key parameter, e.g., where Id in the URI path maps to a parameter named 'key'
     if (swaggerParameter.description != null && swaggerParameter.description.StartsWith("key:"))
     {
         // Find either a single 'key' in the route or composite keys
         // which take the form of key<parameter name>
         var keyParameterName = swaggerParameter
                                 .description
                                 .Replace(FindKeyReplacementSubStr, 
                                             String.Empty)
                                 .ToLower();
         var parameterDescriptor = 
             actionDescriptor
                 .GetParameters()?
                 .SingleOrDefault(descriptor =>
                     descriptor.ParameterName.ToLower() == KeyName
                     || descriptor.ParameterName.ToLower().Equals(keyParameterName)
                 );
         if (parameterDescriptor != null && !parameterDescriptor.IsODataLibraryType())
         {
             var httpControllerDescriptor = actionDescriptor.ControllerDescriptor;
             Contract.Assume(httpControllerDescriptor != null);
             return new ODataParameterDescriptor(swaggerParameter.name, parameterDescriptor.ParameterType, parameterDescriptor.IsOptional, parameterDescriptor)
             {
                 Configuration = httpControllerDescriptor.Configuration,
                 ActionDescriptor = actionDescriptor,
                 ParameterBinderAttribute = parameterDescriptor.ParameterBinderAttribute
             };
         }
     }
     return null;
 }
开发者ID:rbeauchamp,项目名称:Swashbuckle.OData,代码行数:33,代码来源:MapByDescription.cs

示例2: CreateParameterDescription

        private IList<ApiParameterDescription> CreateParameterDescription(HttpActionBinding actionBinding,HttpActionDescriptor actionDescriptor)
        {
            IList<ApiParameterDescription> parameterDescriptions = new List<ApiParameterDescription>();
            // try get parameter binding information if available
            if (actionBinding != null)
            {
                HttpParameterBinding[] parameterBindings = actionBinding.ParameterBindings;
                if (parameterBindings != null)
                {
                    foreach (HttpParameterBinding parameter in parameterBindings)
                    {
                        parameterDescriptions.Add(CreateParameterDescriptionFromBinding(parameter));
                    }
                }
            }
            else
            {
                Collection<HttpParameterDescriptor> parameters = actionDescriptor.GetParameters();
                if (parameters != null)
                {
                    foreach (HttpParameterDescriptor parameter in parameters)
                    {
                        parameterDescriptions.Add(CreateParameterDescriptionFromDescriptor(parameter));
                    }
                }
            }

            return parameterDescriptions;
        }
开发者ID:ZhaoRd,项目名称:aspnetboilerplate,代码行数:29,代码来源:AbpApiExplorer.cs

示例3: ActionHasChangeSetEntityParameter

		internal static bool ActionHasChangeSetEntityParameter(HttpActionDescriptor actionDescriptor)
		{
			Contract.Assert(actionDescriptor != null);

			var parameters = actionDescriptor.GetParameters();
			return (parameters.Count > 0) && IsChangeSetEntityParameter(parameters[0]);
		}
开发者ID:mdabbagh88,项目名称:ODataServer,代码行数:7,代码来源:ChangeSetEntityModelBinder.cs

示例4: GetParameterValuePairs

        private IDictionary<string, object> GetParameterValuePairs(HttpActionDescriptor actionDescriptor)
        {
            IDictionary<string, object> parameterValuePairs = new Dictionary<string, object>();

            foreach (SwaggerDefaultValue defaultValue in actionDescriptor.GetCustomAttributes<SwaggerDefaultValue>())
            {
                parameterValuePairs.Add(defaultValue.Name, defaultValue.Value);
            }

            foreach (var parameter in actionDescriptor.GetParameters())
            {
                if (!parameter.ParameterType.IsPrimitive)
                {
                    foreach (PropertyInfo property in parameter.ParameterType.GetProperties())
                    {
                        var defaultValue = GetDefaultValue(property);

                        if (defaultValue != null)
                        {
                            parameterValuePairs.Add(property.Name, defaultValue);
                        }
                    }
                }
            }

            return parameterValuePairs;
        }
开发者ID:sudarsanan-krishnan,项目名称:DynamicsCRMConnector,代码行数:27,代码来源:AddDefaultsOpFilter.cs

示例5: Map

 public HttpParameterDescriptor Map(Parameter swaggerParameter, int parameterIndex, HttpActionDescriptor actionDescriptor)
 {
     var httpParameterDescriptors = actionDescriptor.GetParameters();
     Contract.Assume(httpParameterDescriptors != null);
     return httpParameterDescriptors
         .SingleOrDefault(descriptor => string.Equals(descriptor.ParameterName, swaggerParameter.name, StringComparison.CurrentCultureIgnoreCase));
 }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:7,代码来源:MapByParameterName.cs

示例6: GetFilters

        /// <summary>
        /// Returns an enumeration of filters.
        /// </summary>
        /// <param name="configuration">The HTTP configuration.</param>
        /// <param name="actionDescriptor">The action descriptor.</param>
        /// <returns>
        /// An enumeration of filters.
        /// </returns>
        public IEnumerable<FilterInfo> GetFilters(HttpConfiguration configuration, HttpActionDescriptor actionDescriptor) {
            if (actionDescriptor == null ||
                (!IsIQueryable(actionDescriptor.ReturnType)) ||
                actionDescriptor.GetCustomAttributes<QueryableAttribute>().Any() ||
                actionDescriptor.GetParameters().Any(parameter => typeof (ODataQueryOptions).IsAssignableFrom(parameter.ParameterType)))
                return Enumerable.Empty<FilterInfo>();

            return new[] {new FilterInfo(_filter, FilterScope.Global)};
        }
开发者ID:amartelr,项目名称:Beetle.js,代码行数:17,代码来源:BeetleQueryableFilterProvider.cs

示例7: ParameterDescriptions

 private static string ParameterDescriptions(HttpActionDescriptor actionDescripton)
 {
     var description = new StringBuilder();
     foreach (var parameter in actionDescripton.GetParameters())
     {
         description.AppendFormat("{0}:{1}/", parameter.ParameterType, parameter.ParameterName);
     }
     return description.ToString();
 }
开发者ID:RichieYang,项目名称:hypermedia.net,代码行数:9,代码来源:AutoNamingRouteProvider.cs

示例8: GetNodeFor

        private XPathNavigator GetNodeFor(HttpActionDescriptor actionDescriptor)
        {
            var controllerName = actionDescriptor.ControllerDescriptor.ControllerType.FullName;
            var actionName = actionDescriptor.ActionName;
            var parameters = String.Join(",", actionDescriptor.GetParameters()
                .Select(paramDesc => TypeNameFor(paramDesc.ParameterType)));

            var xpath = String.Format(MethodExpression, controllerName, actionName, parameters);
            return _navigator.SelectSingleNode(xpath);
        }
开发者ID:kevynb,项目名称:Swashbuckle,代码行数:10,代码来源:ApplyActionXmlComments.cs

示例9: Map

        public HttpParameterDescriptor Map(Parameter swaggerParameter, int parameterIndex, HttpActionDescriptor actionDescriptor)
        {
            Contract.Requires(swaggerParameter != null);
            Contract.Requires(parameterIndex >= 0);
            Contract.Requires(actionDescriptor != null);
            Contract.Requires(actionDescriptor.GetParameters() != null);
            //Contract.Ensures(Contract.Result<HttpParameterDescriptor>() == null || Contract.Result<HttpParameterDescriptor>().Configuration != null);

            throw new NotImplementedException();
        }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:10,代码来源:IParameterMapper.cs

示例10: Map

 public HttpParameterDescriptor Map(Parameter swaggerParameter, int parameterIndex, HttpActionDescriptor actionDescriptor)
 {
     if ([email protected] != "query" && parameterIndex < actionDescriptor.GetParameters().Count)
     {
         var parameterDescriptor = actionDescriptor.GetParameters()[parameterIndex];
         if (parameterDescriptor != null && !parameterDescriptor.IsODataLibraryType())
         {
             var httpControllerDescriptor = actionDescriptor.ControllerDescriptor;
             Contract.Assume(httpControllerDescriptor != null);
             return new ODataParameterDescriptor(swaggerParameter.name, parameterDescriptor.ParameterType, parameterDescriptor.IsOptional, parameterDescriptor)
             {
                 Configuration = httpControllerDescriptor.Configuration,
                 ActionDescriptor = actionDescriptor,
                 ParameterBinderAttribute = parameterDescriptor.ParameterBinderAttribute
             };
         }
     }
     return null;
 }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:19,代码来源:MapByIndex.cs

示例11: ActionDescriptorToString

        public static string ActionDescriptorToString(HttpActionDescriptor actionDescriptor)
        {
            Contract.Assert(actionDescriptor != null);

            string parameterList = String.Join(", ",
                                               actionDescriptor.GetParameters().Select<HttpParameterDescriptor, string>(
                                                   (p) => p.ParameterType.Name + " " + p.ParameterName));

            return actionDescriptor.ActionName + "(" + parameterList + ")";
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:10,代码来源:FormattingUtilities.cs

示例12: GetBinding

        public override HttpActionBinding GetBinding(HttpActionDescriptor actionDescriptor)
        {
            var actionBinding = new MvcActionBinding();

            HttpParameterDescriptor[] parameters = actionDescriptor.GetParameters().ToArray();
            HttpParameterBinding[] binders = Array.ConvertAll(parameters, DetermineBinding);

            actionBinding.ParameterBindings = binders;

            return actionBinding;
        }
开发者ID:liumeifu,项目名称:OSky,代码行数:11,代码来源:MvcActionValueBinder.cs

示例13: GetFilters

        public IEnumerable<FilterInfo> GetFilters(HttpConfiguration configuration, HttpActionDescriptor actionDescriptor)
        {
            if (actionDescriptor == null ||
              actionDescriptor.GetCustomAttributes<QueryableAttribute>().Any() || // if method already has a QueryableAttribute (or subclass) then skip it.
              actionDescriptor.GetParameters().Any(parameter => typeof(ODataQueryOptions).IsAssignableFrom(parameter.ParameterType))
            )
            {
                return Enumerable.Empty<FilterInfo>();
            }

            return new[] { new FilterInfo(_filter, FilterScope.Global) };
        }
开发者ID:Ross-cz,项目名称:breeze.server.net,代码行数:12,代码来源:BreezeNHControllerAttribute.cs

示例14: GetFilters

        /// <summary>
        /// Provides filters to apply to the specified action.
        /// </summary>
        /// <param name="configuration">The server configuration.</param>
        /// <param name="actionDescriptor">The action descriptor for the action to provide filters for.</param>
        /// <returns>
        /// The filters to apply to the specified action.
        /// </returns>
        public IEnumerable<FilterInfo> GetFilters(HttpConfiguration configuration, HttpActionDescriptor actionDescriptor)
        {
            // Actions with a bound parameter of type ODataQueryOptions do not support the query filter
            // The assumption is that the action will handle the querying within the action implementation
            if (actionDescriptor != null && IsIQueryable(actionDescriptor.ReturnType) &&
                !actionDescriptor.GetParameters().Any(parameter => typeof(ODataQueryOptions).IsAssignableFrom(parameter.ParameterType)))
            {
                return new FilterInfo[] { new FilterInfo(QueryFilter, FilterScope.Global) };
            }

            return Enumerable.Empty<FilterInfo>();
        }
开发者ID:marojeri,项目名称:aspnetwebstack,代码行数:20,代码来源:QueryFilterProvider.cs

示例15: GetXPathFor

        private static string GetXPathFor(HttpActionDescriptor actionDescriptor)
        {
            var controllerName = actionDescriptor.ControllerDescriptor.ControllerType.FullName;
            var actionName = actionDescriptor.ActionName;

            var paramTypeNames = actionDescriptor.GetParameters()
                .Select(paramDesc => TypeNameFor(paramDesc.ParameterType))
                .ToArray();

            var parameters = (paramTypeNames.Any())
                ? String.Format("({0})", String.Join(",", paramTypeNames))
                : String.Empty;

            return String.Format(MethodExpression, controllerName, actionName, parameters);
        }
开发者ID:AnthonyNeace,项目名称:Swashbuckle,代码行数:15,代码来源:ApplyActionXmlComments.cs


注:本文中的HttpActionDescriptor.GetParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。