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

            this._sqlBuilder.SetTableAlias(joinTableName);
            this._sqlBuilder.AppendFormat("\n{0}join {1} on", leftOrRightJoin, joinTableName + " " + this._sqlBuilder.GetTableAlias(joinTableName));
            Expression2SqlProvider.Join(expression.Body, this._sqlBuilder);
            return(this);
        }
Example #2
0
        private Expression2SqlCore <T> JoinParser <T2>(Expression <Func <T, T2, bool> > expression, string leftOrRightJoin = "")
        {
            string joinTableName = typeof(T2).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 #3
0
        private Expression2SqlCore <T> JoinParser2 <T2, T3>(Expression <Func <T2, T3, bool> > expression, string leftOrRightJoin = "")
        {
            PropertyInfoCache.InitCacheInfo <T2>();
            PropertyInfoCache.InitCacheInfo <T3>();
            string joinTableName = PropertyInfoCache.GetTableName(typeof(T3).FullName);// 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);
        }
        private ExpressionToSql <T> JoinParser2 <T2, T3>(Expression <Func <T2, T3, bool> > expression, string leftOrRightJoin = "")
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression", "Value cannot be null");
            }

            string joinTableName = typeof(T3).Name;

            this._sqlBuilder.SetTableAlias(joinTableName);
            this._sqlBuilder.AppendFormat("\n{0}join {1} on", leftOrRightJoin, joinTableName + " " + this._sqlBuilder.GetTableAlias(joinTableName));
            Expression2SqlProvider.Join(expression.Body, this._sqlBuilder);
            return(this);
        }
        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);
        }