ExpressionBuilder.cs 472 B

12345678910111213141516
  1. using Bowin.Common.Linq;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. namespace OrderSystem.Entity.Extensions
  7. {
  8. public static class ExpressionBuilder
  9. {
  10. public static Expression<Func<T, bool>> AndIf<T>(this Expression<Func<T, bool>> first, bool condition, Expression<Func<T, bool>> second)
  11. {
  12. return condition ? first.Compose(second, Expression.AndAlso) : first;
  13. }
  14. }
  15. }