示例#1
0
 /// <summary>
 /// Query the existing rows from the table based on a given expression.
 /// </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 IEnumerable <TEntity> Query(QueryGroup where = null,
                                    IEnumerable <OrderField> orderBy = null,
                                    int?top                    = 0,
                                    string hints               = null,
                                    string cacheKey            = null,
                                    IDbTransaction transaction = null)
 {
     return(DbRepository.Query <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.
 /// </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 IEnumerable <TEntity> Query(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.Query <TEntity>(tableName: tableName,
                                         where : where,
                                         orderBy: orderBy,
                                         top: top,
                                         hints: hints,
                                         cacheKey: cacheKey,
                                         transaction: transaction));
 }
示例#3
0
 /// <summary>
 /// Query the existing rows from the table based on a given expression.
 /// </summary>
 /// <param name="tableName">The name of the target table.</param>
 /// <param name="whereOrPrimaryKey">The dynamic expression or the primary key value 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 IEnumerable <TEntity> Query(string tableName,
                                    object whereOrPrimaryKey         = null,
                                    IEnumerable <OrderField> orderBy = null,
                                    int?top                    = 0,
                                    string hints               = null,
                                    string cacheKey            = null,
                                    IDbTransaction transaction = null)
 {
     return(DbRepository.Query <TEntity>(tableName: tableName,
                                         whereOrPrimaryKey: whereOrPrimaryKey,
                                         orderBy: orderBy,
                                         top: top,
                                         hints: hints,
                                         cacheKey: cacheKey,
                                         transaction: transaction));
 }
示例#4
0
        public static void Main(string[] args)
        {
            var repository = new DbRepository <SqlConnection>("ConnectionString");

            repository.Query <Customer>(new { Id = 10045 }, recursive: true);
        }