Ejemplo n.º 1
0
        public static IEnumerable <IDictionary <string, object> > GetDictionary(this QueryFactory db, Query query)
        {
            var compiled = db.compile(query);

            return(db.Connection.Query(compiled.Sql, compiled.Bindings) as IEnumerable <IDictionary <string, object> >);
        }
Ejemplo n.º 2
0
        public static T FirstOrDefault <T>(this QueryFactory db, Query query)
        {
            var compiled = db.compile(query.Limit(1));

            return(db.Connection.QueryFirstOrDefault <T>(compiled.Sql, compiled.Bindings));
        }
Ejemplo n.º 3
0
        public static T FirstOrDefault <T>(this QueryFactory db, Query query)
        {
            var compiled = db.Compile(query.Limit(1));

            return(db.Connection.QueryFirstOrDefault <T>(compiled.Sql, compiled.NamedBindings, commandTimeout: db.QueryTimeout));
        }
Ejemplo n.º 4
0
        public static void Chunk <T>(this Query query, int chunkSize, Func <IEnumerable <T>, int, bool> func)
        {
            QueryFactory db = QueryHelper.CreateQueryFactory(query);

            db.Chunk <T>(query, chunkSize, func);
        }
Ejemplo n.º 5
0
 public static IEnumerable <T> Select <T>(this QueryFactory db, string sql, object param = null)
 {
     return(db.Connection.Query <T>(sql, param, commandTimeout: db.QueryTimeout));
 }
Ejemplo n.º 6
0
 public static int Statement(this QueryFactory db, string sql, object param = null)
 {
     return(db.Connection.Execute(sql, param, commandTimeout: db.QueryTimeout));
 }
 public static async Task<int> StatementAsync(this QueryFactory db, string sql, object param = null)
 {
     return await db.Connection.ExecuteAsync(sql, param, commandTimeout: db.QueryTimeout);
 }
Ejemplo n.º 8
0
 public static T Max <T>(this QueryFactory db, Query query, string column)
 {
     return(db.Aggregate <T>(query, "max", column));
 }
 public static async Task<IEnumerable<T>> SelectAsync<T>(this QueryFactory db, string sql, object param = null)
 {
     return await db.Connection.QueryAsync<T>(sql, param, commandTimeout: db.QueryTimeout);
 }
 public static async Task<IEnumerable<dynamic>> SelectAsync(this QueryFactory db, string sql, object param = null)
 {
     return await db.SelectAsync<dynamic>(sql, param);
 }
 public static async Task<T> MaxAsync<T>(this QueryFactory db, Query query, string column)
 {
     return await db.AggregateAsync<T>(query, "max", column);
 }
 public static async Task<T> CountAsync<T>(this QueryFactory db, Query query, params string[] columns)
 {
     return await db.ExecuteScalarAsync<T>(query.AsCount(columns));
 }
Ejemplo n.º 13
0
        public static void Chunk <T>(this Query query, int chunkSize, Action <IEnumerable <T>, int> action)
        {
            QueryFactory db = QueryHelper.CreateQueryFactory(query);

            db.Chunk(query, chunkSize, action);
        }
Ejemplo n.º 14
0
 public static T Count <T>(this QueryFactory db, Query query, params string[] columns)
 {
     return(db.ExecuteScalar <T>(query.AsCount(columns)));
 }
        public static async Task<IEnumerable<IDictionary<string, object>>> GetDictionaryAsync(this QueryFactory db, Query query)
        {
            var compiled = db.Compile(query);

            var result = await db.Connection.QueryAsync(
                compiled.Sql,
                compiled.NamedBindings,
                commandTimeout: db.QueryTimeout
            );

            return result as IEnumerable<IDictionary<string, object>>;
        }
Ejemplo n.º 16
0
 public static T Average <T>(this QueryFactory db, Query query, string column)
 {
     return(db.Aggregate <T>(query, "avg", column));
 }
 public static async Task<IEnumerable<dynamic>> GetAsync(this QueryFactory db, Query query)
 {
     return await GetAsync<dynamic>(db, query);
 }
Ejemplo n.º 18
0
        public static IEnumerable <IDictionary <string, object> > GetDictionary(this QueryFactory db, Query query)
        {
            var compiled = db.Compile(query);

            return(db.Connection.Query(compiled.Sql, compiled.NamedBindings, commandTimeout: db.QueryTimeout) as IEnumerable <IDictionary <string, object> >);
        }
        public static async Task<T> FirstOrDefaultAsync<T>(this QueryFactory db, Query query)
        {
            var list = await GetAsync<T>(db, query.Limit(1));

            return list.ElementAtOrDefault(0);
        }
Ejemplo n.º 20
0
 public static IEnumerable <dynamic> Select(this QueryFactory db, string sql, object param = null)
 {
     return(db.Select <dynamic>(sql, param));
 }
 public static async Task<dynamic> FirstAsync(this QueryFactory db, Query query)
 {
     return await FirstAsync<dynamic>(db, query);
 }
Ejemplo n.º 22
0
 public static IEnumerable <dynamic> Get(this QueryFactory db, Query query)
 {
     return(Get <dynamic>(db, query));
 }
Ejemplo n.º 23
0
        public static IEnumerable <T> Get <T>(this QueryFactory db, Query query)
        {
            var compiled = db.compile(query);

            return(db.Connection.Query <T>(compiled.Sql, compiled.Bindings));
        }
Ejemplo n.º 24
0
 public static dynamic FirstOrDefault(this QueryFactory db, Query query)
 {
     return(FirstOrDefault <dynamic>(db, query));
 }
Ejemplo n.º 25
0
        public static PaginationResult <T> Paginate <T>(this Query query, int page, int perPage = 25)
        {
            QueryFactory db = QueryHelper.CreateQueryFactory(query);

            return(db.Paginate <T>(query, page, perPage));
        }