示例#1
0
 /// <summary>
 /// Query the existing rows from the table based on a given expression in an asynchronous way.
 /// </summary>
 /// <param name="where">The query expression to be used.</param>
 /// <param name="orderBy">The order definition of the fields to be used.</param>
 /// <param name="top">The number of rows to be returned.</param>
 /// <param name="hints">The table hints to be used.</param>
 /// <param name="cacheKey">
 /// The key to the cache item.By setting this argument, it will return the item from the cache if present, otherwise it will query the database.
 /// </param>
 /// <param name="transaction">The transaction to be used.</param>
 /// <returns>An enumerable list of data entity objects.</returns>
 public Task <IEnumerable <TEntity> > QueryAsync(QueryGroup where = null,
                                                 IEnumerable <OrderField> orderBy = null,
                                                 int?top                    = 0,
                                                 string hints               = null,
                                                 string cacheKey            = null,
                                                 IDbTransaction transaction = null)
 {
     return(DbRepository.QueryAsync <TEntity>(where : where,
                                              orderBy: orderBy,
                                              top: top,
                                              hints: hints,
                                              cacheKey: cacheKey,
                                              transaction: transaction));
 }
示例#2
0
 /// <summary>
 /// Query the existing rows from the table based on a given expression in an asynchronous way.
 /// </summary>
 /// <param name="tableName">The name of the target table.</param>
 /// <param name="where">The query expression to be used.</param>
 /// <param name="orderBy">The order definition of the fields to be used.</param>
 /// <param name="top">The number of rows to be returned.</param>
 /// <param name="hints">The table hints to be used.</param>
 /// <param name="cacheKey">
 /// The key to the cache item.By setting this argument, it will return the item from the cache if present, otherwise it will query the database.
 /// </param>
 /// <param name="transaction">The transaction to be used.</param>
 /// <returns>An enumerable list of data entity objects.</returns>
 public Task <IEnumerable <TEntity> > QueryAsync(string tableName,
                                                 Expression <Func <TEntity, bool> > where = null,
                                                 IEnumerable <OrderField> orderBy         = null,
                                                 int?top                    = 0,
                                                 string hints               = null,
                                                 string cacheKey            = null,
                                                 IDbTransaction transaction = null)
 {
     return(DbRepository.QueryAsync <TEntity>(tableName: tableName,
                                              where : where,
                                              orderBy: orderBy,
                                              top: top,
                                              hints: hints,
                                              cacheKey: cacheKey,
                                              transaction: transaction));
 }