• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# HttpParameterDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: HttpParameterBinding

 protected HttpParameterBinding(HttpParameterDescriptor descriptor)
 {
     if (descriptor == null)
     {
         throw Error.ArgumentNull("descriptor");
     }
     _descriptor = descriptor;
 }
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:8,代码来源:HttpParameterBinding.cs


示例17: GetDocumentation

        public string GetDocumentation(HttpParameterDescriptor parameterDescriptor)
        {
            var parameterName = parameterDescriptor.ParameterName;
            var selector = string.Format(MEMBER_PARAM_XPATH_QUERY, parameterName);

            var rtn = GetActionDocumentation(parameterDescriptor.ActionDescriptor, selector);
            return rtn;
        }
开发者ID:danieleli,项目名称:Swagger.Net,代码行数:8,代码来源:XmlCommentDocumentationProvider.cs


示例18: GetBinding

 public override HttpParameterBinding GetBinding(HttpParameterDescriptor parameter)
 {
     if (parameter.ParameterType == typeof(ETag))
     {
         return new ETagParameterBinding(parameter, match);
     }
     return parameter.BindAsError("Wrong parameter type");
 }
开发者ID:RWE-Nexus,项目名称:EnergyTrading-MDM,代码行数:8,代码来源:ETagMatchAtrribute.cs


示例19: GetBinding

        /// <summary>
        /// Get Binding Process
        /// </summary>
        /// <param name="parameter">Parameter Descriptor</param>
        /// <returns></returns>
        public override HttpParameterBinding GetBinding(HttpParameterDescriptor parameter)
        {
            if(String.IsNullOrEmpty(this._name)){
                this._name = parameter.ParameterName;
            }

            return new Gale.REST.Http.Binding.FromHeaderBinding(parameter, this._name );
        }
开发者ID:Acraciel,项目名称:Gale,代码行数:13,代码来源:FromHeaderAttribute.cs


示例20: IsChangeSetEntityParameter

		internal static bool IsChangeSetEntityParameter(HttpParameterDescriptor parameterDescriptor)
		{
			Contract.Assert(parameterDescriptor != null);

			ModelBinderAttribute modelBinderAttr = parameterDescriptor.ParameterBinderAttribute as ModelBinderAttribute;
			return (modelBinderAttr != null)
				&& (modelBinderAttr.BinderType == typeof(ChangeSetEntityModelBinder));
		}
开发者ID:mdabbagh88,项目名称:ODataServer,代码行数:8,代码来源:ChangeSetEntityModelBinder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HttpRequest类代码示例发布时间:2022-05-24
下一篇:
C# HttpNotificationChannel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap