Beispiel #1
0
        /// <summary>
        /// Get PagedResultSet from a execute query with not nested object with/without TotalCount using the IncludeMetada
        /// </summary>
        /// <param name="fullSqlQuery">Sql Query to execute</param>
        /// <param name="filter">The SearchFilter </param>
        /// <param name="param">Parameters to blind with the sql query</param>
        /// <param name="buffered"></param>
        /// <returns></returns>
        public IPaginatedList <TReturn> ExecutePagedQuery <T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn>(Func <T1, T2, T3, T4, T5, T6, T7, T8, T9, TReturn> func, string fullSqlQuery, ISearchFilter filter, object param = null, string splitOn = "id", bool buffered = true)
        {
            // Paging construct helper
            string sqlGetQuery = PagedQueryBuilder.PagedQuery(fullSqlQuery, filter, ref param);

            SqlMapper.GridReader reader = DbConnection.QueryMultiple(sqlGetQuery, param, CurrentTransaction);

            Type[] types =
            {
                typeof(T1),
                typeof(T2),
                typeof(T3),
                typeof(T4),
                typeof(T5),
                typeof(T6),
                typeof(T7),
                typeof(T8),
                typeof(T9)
            };

            IList <TReturn> entity = (IList <TReturn>)reader.Read(types, objects => func((T1)objects[0],
                                                                                         (T2)objects[1],
                                                                                         (T3)objects[2],
                                                                                         (T4)objects[3],
                                                                                         (T5)objects[4],
                                                                                         (T6)objects[5],
                                                                                         (T7)objects[6],
                                                                                         (T8)objects[7],
                                                                                         (T9)objects[8]), splitOn, buffered);

            int?totalCount = filter.IncludeMetadata ? reader.ReadSingleOrDefault <int?>() : null;

            return(new PaginatedList <TReturn>(entity, filter, totalCount));
        }
Beispiel #2
0
        /// <summary>
        /// Get PagedResultSet from a execute query with not nested object with/without TotalCount using the IncludeMetada
        /// </summary>
        /// <param name="fullSqlQuery">Sql Query to execute</param>
        /// <param name="filter">The SearchFilter </param>
        /// <param name="param">Parameters to blind with the sql query</param>
        /// <param name="buffered"></param>
        /// <returns></returns>
        public IPaginatedList <TReturn> ExecutePagedQuery <TReturn>(string fullSqlQuery, ISearchFilter filter, object param = null, bool buffered = true)
        {
            // Paging construct helper
            string sqlGetQuery = PagedQueryBuilder.PagedQuery(fullSqlQuery, filter, ref param);

            SqlMapper.GridReader reader = DbConnection.QueryMultiple(sqlGetQuery, param, CurrentTransaction);

            IEnumerable <TReturn> entity = reader.Read <TReturn>(buffered);
            int?totalCount = filter.IncludeMetadata ? reader.ReadSingleOrDefault <int?>() : null;

            return(new PaginatedList <TReturn>(entity, filter, totalCount));
        }
Beispiel #3
0
        /// <summary>
        /// Get PagedResultSet from a execute query with not nested object with/without TotalCount using the IncludeMetada
        /// </summary>
        /// <param name="fullSqlQuery">Sql Query to execute</param>
        /// <param name="filter">The SearchFilter </param>
        /// <param name="param">Parameters to blind with the sql query</param>
        /// <param name="buffered"></param>
        /// <returns></returns>
        public IPaginatedList <TReturn> ExecutePagedQuery <TReturn>(Type[] types, Func <object[], TReturn> map, string fullSqlQuery, ISearchFilter filter, object param = null, string splitOn = "id", bool buffered = true)
        {
            // Paging construct helper
            string sqlGetQuery = PagedQueryBuilder.PagedQuery(fullSqlQuery, filter, ref param);

            SqlMapper.GridReader reader = DbConnection.QueryMultiple(sqlGetQuery, param, CurrentTransaction);

            IList <TReturn> entity = (IList <TReturn>)reader.Read(types, map, splitOn, buffered);

            int?totalCount = filter.IncludeMetadata ? reader.ReadSingleOrDefault <int?>() : null;

            return(new PaginatedList <TReturn>(entity, filter, totalCount));
        }