Example #1
0
        private Expression2SqlCore <T> JoinParser2 <T2, T3>(Expression <Func <T2, T3, bool> > expression, string leftOrRightJoin = "")
        {
            string joinTableName = typeof(T3).Name;

            this._sqlPack.SetTableAlias(joinTableName);
            this._sqlPack.Sql.AppendFormat("\n{0}join {1} on", leftOrRightJoin, joinTableName + " " + this._sqlPack.GetTableAlias(joinTableName));
            Expression2SqlProvider.Join(expression.Body, this._sqlPack);
            return(this);
        }
Example #2
0
        protected override SqlPack Join(BinaryExpression expression, SqlPack sqlPack)
        {
            Expression2SqlProvider.Join(expression.Left, sqlPack);
            int operatorIndex = sqlPack.Sql.Length;

            Expression2SqlProvider.Join(expression.Right, sqlPack);
            int sqlLength = sqlPack.Sql.Length;

            if (sqlLength - operatorIndex == 5 && sqlPack.ToString().EndsWith("null"))
            {
                OperatorParser(expression.NodeType, operatorIndex, sqlPack, true);
            }
            else
            {
                OperatorParser(expression.NodeType, operatorIndex, sqlPack);
            }

            return(sqlPack);
        }