I'm working on a project that will combine a couple of sharepoint listitemcollections. It's basically to bring together three sharepoint lists.
I've already gotten my three sharepoint queries to return my proper results and im using the .GetDataTable() method to generate my objects for LINQ joins.
Below is my code. I may be approaching this wrong but if there is a way I can return one data row that has all three objects combined is all I need.
DataTable dtContracts = _contractList.GetDataTable();
DataTable dtCustomer = _customerList.GetDataTable();
var joined = from contracts in dtContracts.AsEnumerable()
join customers in dtCustomer.AsEnumerable()
on contracts.Field<String>("ContractNumber")
equals customers.Field<String>("ContractNumber")
join SPListItem loans in _loanList
on contracts["ContractNumber"] equals loans["Contract_x0020_Number"]
into JoinedContractLoans
from loans in JoinedContractLoans.DefaultIfEmpty()
select new { contracts, customers,loans };