C # LINQ Dynamic Join

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 would like to do a Join on two expressions (knowing that this will give AND). I have some code:

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

      

And this gives the expected result. Is there a way to do this dynamically with an inline expression? I have metadata that defines relationships and expresses string concatenation much easier than expressing it in code. I see implementations of other keywords in DynamicQueryable, maybe someone has Join already written similar to existing methods.

0


a source to share


1 answer


I found the solution here: How to create a dynamic LINQ connection extension method



+1


a source







All Articles