Exemplo n.º 1
0
        public ISugarQueryable <T> Queryable <T>(string tableName) where T : class, new()
        {
            ISugarQueryable <T> queryable = new SqlServerQueryable <T>();

            queryable.QueryableCore = _db.Queryable <T>(tableName);
            return(queryable);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            SqlServerQueryable <TResult> reval = new SqlServerQueryable <TResult>();

            reval.QueryableCore = this.QueryableCore;
            return(reval);
        }
Exemplo n.º 4
0
        public ISugarQueryable <T2> Select <T2>(string select)
        {
            this.QueryableCore = ((Queryable <T>) this.QueryableCore).Select <T2>(select);
            SqlServerQueryable <T2> reval = new SqlServerQueryable <T2>();

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