ISpecification.cs 1.1 KB

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Linq.Expressions;
  3. namespace Abp.Specifications
  4. {
  5. /// <summary>
  6. /// Represents that the implemented classes are specifications. For more
  7. /// information about the specification pattern, please refer to
  8. /// http://martinfowler.com/apsupp/spec.pdf.
  9. /// </summary>
  10. /// <typeparam name="T">The type of the object to which the specification is applied.</typeparam>
  11. public interface ISpecification<T>
  12. {
  13. /// <summary>
  14. /// Returns a <see cref="bool"/> value which indicates whether the specification
  15. /// is satisfied by the given object.
  16. /// </summary>
  17. /// <param name="obj">The object to which the specification is applied.</param>
  18. /// <returns>True if the specification is satisfied, otherwise false.</returns>
  19. bool IsSatisfiedBy(T obj);
  20. /// <summary>
  21. /// Gets the LINQ expression which represents the current specification.
  22. /// </summary>
  23. /// <returns>The LINQ expression.</returns>
  24. Expression<Func<T, bool>> ToExpression();
  25. }
  26. }