title: Conditional Joins With Linq
body: <p>Is there a way to progressively / conditionally add joins to a query? I am creating a custom reporting tool for a client, and the client is given a list of objects he/she can select to query on. There will always be a base object used in the query ("FWOBid").</p>
  
  <p>So, for example, if the customer selects objects "FWOBid", "FWOItem", and "FWOSellingOption", I'd want to do this:</p>
  
  <pre><code>var query = from fb in fwoBids
  
  // if "FWOSellingOption", add this join
  join so in sellingOptions on fb.Id equals so.BidId
  
  // if "FWOItem", add this join
  join i in fwoItems on fb.Id equals i.FWOBidSection.BidId
  
  // select "FWOBid", "FWOItem", and "FWOSellingOption" (everything user has selected)
  select new { FWOBid = fb, FWOSellingOption = so, FWOItem = i };
  </code></pre>
  
  <p>The trick is the customer can select about 6 objects that are all related to each other, resulting in many different combinations of joins. I'd like to avoid hard coding those if possible. </p>