Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        public ISugarQueryable <T> Queryable <T>(string tableName) where T : class, new()
        {
            ISugarQueryable <T> queryable = new SqliteQueryable <T>();

            queryable.QueryableCore = _db.Queryable <T>(tableName);
            return(queryable);
        }
Ejemplo n.º 3
0
        public ISugarQueryable <TResult> Select <T2, T3, T4, T5, T6, TResult>(System.Linq.Expressions.Expression <Func <T, T2, T3, T4, T5, T6, TResult> > expression)
        {
            this.QueryableCore = ((Queryable <T>) this.QueryableCore).Select <T2, T3, T4, T5, T6, TResult>(expression);
            SqliteQueryable <TResult> reval = new SqliteQueryable <TResult>();

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

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