title: Entity Framework returning IQueryable of join of two tables
body: <p>I'd like to use Entity Framework to return data from 2 tables, and a selection of columns of the 2 tables, at first I was not having much luck with something simple, like returning int's and strings (ie. <code>select new { id = t1.ID, other = t2.OtherData }</code>, as casting that anonymous type was cumbersome at the destination (destination being my winform), so I struck on the idea to just return both table rows...</p>
  
  <p>So something like this :</p>
  
  <pre><code>  public static IQueryable&lt;{Table1,Table2}&gt; byRecID(Guid recID, MyContext DBContext)
    {
        return (from i1 in DBContext.Table1
               join j1 in DBContext.Table2 on i1.GroupID equals j1.GroupID
               where i1.RecID.Equals(RecID)
               select new { i1, j1 }).SingleOrDefault();
    }
  </code></pre>
  
  <p>This is all fine EXCEPT the return type of the method is incorrect. I've tried a few combinations. Unfortunately, when I call "byRecID" from the winform, "SingleOrDefault" is not available, but IS available inside 'byRecID' method, so I can't just return <code>IQueryable</code>, needs to be the typed <code>IQueryable&lt;SOMETHING IN HERE&gt;</code> (because <code>SingleOrDefault</code> not an extension of <code>IQueryable</code>, only <code>IQueryable&lt;T&gt;</code>). </p>
  
  <p>My Question... is there a syntax for 'SOMETHING IN HERE' that lets me specify its a join of two table rows?</p>
  
  <p>and I'm wondering... Why is SingleOrDefault an option INSIDE the method but not an option of the result of the method when called from my winform? </p>
  
  <p>Basically I was hoping for something that allows clean data calls from my winforms, without casting to hideous anonymous types then using reflection (like when I returned anonymous type of primitives), but also don't want to spawn a Type just for use by my <code>byRecID</code> method.</p>