public static void Apply <T>(this IDynamicRepository <T> repo, QueryDescriptor descriptor, QueryParams queryParams) where T : class, new() { repo.ResetOriginQuery(); var rules = new List <string>(); rules.AddRange(descriptor.DefaultQueryRules); if (queryParams.Folder != null && descriptor.AcceptQueryRule(queryParams.Folder)) { rules.Add(queryParams.Folder); } repo.ApplyQueryRules(rules.ToArray()); }