Beispiel #1
0
        public Expression2SqlCore <T> Select <T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression <Func <T, T2, T3, T4, T5, T6, T7, T8, T9, T10, object> > expression = null)
        {
            PropertyInfoCache.InitCacheInfo <T2>();
            PropertyInfoCache.InitCacheInfo <T3>();
            PropertyInfoCache.InitCacheInfo <T4>();
            PropertyInfoCache.InitCacheInfo <T5>();
            PropertyInfoCache.InitCacheInfo <T6>();
            PropertyInfoCache.InitCacheInfo <T7>();
            PropertyInfoCache.InitCacheInfo <T8>();
            PropertyInfoCache.InitCacheInfo <T9>();
            PropertyInfoCache.InitCacheInfo <T10>();

            string sql = SelectParser(typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10));

            if (expression == null)
            {
                this._sqlPack.Sql.AppendFormat(sql, "*");
            }
            else
            {
                Expression2SqlProvider.Select(expression.Body, this._sqlPack);
                this._sqlPack.Sql.AppendFormat(sql, this._sqlPack.SelectFieldsStr);
            }

            return(this);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        public Expression2SqlCore <T> Select <T2>(Expression <Func <T, T2, object> > expression = null)
        {
            PropertyInfoCache.InitCacheInfo <T2>();
            string sql = SelectParser(typeof(T), typeof(T2));

            if (expression == null)
            {
                this._sqlPack.Sql.AppendFormat(sql, "*");
            }
            else
            {
                Expression2SqlProvider.Select(expression.Body, this._sqlPack);
                this._sqlPack.Sql.AppendFormat(sql, this._sqlPack.SelectFieldsStr);
            }

            return(this);
        }
Beispiel #4
0
 static Expression2SqlCore()
 {
     PropertyInfoCache.InitCacheInfo <T>();
 }
Beispiel #5
0
 public Expression2SqlCore <T> FullJoin <T2, T3>(Expression <Func <T2, T3, bool> > expression)
 {
     PropertyInfoCache.InitCacheInfo <T2>();
     PropertyInfoCache.InitCacheInfo <T3>();
     return(JoinParser2(expression, "full "));
 }
Beispiel #6
0
 public Expression2SqlCore <T> RightJoin <T2>(Expression <Func <T, T2, bool> > expression)
 {
     PropertyInfoCache.InitCacheInfo <T2>();
     return(JoinParser(expression, "right "));
 }