public SqlLam <T2> Join <T2>(Expression <Func <T, T2, bool> > expression) { var joinQuery = new SqlLam <T2>(_builder, _resolver); _resolver.Join(expression); return(joinQuery); }
public IEnumerable <TEntity> GetPagingList(Pagination p, Expression <Func <TEntity, bool> > expression, Expression <Func <TEntity, object> > orderBy) { var sql = this.GetSqlLam().Where(expression).OrderBy(orderBy); // TODO: (已实现) 修复用户管理列表查询出错 - Roc Qing //var sqlCount = new SqlLam<TEntity>().Where(expression); var sqlCount = new SqlLam <TEntity>().Where(expression).Count(); return(this.GetPagingList(p, sql, sqlCount)); }
public IEnumerable <TEntity> GetPagingList(Pagination p, SqlLam <TEntity> sql, SqlLam <TEntity> sqlCount) { string sqlText = sql.QueryPage(p.rows, p.page) + @";" + sqlCount.SqlString; var reader = connection.QueryMultiple(sqlText, sql.Parameters); var list = reader.Read <TEntity>(); var records = reader.Read <int>().FirstOrDefault(); p.records = records; return(list); }
public SqlLam <TResult> Join <T2, TKey, TResult>(SqlLam <T2> joinQuery, Expression <Func <T, TKey> > primaryKeySelector, Expression <Func <T, TKey> > foreignKeySelector, Func <T, T2, TResult> selection) { var query = new SqlLam <TResult>(_builder, _resolver); _resolver.Join <T, T2, TKey>(primaryKeySelector, foreignKeySelector); return(query); }
public SqlLam <TEntity> GetSqlLam() { string key = typeof(TEntity).FullName; ICache cache = CacheFactory.Cache(); SqlLam <TEntity> sql = cache.GetCache <SqlLam <TEntity> >(key); if (sql == null) { sql = new SqlLam <TEntity>(); cache.WriteCache <SqlLam <TEntity> >(sql, key); } else { sql.Clear(); } return(sql); }
public IEnumerable <TEntity> GetList(SqlLam <TEntity> sql) { return(connection.Query <TEntity>(sql.SqlString, sql.Parameters)); }
public TEntity Get(SqlLam <TEntity> sql) { return(connection.Query <TEntity>(sql.SqlString, sql.Parameters).FirstOrDefault()); }