tags:

views:

1545

answers:

1

Duplicate: How to create a dynamic Linq Join extension method

I am using System.Linq.Dynamic to create dynamic two queries

var foos = db.Foos.Where(whereClause1);
var bars = db.Bars.Where(whereClause2);

I'd like to do a Join on the two expressions (knowing it will give an And). I have a join in code:

var target = from f in foos
             join b in bars on f.SomeId equals b.SomeId                               
             select f;

And this yields the expected result. Is there a way to do this dynamically with an expression in a string? I have metadata that defines the relationships and expressing the join by a string would be much simpler then expressing it in code. I can see the implementations of the other keywords in DynamicQueryable, maybe someone has a Join already written similar to the existing methods.

A: 

I found the solution to this here: http://stackoverflow.com/questions/389094/how-to-create-a-dynamic-linq-join-extension-method

blu