Show / Hide Table of Contents

Class PredicateBuilder

谓词表达式构建扩展方法

Inheritance
System.Object
PredicateBuilder
Namespace: DapperDal.Expressions
Assembly: DapperDal.dll
Syntax
public static class PredicateBuilder : object

Methods

| Improve this Doc View Source

All<T>(Expression<Func<T, Boolean>>[])

Performs a reduction on the given list of predicates using logical "and". Returns a True<T>() expression if the list is empty

Declaration
public static Expression<Func<T, bool>> All<T>(params Expression<Func<T, bool>>[] predicates)
Parameters
Type Name Description
Expression<Func<T, System.Boolean>>[] predicates

The predicates

Returns
Type Description
Expression<Func<T, System.Boolean>>

A series of "and" expressions

Type Parameters
Name Description
T

The input type for all predicates

| Improve this Doc View Source

All<T>(IEnumerable<Expression<Func<T, Boolean>>>)

Performs a reduction on the given list of predicates using logical "and". Returns a True<T>() expression if the list is empty

Declaration
public static Expression<Func<T, bool>> All<T>(this IEnumerable<Expression<Func<T, bool>>> predicates)
Parameters
Type Name Description
IEnumerable<Expression<Func<T, System.Boolean>>> predicates

The predicates

Returns
Type Description
Expression<Func<T, System.Boolean>>

A series of "and" expressions

Type Parameters
Name Description
T

The input type for all predicates

| Improve this Doc View Source

And<T>(Expression<Func<T, Boolean>>, Expression<Func<T, Boolean>>)

Combines the first predicate with the second using a logical "and". Short-circuits if either expression is constant

Declaration
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
Parameters
Type Name Description
Expression<Func<T, System.Boolean>> first

The first predicate

Expression<Func<T, System.Boolean>> second

The second predicate

Returns
Type Description
Expression<Func<T, System.Boolean>>

An expression representing a logical "and" between both predicates

Type Parameters
Name Description
T

The input type for both predicates

| Improve this Doc View Source

Any<T>(Expression<Func<T, Boolean>>[])

Performs a reduction on the given list of predicates using logical "or". Returns a False<T>() expression if the list is empty

Declaration
public static Expression<Func<T, bool>> Any<T>(params Expression<Func<T, bool>>[] predicates)
Parameters
Type Name Description
Expression<Func<T, System.Boolean>>[] predicates

The predicates

Returns
Type Description
Expression<Func<T, System.Boolean>>

A series of "or" expressions

Type Parameters
Name Description
T

The input type for all predicates

| Improve this Doc View Source

Any<T>(IEnumerable<Expression<Func<T, Boolean>>>)

Performs a reduction on the given list of predicates using logical "or". Returns a False<T>() expression if the list is empty

Declaration
public static Expression<Func<T, bool>> Any<T>(this IEnumerable<Expression<Func<T, bool>>> predicates)
Parameters
Type Name Description
IEnumerable<Expression<Func<T, System.Boolean>>> predicates

The predicates

Returns
Type Description
Expression<Func<T, System.Boolean>>

A series of "or" expressions

Type Parameters
Name Description
T

The input type for all predicates

| Improve this Doc View Source

False<T>()

Produces a predicate expression always returning false

Declaration
public static Expression<Func<T, bool>> False<T>()
Returns
Type Description
Expression<Func<T, System.Boolean>>

A constant expression returning false

Type Parameters
Name Description
T

The input type for the resulting expression

| Improve this Doc View Source

Not<T>(Expression<Func<T, Boolean>>)

Composes a negation with the result of the predicate

Declaration
public static Expression<Func<T, bool>> Not<T>(this Expression<Func<T, bool>> expr)
Parameters
Type Name Description
Expression<Func<T, System.Boolean>> expr

The predicate

Returns
Type Description
Expression<Func<T, System.Boolean>>

An expression negating the result of the predicate

Type Parameters
Name Description
T

The input type for the predicate

| Improve this Doc View Source

Or<T>(Expression<Func<T, Boolean>>, Expression<Func<T, Boolean>>)

Combines the first predicate with the second using a logical "or". Short-circuits if either expression is constant

Declaration
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
Parameters
Type Name Description
Expression<Func<T, System.Boolean>> first

The first predicate

Expression<Func<T, System.Boolean>> second

The second predicate

Returns
Type Description
Expression<Func<T, System.Boolean>>

An expression representing a logical "or" between both predicates

Type Parameters
Name Description
T

The input type for both predicates

| Improve this Doc View Source

True<T>()

Produces a predicate expression always returning true

Declaration
public static Expression<Func<T, bool>> True<T>()
Returns
Type Description
Expression<Func<T, System.Boolean>>

A constant expression returning true

Type Parameters
Name Description
T

The input type for the resulting expression

  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX