Created
October 8, 2013 12:51
-
-
Save rarous/6884185 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IQueryOver<TResult, TResult> ApplyFilter<TFilter, TResult>( | |
this IQueryOver<TResult, TResult> query, | |
TFilter field, | |
Func<TFilter, Expression<Func<TResult, bool>>> predicate) | |
{ | |
field.ToMaybe().Do(x => query.Where(predicate(x))); | |
return query; | |
} | |
public static IQueryOver<TResult, TResult> ApplyFilter<TField, TResult>( | |
this IQueryOver<TResult, TResult> query, | |
TField? field, | |
Func<TField, Expression<Func<TResult, bool>>> predicate) | |
where TField : struct | |
{ | |
field.ToMaybe().Do(x => query.Where(predicate(x))); | |
return query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment