codeice / linqtoexcel

Automatically exported from code.google.com/p/linqtoexcel
0 stars 0 forks source link

IEnumerable functionality not working for transformations. #69

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Define Mapping with transformation for a Worksheet. 
2. Use excelQueryFactory.Worksheet<MyDTO>("WorksheetName") inside a foreach.

What is the expected output? What do you see instead?
Instead of functioning like an IEnumerable<T> where items are enumerated one by 
one, the transformation method is applied to all the rows instantly. Not sure 
if your doing a ToList() somewhere by mistake. This becomes an issues for 
excel-sheet with a lot of rows, as the transformation method is called for all 
rows first time you query it. Ideally, the transformation method for a row 
should be called when we enumerate to it.

Version:
1.6.2 (64bit)

Original issue reported on code.google.com by a.shakr...@gmail.com on 21 May 2012 at 10:29

GoogleCodeExporter commented 8 years ago
For any query in LinqToExcel, it retrieves all the data from the spreadsheet 
right away and puts it into a list, and then it casts it back to an IEnumerable 
since the LINQ provider requires IEnumerable.

I made this design choice because it would take a lot more work to make it 
truly IEnumerable, and if a project is truly concerned about performance, it 
shouldn't be reading data from a spreadsheet to begin with. It should be using 
a database.

I would love to truly make it IEnumerable, so please send a pull request with 
code changes if you have the time.

Original comment by paulyo...@gmail.com on 15 Jun 2012 at 11:52