c# - How to create a join in an expression tree for LINQ? -


I have a task object in which the label is a collection of objects ... the tables in the database are called Tasks and Labels.

There are several ways to explore a task, so using LINQ, I create my LINQ query in an expression tree ... similar to the code sample below ...

  IQueryable & LT; Data.Task & gt; Query = ctx.DataContext.Tasks; If (criteria number & gt; 0) query = query. Where (line = & gt; line number == criterion number); If (criteria! Customer! = Grid. Empty) query = query. Ou (line = & gt; line.product.characterid== criteria criteria; customer ID); If (criteria.project! = GED. Empty) query = query Where (line = & gt; line.productID == criteria.product id); Var data = query Select (Row = & gt; TaskInfo.FetchTaskInfo (line)); This.AddRange (data);  

This works very well ... but now I would like to search for a particular label, for example, accounting or feature-request.

I am able to do this with a complete query in LINQPad:

  The torque is equal to the IID l.sourceId where l.Name == Select "Accounting" T  

Is it also to use the expression tree? I'm stuck!

"post-text" itemprop = "text">

I believe this should do the following:

  work. Zones (label. = & Gt; l.Name == "Accounting"), T => t.TaskId, l => l.SourceId, (t, l) = & gt; t)  

Comments