protected override IExpression VisitNullary(INullaryExpression nullaryExpression)
        {
            DescriptionAttribute descriptionAttribute;
            FieldInfo fieldInfo;

            if ((object)nullaryExpression == null)
                throw new ArgumentNullException("nullaryExpression");

            fieldInfo = typeof(NullaryOperator).GetField(nullaryExpression.NullaryOperator.ToString());

            if ((object)fieldInfo == null)
                throw new NotSupportedException(string.Format("The nullary operator '{0}' is not supported.", nullaryExpression.NullaryOperator));

            descriptionAttribute = Reflexion.GetOneAttribute<DescriptionAttribute>(fieldInfo);

            if ((object)descriptionAttribute == null)
                throw new NotSupportedException(string.Format("The nullary operator '{0}' is not described.", nullaryExpression.NullaryOperator));

            this.Strings.Append(descriptionAttribute.Description);

            return nullaryExpression;
        }
Example #2
0
 protected abstract IExpression VisitNullary(INullaryExpression nullaryExpression);
        protected override IExpression VisitNullary(INullaryExpression nullaryExpression)
        {
            if ((object)nullaryExpression == null)
                throw new ArgumentNullException("nullaryExpression");

            this.Strings.Append(" (1 = 1) ");

            return nullaryExpression;
        }