private static HttpResponseMessageSettingsAttribute[] GetResponseSetters(MethodReflector mr, TypeReflector tr) { return(mr.GetCustomAttributes <HttpResponseMessageSettingsAttribute>() .Union(mr.Parameters.SelectMany(i => i.GetCustomAttributes <ParameterResponseMessageSettingsAttribute>() .Select(j => { j.Parameter = i.MemberInfo; return j; }))) .Union(tr.GetCustomAttributes <HttpResponseMessageSettingsAttribute>()) .OrderBy(i => i.Order) .ToArray()); }
private static IHttpRequestMessageSettings[] GetRequestSetters(MethodReflector mr, TypeReflector tr) { return(mr.GetCustomAttributesDistinctBy <HttpMethodAttribute>(tr) .Select(i => i.CreateSettings(mr.Parameters.Where(j => j.IsDefined <RouteAttribute>()), mr.Parameters.Where(j => j.IsDefined <QueryAttribute>()))) .First() .Union(mr.Parameters.SelectMany(i => i.GetCustomAttributes <ParameterRequestMessageSettingsAttribute>() .Select(j => { j.Parameter = i.MemberInfo; return j; }))) .Union(tr.GetCustomAttributes <HttpRequestMessageSettingsAttribute>()) .Union(mr.GetCustomAttributes <HttpRequestMessageSettingsAttribute>()) .OrderBy(i => i.Order) .ToArray()); }