示例#1
0
        private string MapParameterName(ActionParameter parameter)
        {
            var bindingMode = _configuration.HeadersBindingMode;

            if (bindingMode == BindingMode.Convention && HasHeaderPostfix(parameter.Name))
            {
                return(parameter.Name.Truncate(HeaderPostfix.Length));
            }
            if (bindingMode == BindingMode.Explicit || bindingMode == BindingMode.Implicit)
            {
                return(parameter.GetAttribute <FromHeadersAttribute>()?.Name ?? parameter.Name);
            }
            return(parameter.Name);
        }
示例#2
0
 protected virtual string MapName(ActionParameter parameter)
 {
     return(parameter.GetAttribute <NameAttribute>()?.Name ?? parameter.Name);
 }
示例#3
0
 private string MapParameterName(ActionParameter parameter)
 {
     return(parameter.GetAttribute <FromRequestPropertiesAttribute>()?.Name ?? parameter.Name);
 }
示例#4
0
 public T GetAttribute <T>() where T : Attribute => _parameter.GetAttribute <T>();