private IFilter[] GetActionFiltersNoCachedOld(ApiAction apiAction) { var paramtersFilters = apiAction.GetParametersFilterAttributes(); var methodFilters = apiAction.GetMethodFilterAttributes(); var classFilters = apiAction.GetClassFilterAttributes() .Where(cf => cf.AllowMultiple || methodFilters.Any(mf => mf.TypeId == cf.TypeId) == false); var allFilters = paramtersFilters.Concat(methodFilters).Concat(classFilters).OrderBy(f => f.Order).ToArray(); return(allFilters); }
/// <summary> /// 获取Api行为的特性过滤器 /// </summary> /// <param name="apiAction">Api行为</param> /// <returns></returns> public IEnumerable <IFilter> GetActionFilters(ApiAction apiAction) { var paramtersFilters = apiAction.GetParametersFilterAttributes(cache: true); var methodFilters = apiAction.GetMethodFilterAttributes(); var classFilters = apiAction.GetClassFilterAttributes() .Where(cf => cf.AllowMultiple || methodFilters.Any(mf => mf.TypeId == cf.TypeId) == false); var allFilters = paramtersFilters.Concat(methodFilters).Concat(classFilters).OrderBy(f => f.Order).ToArray(); return(allFilters); }
/// <summary> /// 获取Api行为的特性过滤器 /// </summary> /// <param name="apiAction">Api行为</param> /// <returns></returns> private IFilter[] GetActionFiltersNoCached(ApiAction apiAction) { var paramtersFilters = apiAction.GetParametersFilterAttributes(); var methodFilters = apiAction.GetMethodFilterAttributes(); var classFilters = apiAction.GetClassFilterAttributes(); var allFilters = paramtersFilters .Concat(methodFilters) .Concat(classFilters) .Distinct(new FilterAttributeComparer()) .OrderBy(f => f.Order) .ToArray(); return(allFilters); }