public static FromQueryAttribute Build(AttributeData att) { var data = new FromQueryAttribute(); foreach (var pair in att.NamedArguments) { if (pair.Key == nameof(data.Name) && pair.Value.Value is string value) { data.Name = value; } } return(data); }
private static void LoadQueryParameters(Type paramType, string paramName, IDictionary <string, bool> supportedParams, FromQueryAttribute attribute) { if (paramType.IsArray) { AssertAdd(supportedParams, attribute?.Name ?? paramName, true); } else if (paramType.IsClass && paramType.FullName.StartsWith("Barista")) { foreach (var property in paramType.GetProperties(BindingFlags.Instance | BindingFlags.Public)) { LoadQueryParameters(property.PropertyType, property.Name, supportedParams, property.GetCustomAttribute <FromQueryAttribute>()); } } else { AssertAdd(supportedParams, attribute?.Name ?? paramName, false); } }