codeice / linqtoexcel

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

Support of the Where and Join Clause #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Does this library support use of the Where clause in the linq statement?   
When do you plan to implement the Join clause?

Great code, very helpful application.

Original issue reported on code.google.com by m...@digitalbariatrics.com on 6 Dec 2009 at 1:15

GoogleCodeExporter commented 9 years ago
Yes, the library supports the where clause. The projects home page gives an 
example
of using the where clause.

Because of the complexities of implementing the Join clause, I do not plan on 
its
functionality to this library. However, there is a work around by having 2 
separate
LINQ statements which are converted to a list first and then doing a join on 
the 2
lists. Here's an example:

var excel = new ExcelQueryFactory("pathToExcelFile");
var users = (from u in repo.Worksheet<User>("Users")
             select p).ToList();
var logins = (from l in repo.Worksheet<User>("Logins")
              select l).ToList();

var userLogins = from u in users
                 join l in logins on u.Id equals l.UserId
                 select new { u.Name, l.LoginTime };

Original comment by paulyo...@gmail.com on 8 Dec 2009 at 9:20