示例#1
0
 void PagedListEntity()        //ref IPagedList<E> in_out)
 {
     using (IDbConnection conn = Db.ConnectionFactory.Create())
     {
         SqlMapper.GridReader grid = conn.QueryMultiple(QueryTemplate.CreatePagedListQuery("", new string[] { "ID" }));
         grid.ReadSingle <int>();
         grid.ReadSingle <int>();
         grid.Read <E>();
     }
 }
示例#2
0
        private IEnumerable <DtoType> SelectDto <EntityType, DtoType>(IMapper mapper, SqlMapper.GridReader gridReader) where DtoType : class
        {
            var hasValue = gridReader.ReadSingle <int>() > 0;

            if (hasValue)
            {
                var entityCollection = gridReader.Read <EntityType>();
                if (entityCollection != null)
                {
                    if (typeof(EntityType) != typeof(DtoType))
                    {
                        return(mapper.Map <IEnumerable <EntityType>, IEnumerable <DtoType> >(entityCollection));
                    }
                    else
                    {
                        return(entityCollection as IEnumerable <DtoType>);
                    }
                }
            }
            else
            {
                var badValue = gridReader.Read();
            }
            var list = new List <DtoType>();

            return(list);
        }