private bool PresumePathParaBind() { if (false == this.MethodWrap.NeedPathPara(this.Parameter.Name)) { return(false); } PathParaBind paraBind; if (TypeReflector.IsPrivateValue(this.Parameter.ParameterType)) { paraBind = this.MethodWrap.GetPathParaBind(this.Parameter.Name); if (paraBind == null) { paraBind = new PathParaBind(this.Parameter.Name); this.PathParaBindes.Add(paraBind); return(true); } else { return(false); } } else { return(false); } }
private void BindAttribute() { PathParaBind paraBind; ParameterHeaderBind headerBind; QueryStringBind queryStringBind; string headername; List <FieldInfo> fieldInfos = new List <FieldInfo>(this.Parameter.ParameterType.GetFields()); List <PropertyInfo> properties = new List <PropertyInfo>(this.Parameter.ParameterType.GetProperties()); if (this.pathParaAttribute != null) { paraBind = new PathParaBind(string.IsNullOrEmpty(pathParaAttribute.Name) ? this.Parameter.Name : pathParaAttribute.Name); paraBind.Prompt(); this.PathParaBindes.Add(paraBind); AttributeBinded = true; } if (this.HeaderAttributes.Count > 0) { this.HeaderAttributes.ForEach(x => { if (TypeReflector.IsPrivateValue(this.Parameter.ParameterType)) { headername = string.IsNullOrEmpty(x.Name) ? this.Parameter.Name : x.Name; headerBind = new ParameterHeaderBind(this, headername, x.Unique); headerBind.Prompt(); this.HeaderBindes.Add(headerBind); } else { fieldInfos.ForEach(f => { headerBind = new ParameterHeaderBind(this, f.Name, f, x.Unique); headerBind.Prompt(); this.HeaderBindes.Add(headerBind); }); properties.ForEach(p => { headerBind = new ParameterHeaderBind(this, p.Name, p, x.Unique); headerBind.Prompt(); this.HeaderBindes.Add(headerBind); }); } }); AttributeBinded = true; } if (this.QueryStringAttribute != null) { string queryname; if (TypeReflector.IsPrivateValue(this.Parameter.ParameterType)) { queryname = string.IsNullOrEmpty(this.QueryStringAttribute.Name) ? this.Parameter.Name : this.QueryStringAttribute.Name; queryStringBind = new QueryStringBind(queryname); queryStringBind.Prompt(); this.QueryStringBindes.Add(queryStringBind); } else { if (false == string.IsNullOrEmpty(this.QueryStringAttribute.Name)) { queryStringBind = new QueryStringBind(this.QueryStringAttribute.Name); queryStringBind.Prompt(); this.QueryStringBindes.Add(queryStringBind); } else { fieldInfos.ForEach(f => { queryStringBind = new QueryStringBind(f.Name, f); queryStringBind.Prompt(); this.QueryStringBindes.Add(queryStringBind); }); properties.ForEach(p => { queryStringBind = new QueryStringBind(p.Name, p); queryStringBind.Prompt(); this.QueryStringBindes.Add(queryStringBind); }); } } AttributeBinded = true; } }