Example #1
0
        public void NotExistsSelect <TColumns>(TColumns columns, Expression <Func <TColumns, bool> > selectWhereExpression)
        {
            var expression = new ElementCode(selectWhereExpression, this.Owner.AllColumns, columns);
            var table      = expression.FindTables().FirstOrDefault();

            if (table == null)
            {
                throw new ApplicationException();
            }

            var whereExpression = new ElementCode();

            whereExpression.Add(SqlKeyword.NotExists);
            whereExpression.BeginParenthesize();
            whereExpression.Add(SqlKeyword.Select, SqlKeyword.Asterisk, SqlKeyword.From);
            whereExpression.Add(table);
            whereExpression.Add(SqlKeyword.Where);
            whereExpression.Add(expression);
            whereExpression.EndParenthesize();
            this.Expression = whereExpression;
        }