Esempio n. 1
0
 /// <summary>
 /// Applies all filters from <see cref="IFilter"/> type. If your filter object implements Pagination and Ordering this method will apply OrderBy() and Skip().Take() automatically.
 /// <list type="bullet">
 /// You can chain with other LINQ methods with ApplyFilter like:
 /// </list>
 /// <code>
 ///     db.Books
 ///         .Where(x => !x.IsDeleted)
 ///         .ApplyFilter(filter)
 ///         .Select(s => s.Name)
 ///         .ToList();
 /// </code>
 /// <typeparam name="T"></typeparam>
 /// <param name="source"></param>
 /// <param name="filter">Be careful!
 /// <list type="bullet">
 /// <item>
 /// If your filter implements <see cref="IOrderable"/>, this method also adds <term>OrderBy()</term> or <term>OrderByDescending()</term> method into your query.
 /// </item>
 /// <item>
 /// If your filter implements <see cref="IPaginationFilter"/>, this method also adds <term>Skip().Take()</term>  methods into your query.
 /// </item>
 /// </list>
 /// </param>
 /// </summary>
 /// <returns>Built and queried <see cref="IQueryable"/> result.</returns>
 public static IQueryable <T> ApplyFilter <T>(this IOrderedQueryable <T> source, IFilter filter)
 {
     return(filter.ApplyFilterTo(source));
 }