Esempio n. 1
0
        public bool Equals(Clause obj)
        {
            if (obj == null)
            {
                return false;
            }

            return obj.Operator == this.Operator
                && obj.Value == this.Value;
        }
        protected virtual Clause Render(IGroupClause @params)
        {
            string values = string.Empty;

            foreach (var value in @params.Values)
            {
                var clause = new Clause()
                {
                    Operator = @params.InterClauseOperator,
                    Value = this.Build(value)
                };

                if (string.IsNullOrEmpty(values))
                {
                    values += clause.Value ?? string.Empty;
                }
                else
                {
                    values += string.Format("{0} {1} ", clause.Operator == ClauseOperator.AND ? " AND" : " OR", clause.Value ?? string.Empty);
                }
            }

            return new Clause
            {
                Operator = @params.ClauseOperator,
                Value = string.Format("({0})", values)
            };
        }