Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

288
Views
Is there a way to use a memberexpression inside a join/linq? reflection

I'm trying to do a dynamic join for entity framework and having a few problems. I'm storing in a dictionary my lambda which is what I want to be used in the generic join.

So for example I would insert into the dictionary x => x.table1.table2.myid

I'm then trying to use that path which works in a join (when not dynamic)

Normally expression1 & 2 would be the same(int) as the value passed into the dictionary.

myquery.Join(
            table,
            t => expression1, d=> expression2,
            (t, d) => new { t, d});

I feel like i'm a dead end and I cant find anything at all about doing a dynamic join like this using a navigation property. I was hoping memberexpression would be what I need but it seems not. I've tried various combinations of expressions.lambda and other expression functions to no avail either. I'm hoping someone can give me some direction here!

It does compile with the memberexpression but thats because left and right side of the join are the same type so it allows it

Is this even possible?

Further research I think I need to do something more with

return Expression.Lambda<Func<T, bool>>(body, item);

However if I do this the join won't work as T will be two different items. There must be a simple way to get two navigation properties dynamically both ints!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It is not very clear to me what you have in mind, but if you need two different items as input of your Func you can take a look at this: https://docs.microsoft.com/en-us/dotnet/api/system.func-3?view=netcore-3.1

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!