Parallel EntityFramework
- by mehanik
Is it possible to make some work in parallel with entity framework for following example?
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 => c.Id,
c => new Dictionary<string, object> {
{ "Name",c.Name },
{ "Role", c.Role }
});
}
For exampe what will be changed if I add AsParrallel?
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 => c.Id,
c => new Dictionary<string, object> {
{ "Name",c.Name },
{ "Role", c.Role }
});
}