Click to See Complete Forum and Search --> : how to extend join in linq...


johnix
02-05-2011, 11:24 AM
How can i extend or create dynamic join in linq?

IEnumerable<DataRow> drModel = from cModels
select cModels;

if (true){
drModel = drModel.Join(my statement for join);
}

but I manage the dynamic where like this

drModel = drModel.Where(cModels => cModels.Field<Int64>("Id") == Convert.ToInt64(Id));

Can anybody help me? :(

Ribeyed
02-05-2011, 05:22 PM
Hi,

here is a link to a msdn post where there is a good example of a join within a linq query. You should be able to use that to build your own join.

http://social.msdn.microsoft.com/Forums/en/linqprojectgeneral/thread/ce442ea3-5486-449b-a3da-a4b997108ffd

Hope that helps.


regards

Ribs