| 12345678910111213141516171819202122232425262728293031323334 |
- using System;
- using System.Linq.Expressions;
- namespace Abp.Specifications
- {
- /// <summary>
- /// Represents the specification which is represented by the corresponding
- /// LINQ expression.
- /// </summary>
- /// <typeparam name="T">The type of the object to which the specification is applied.</typeparam>
- public class ExpressionSpecification<T> : Specification<T>
- {
- private readonly Expression<Func<T, bool>> _expression;
- /// <summary>
- /// Initializes a new instance of <c>ExpressionSpecification<T></c> class.
- /// </summary>
- /// <param name="expression">The LINQ expression which represents the current
- /// specification.</param>
- public ExpressionSpecification(Expression<Func<T, bool>> expression)
- {
- _expression = expression;
- }
- /// <summary>
- /// Gets the LINQ expression which represents the current specification.
- /// </summary>
- /// <returns>The LINQ expression.</returns>
- public override Expression<Func<T, bool>> ToExpression()
- {
- return _expression;
- }
- }
- }
|