Esempio n. 1
0
        public IQueryFactoryResult Process(IQueryContainer container)
        {
            var builder = new ConditionalQueryBuilder();

            builder.QueryBuilder.Append("WHERE ");

            var conditions = new Queue <IConditionPart>(Conditions);

            while (conditions.Any())
            {
                conditions.Dequeue().Render(builder, conditions);
            }
            return(new QueryFactoryResult(builder.QueryBuilder.ToString(), builder.QueryParameters.ToArray()));
        }
Esempio n. 2
0
        public void Render(ConditionalQueryBuilder builder, Queue <IConditionPart> next)
        {
            switch (LogOperator)
            {
            case LogicalOperator.And:
            case LogicalOperator.Or:
                builder.QueryBuilder.Append($"{LogOperator.ToString().ToUpper()} ");
                break;

            case LogicalOperator.OpenBracket:
                builder.QueryBuilder.Append($"(");
                break;

            case LogicalOperator.CloseBracket:
                builder.QueryBuilder.Append($")");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
 public void Render(ConditionalQueryBuilder builder, Queue <IConditionPart> next)
 {
     builder.QueryParameters.AddRange(Value.QueryParameters);
     builder.QueryBuilder.Append($" {Column.ColumnSourceAlias()} {Operator} {Value.QueryValue} ");
 }