using System; using System.Linq.Expressions; namespace MyCode.Project.Infrastructure { /// /// Represents the combined specification which indicates that either of the given /// specification should be satisfied by the given object. /// /// The type of the object to which the specification is applied. public class OrSpecification : CompositeSpecification { #region Ctor /// /// Initializes a new instance of OrSpecification<T> class. /// /// The first specification. /// The second specification. public OrSpecification(ISpecification left, ISpecification right) : base(left, right) { } #endregion #region Public Methods /// /// Gets the LINQ expression which represents the current specification. /// /// The LINQ expression. public override Expression> GetExpression() { //var body = Expression.OrElse(Left.GetExpression().Body, Right.GetExpression().Body); //return Expression.Lambda>(body, Left.GetExpression().Parameters); return Left.GetExpression().Or(Right.GetExpression()); } #endregion } }