title: LINQ EF Join query from 2 different data context
body: <p>I am using LINQ to retrieve data from my EF context as well as from Asp .Net Identity 2.0 - both located in the same MS SQL Server database.</p>
  
  <p>My problem is that LINQ sees them as 2 different cases of data context and is unable to process the query.</p>
  
  <pre><code>"The specified LINQ expression contains references to queries that are associated with different contexts."
  </code></pre>
  
  <p>What I want to achieve is a simple return of 10 top items (I skip this in the code extract) from EF table, previously sorted by the UserName from ASP .NET Identity table.</p>
  
  <p>I have seen a few cases of this problem on StackOverflow but I was unable to apply any solution in my case.</p>
  
  <p>The preferred solution would be of course not to download all of the table data and do the sorting on the server.</p>
  
  <p>The query in question:</p>
  
  <pre><code>var dbDataSorted = from entry in dbData
          join user in this.UserManager.Users
          on entry.UserId equals new Guid(user.Id)
          orderby user.UserName ascending
          select entry;
  return dbDataSorted;
  </code></pre>