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


C# HttpParameterDescriptor类代码示例

本文整理汇总了C#中HttpParameterDescriptor的典型用法代码示例。如果您正苦于以下问题:C# HttpParameterDescriptor类的具体用法?C# HttpParameterDescriptor怎么用?C# HttpParameterDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ODataFormatterParameterBinding

 public ODataFormatterParameterBinding(HttpParameterDescriptor descriptor, MediaTypeFormatter formatter)
     : base(descriptor)
 {
     if (formatter == null)
     {
         throw Error.ArgumentNull("formatter");
     }
     _formatter = formatter;
 }
开发者ID:marojeri,项目名称:aspnetwebstack,代码行数:9,代码来源:ODataFormatterParameterBinding.cs

示例2: GetDocumentation

        public string GetDocumentation(HttpParameterDescriptor parameterDescriptor)
        {
            var reflectedParameterDescriptor = parameterDescriptor as ReflectedHttpParameterDescriptor;

            if (reflectedParameterDescriptor != null)

            {
                XPathNavigator memberNode = GetMemberNode(reflectedParameterDescriptor.ActionDescriptor);

                if (memberNode != null)

                {
                    string parameterName = reflectedParameterDescriptor.ParameterInfo.Name;

                    XPathNavigator parameterNode =
                        memberNode.SelectSingleNode(string.Format("param[@name='{0}']", parameterName));

                    if (parameterNode != null)

                    {
                        return parameterNode.Value.Trim();
                    }
                }
            }

            return string.Empty;
        }
开发者ID:ahmetoz,项目名称:Photopia,代码行数:27,代码来源:XmlCommentDocumentationProvider.cs

示例3: BodyAndUriParameterBinding

 public BodyAndUriParameterBinding(HttpParameterDescriptor descriptor)
     : base(descriptor)
 {
     var httpConfiguration = descriptor.Configuration;
     Formatters = httpConfiguration.Formatters;
     BodyModelValidator = httpConfiguration.Services.GetBodyModelValidator();
 }
开发者ID:jaredrussell,项目名称:Amikiri,代码行数:7,代码来源:BodyAndUriParameterBinding.cs

示例4: ResourceParameterBinding

 public ResourceParameterBinding(
     ScimServerConfiguration serverConfiguration,
     HttpParameterDescriptor parameter) 
     : base(parameter)
 {
     _ServerConfiguration = serverConfiguration;
 }
开发者ID:PowerDMS,项目名称:Owin.Scim,代码行数:7,代码来源:ResourceParameterBinding.cs

示例5: ODataParameterDescriptor

 public ODataParameterDescriptor(string parameterName, Type parameterType, bool isOptional, HttpParameterDescriptor reflectedHttpParameterDescriptor)
 {
     ParameterName = parameterName;
     ParameterType = parameterType;
     IsOptional = isOptional;
     ReflectedHttpParameterDescriptor = reflectedHttpParameterDescriptor;
 }
开发者ID:bigred8982,项目名称:Swashbuckle.OData,代码行数:7,代码来源:ODataParameterDescriptor.cs

示例6: GetBinding

        public override HttpParameterBinding GetBinding(HttpParameterDescriptor parameter)
        {
            if (parameter == null)
                throw new ArgumentException("Invalid parameter");

            return new TransferujPlResponseModelBinder(parameter);
        }
开发者ID:pawlos,项目名称:transferujpl-net,代码行数:7,代码来源:BindTransferujPlAttribute.cs

示例7: HookupParameterBinding

    /// <summary>
    /// Method that implements parameter binding hookup to the global configuration object's
    /// ParameterBindingRules collection delegate.
    /// 
    /// This routine filters based on POST/PUT method status and simple parameter
    /// types.
    /// </summary>
    /// <example>
    /// GlobalConfiguration.Configuration.
    ///       .ParameterBindingRules
    ///       .Insert(0,SimplePostVariableParameterBinding.HookupParameterBinding);
    /// </example>    
    /// <param name="descriptor"></param>
    /// <returns></returns>
    public static HttpParameterBinding HookupParameterBinding(HttpParameterDescriptor descriptor)
    {
        //To see is it mark the flag
        if (descriptor.ActionDescriptor.GetCustomAttributes<System.Web.Http.MultiParameterSupportAttribute>().Count <= 0)
            return null;

        var supportedMethods = descriptor.ActionDescriptor.SupportedHttpMethods;

        // Only apply this binder on POST and PUT operations
        if (supportedMethods.Contains(HttpMethod.Post) ||
            supportedMethods.Contains(HttpMethod.Put))
        {
            var supportedTypes = new Type[] { typeof(string),
                                                typeof(int),
                                                typeof(int?),
                                                typeof(decimal),
                                                typeof(decimal?),
                                                typeof(double),
                                                typeof(double?),
                                                typeof(long),
                                                typeof(long?),
                                                typeof(bool),
                                                typeof(bool?),
                                                typeof(DateTime),
                                                typeof(DateTime?),
                                                typeof(byte[])
                                            };

            if (supportedTypes.Count(typ => typ == descriptor.ParameterType) > 0)
                return new SimplePostVariableParameterBinding(descriptor);
        }

        return null;
    }
开发者ID:DoraemonYu,项目名称:SimplePostVariableParameterBindingExtended,代码行数:48,代码来源:SimplePostModelBinding.cs

示例8: GetBinding

        /// <summary>
        ///   Gets the parameter binding.
        /// </summary>
        /// <returns>The parameter binding.</returns>
        /// <param name="parameter">The parameter description.</param>
        public override HttpParameterBinding GetBinding(HttpParameterDescriptor parameter)
        {
            // Preconditions
            Raise.ArgumentNullException.IfIsNull(parameter, nameof(parameter));

            return new NakedBodyParameterBinding(parameter);
        }
开发者ID:finsaspa,项目名称:Caravan,代码行数:12,代码来源:NakedBodyAttribute.cs

示例9: CatchAllRouteParameterBinding

 public CatchAllRouteParameterBinding(
     HttpParameterDescriptor descriptor, char delimiter)
     : base(descriptor)
 {
     _parameterName = descriptor.ParameterName;
     _delimiter = delimiter;
 }
开发者ID:mahedee,项目名称:WebAPICookBook,代码行数:7,代码来源:CatchAllRouteParameterBinding.cs

示例10: GetParameterBinding

        // Determine how a single parameter will get bound. 
        // This is all sync. We don't need to actually read the body just to determine that we'll bind to the body.         
        protected virtual HttpParameterBinding GetParameterBinding(HttpParameterDescriptor parameter)
        {
            // Attribute has the highest precedence
            // Presence of a model binder attribute overrides.
            ParameterBindingAttribute attr = parameter.ParameterBinderAttribute;
            if (attr != null)
            {
                return attr.GetBinding(parameter);
            }

            // No attribute, so lookup in global map.
            ParameterBindingRulesCollection pb = parameter.Configuration.ParameterBindingRules;
            if (pb != null)
            {
                HttpParameterBinding binding = pb.LookupBinding(parameter);
                if (binding != null)
                {
                    return binding;
                }
            }

            // Not explicitly specified in global map or attribute.
            // Use a default policy to determine it. These are catch-all policies. 
            Type type = parameter.ParameterType;
            if (TypeHelper.IsSimpleUnderlyingType(type) || TypeHelper.HasStringConverter(type))
            {
                // For simple types, the default is to look in URI. Exactly as if the parameter had a [FromUri] attribute.
                return parameter.BindWithAttribute(new FromUriAttribute());
            }

            // Fallback. Must be a complex type. Default is to look in body. Exactly as if this type had a [FromBody] attribute.
            attr = new FromBodyAttribute();
            return attr.GetBinding(parameter);
        }
开发者ID:reza899,项目名称:aspnetwebstack,代码行数:36,代码来源:DefaultActionValueBinder.cs

示例11: GetDocumentation

 /// <summary>
 /// Gets the documentation based on <see cref="System.Web.Http.Controllers.HttpParameterDescriptor" />.
 /// </summary>
 /// <param name="parameterDescriptor">The parameter descriptor.</param>
 /// <returns>The documentation for the controller.</returns>
 public string GetDocumentation(HttpParameterDescriptor parameterDescriptor)
 {
     return this.sources
         .Select(source => source.GetDocumentation(parameterDescriptor))
         .Where(documentation => !string.IsNullOrEmpty(documentation))
         .FirstOrDefault();
 }
开发者ID:XopcT,项目名称:LocalizedHelpPage,代码行数:12,代码来源:MultipleSourceDocumentationProvider.cs

示例12: SimpleApiParameterDescriptor

        public SimpleApiParameterDescriptor(HttpParameterDescriptor arg, string routePath)
        {
            this.Name = arg.ParameterName;
            this.IsOptional = arg.IsOptional;

            if (this.IsOptional)
            {
                this.DefaultValue = arg.DefaultValue;
            }

            var indexOfQueryString = routePath.IndexOf('?');

            if (arg.ParameterBinderAttribute is FromBodyAttribute)
            {
                this.CallingConvention = "body";
            }
            else
            {
                var indexOfParameter = routePath.IndexOf("{" + arg.ParameterName + "}", StringComparison.InvariantCultureIgnoreCase);

                if (indexOfQueryString > 0 && indexOfParameter > indexOfQueryString)
                {
                    this.CallingConvention = "query-string";
                }
                else if (indexOfParameter > 0)
                {
                    this.CallingConvention = "uri";
                }
                else
                {
                    this.CallingConvention = "unknown";
                }
            }
        }
开发者ID:Tallmaris,项目名称:NuGet.Lucene,代码行数:34,代码来源:SimpleApiDescription.cs

示例13: ScimQueryOptionsParameterBinding

 public ScimQueryOptionsParameterBinding(
     HttpParameterDescriptor descriptor,
     ScimServerConfiguration serverConfiguration) 
     : base(descriptor)
 {
     _ServerConfiguration = serverConfiguration;
 }
开发者ID:PowerDMS,项目名称:Owin.Scim,代码行数:7,代码来源:ScimQueryOptionsParameterBinding.cs

示例14: GetBinding

        public override HttpParameterBinding GetBinding(HttpParameterDescriptor parameter)
        {
            if (parameter == null)
                throw new ArgumentException("Invalid parameter");

            return new NakedBodyParameterBinding(parameter);
        }
开发者ID:podgito,项目名称:Restponder,代码行数:7,代码来源:NakedBodyParameterBinding.cs

示例15: GetDocumentation

 public string GetDocumentation(HttpParameterDescriptor parameterDescriptor)
 {
     var attr = parameterDescriptor.ActionDescriptor
                 .GetCustomAttributes<ApiParameterDocAttribute>()
                 .FirstOrDefault(p => p.Parameter == parameterDescriptor.ParameterName);
     return attr != null ? attr.Documentation : "";
 }
开发者ID:ouyh18,项目名称:LtePlatform,代码行数:7,代码来源:DocProvider.cs


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