title: Parallel EntityFramework
body: <p>Is it possible to make some work in parallel with entity framework for following example?</p>
  
  <pre><code>using (var dbContext = new DB())
  {
  var res = (from c in dbContext.Customers
             orderby c.Name
             select new
                      {
                      c.Id, 
                      c.Name,
                      c.Role
                      }
            ).ToDictionary(c =&gt; c.Id,
                           c =&gt; new Dictionary&lt;string, object&gt; {
                                                                 { "Name",c.Name },
                                                                 { "Role", c.Role }
                                                               });
  }
  </code></pre>
  
  <p>For exampe what will be changed if I add AsParrallel?</p>
  
  <pre><code>using (var dbContext = new DB())
  {
  var res = (from c in dbContext.Customers
             orderby c.Name
             select new
                      {
                      c.Id, 
                      c.Name,
                      c.Role
                      }
            ).AsParallel().ToDictionary(c =&gt; c.Id,
                           c =&gt; new Dictionary&lt;string, object&gt; {
                                                                 { "Name",c.Name },
                                                                 { "Role", c.Role }
                                                               });
  }
  </code></pre>
  
  <p>And one more example. The question is same what are the differences in 3 examples.</p>
  
  <pre><code>using (var dbContext = new DB()) 
  { 
  var res = (from c in dbContext.Customers.AsParallel() 
             orderby c.Name 
             select new 
                      { 
                      c.Id,  
                      c.Name, 
                      c.Role 
                     } 
            ).AsParallel().ToDictionary(c =&gt; c.Id, 
                           c =&gt; new Dictionary&lt;string, object&gt; { 
                                                                 { "Name",c.Name }, 
                                                                 { "Role", c.Role } 
                                                               }); 
  } 
  </code></pre>