Example #1
0
        public ISugarQueryable <T> Queryable <T>(string tableName) where T : class, new()
        {
            ISugarQueryable <T> queryable = new MySqlQueryable <T>();

            queryable.QueryableCore = _db.Queryable <T>(tableName);
            return(queryable);
        }
Example #2
0
        /// <summary>
        /// 获取ISugarQueryable
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ISugarQueryable <T> GetISugarQueryableByType <T>(DbType type) where T : class, new()
        {
            switch (type)
            {
            case DbType.SqlServer:
                var queryableSql = new SqlServerQueryable <T>();
                queryableSql.QueryableCore = new SqlSugar.Queryable <T>();
                return(queryableSql);

            case DbType.Sqlite:
                var queryableLite = new SqliteQueryable <T>();
                queryableLite.QueryableCore = new SQLiteSugar.Queryable <T>();
                return(queryableLite);

            case DbType.MySql:
                var queryableMySql = new MySqlQueryable <T>();
                queryableMySql.QueryableCore = new MySqlSugar.Queryable <T>();
                return(queryableMySql);

            case DbType.Oracle:
                var queryableOracle = new OracleQueryable <T>();
                queryableOracle.QueryableCore = new OracleSugar.Queryable <T>();
                return(queryableOracle);

            default:
                return(null);
            }
        }
Example #3
0
        public ISugarQueryable <TResult> Select <T2, T3, T4, T5, TResult>(System.Linq.Expressions.Expression <Func <T, T2, T3, T4, T5, TResult> > expression)
        {
            this.QueryableCore = ((Queryable <T>) this.QueryableCore).Select <T2, T3, T4, T5, TResult>(expression);
            MySqlQueryable <TResult> reval = new MySqlQueryable <TResult>();

            reval.QueryableCore = this.QueryableCore;
            return(reval);
        }
Example #4
0
        public ISugarQueryable <T2> Select <T2>(string select)
        {
            this.QueryableCore = ((Queryable <T>) this.QueryableCore).Select <T2>(select);
            MySqlQueryable <T2> reval = new MySqlQueryable <T2>();

            reval.QueryableCore = this.QueryableCore;
            return(reval);
        }