Exemple #1
0
        /// <summary>
        /// Checks whether the projection references the projector's parameter.
        /// </summary>
        /// <param name="expression">Projector.</param>
        public void Validate(Expression expression)
        {
            var projector = (LambdaExpression)expression;

            var paramSeeker = new ParameterSeeker();

            if (!paramSeeker.Exists(projector.Body, projector.Parameters[0]))
            {
                throw new InvalidProjectionException("The projection does not hold any reference to the projector's parameter.", projector.Body);
            }
        }