| | | 1 | | using System.Diagnostics; |
| | | 2 | | |
| | | 3 | | namespace Pozitron.QuerySpecification; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Represents a where expression used in a specification. |
| | | 7 | | /// </summary> |
| | | 8 | | /// <typeparam name="T">The type of the entity.</typeparam> |
| | | 9 | | public sealed class WhereExpression<T> |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Gets the filter expression. |
| | | 13 | | /// </summary> |
| | | 14 | | public Expression<Func<T, bool>> Filter { get; } |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Initializes a new instance of the <see cref="WhereExpression{T}"/> class. |
| | | 18 | | /// </summary> |
| | | 19 | | /// <param name="filter">The filter expression.</param> |
| | | 20 | | public WhereExpression(Expression<Func<T, bool>> filter) |
| | | 21 | | { |
| | | 22 | | Debug.Assert(filter is not null); |
| | | 23 | | Filter = filter; |
| | | 24 | | } |
| | | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Represents a compiled where expression used in a specification. |
| | | 29 | | /// </summary> |
| | | 30 | | /// <typeparam name="T">The type of the entity.</typeparam> |
| | | 31 | | public sealed class WhereExpressionCompiled<T> |
| | | 32 | | { |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets the compiled filter function. |
| | | 35 | | /// </summary> |
| | 1 | 36 | | public Func<T, bool> Filter { get; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Initializes a new instance of the <see cref="WhereExpressionCompiled{T}"/> class. |
| | | 40 | | /// </summary> |
| | | 41 | | /// <param name="filter">The compiled filter function.</param> |
| | 1 | 42 | | public WhereExpressionCompiled(Func<T, bool> filter) |
| | | 43 | | { |
| | | 44 | | Debug.Assert(filter is not null); |
| | 1 | 45 | | Filter = filter; |
| | 1 | 46 | | } |
| | | 47 | | } |