public static SqlClause Add([NotNull] this SqlClause source, [NotNull] SqlClause sqlClause, bool trimmed = false)
        {
            if (sqlClause == null)
            {
                throw new ArgumentNullException("sqlClause");
            }

            var sql = sqlClause.GetSql();

            if (trimmed)
            {
                sql = sql.Trim(' ', '\t', '\n', '\r');
            }

            source.Add(sql);
            source.Add(sqlClause.GetParameters());

            return(source);
        }
Example #2
0
        public SqlClause Add([NotNull] string key, [NotNull] SqlClause sqlClause, bool overwrite = false)
        {
            if (sqlClause == null)
            {
                throw new ArgumentNullException("sqlClause");
            }

            if (this.ContainsExpression(key) && !overwrite)
            {
                return(this);
            }

            this.Add(key, sqlClause.GetSql(), overwrite);

            foreach (var parameter in sqlClause.GetParameters())
            {
                this.Add(parameter);
            }

            return(this);
        }