title: Writing LINQ queries. Joins VS navigational properties
body: <p>I am trying gain more understanding of Linq queries and Entity Framework (4.1). Please take a look at following two queries. Both queries returns car type name (CarType.Name)</p>
  
  <p>In first query I used join and ignored navigational property CarType</p>
  
  <pre><code>from c in Cars.AsEnumerable().
  Where(e =&gt; e.CarId == Guid.Parse("0501cc96-5610-465d-bafc-16b30890c224"))
  join ct in CarTypes on c.CarTypeId equals ct.CarTypeId
  select new CarType {
      Name = ct.Name
  }
  </code></pre>
  
  <p>In second, I used navigational property CarType</p>
  
  <pre><code>from c in Cars.AsEnumerable()
  where c.CarId == Guid.Parse("0501cc96-5610-465d-bafc-16b30890c224")
  select new CarType {
      Name = c.CarType.Name
  }
  </code></pre>
  
  <p>I ran both in LinqPad therefore there is Guid.Parse function.</p>
  
  <p>When I run these, first statement runs faster. LinqPad reports 00:00:036. 
  Second statement runs slower and LinqPad reports 00:00:103</p>
  
  <p><strong>Looking at results it seems that Linq queries that use joins instead of navigational properties are faster. Is that really so? Please somebody shead some light to this. Are there any general guidances, the best practices that I should follow when writing Linq queries?</strong></p>
  
  <p>Thanks</p>