diff options
Diffstat (limited to 'src/marlin.web/Util')
| -rw-r--r-- | src/marlin.web/Util/IQueryableExtensions.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/marlin.web/Util/IQueryableExtensions.cs b/src/marlin.web/Util/IQueryableExtensions.cs new file mode 100644 index 0000000..79b9cbe --- /dev/null +++ b/src/marlin.web/Util/IQueryableExtensions.cs @@ -0,0 +1,14 @@ +namespace marlin.web.Util; + +using System.Linq.Expressions; + +public static class IQueryableExtensions +{ + public static IQueryable<T> WhereIf<T>( + this IQueryable<T> self, + bool cond, + Expression<Func<T, bool>> predicate) + { + return cond ? self.Where(predicate) : self; + } +}
\ No newline at end of file |
