-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Milestone
Description
Hi,
I've just updated to RC2 and some of my tests are failing. It seems that this sample code using ForEachAsync is not working anymore:
await _dbContext.Stuff.Where(s => s.OtherId== otherId).ForEachAsync(s =>
{
s.OtherId = defaultId;
});
The exception message is "New transaction is not allowed because there are other threads running in the session." when executing "SaveChangesAsync()"
My workaround at the moment is to materialize the results in a list and then use a foreach:
var listOfStuff = await _dbContext.Stuff.Where(s => s.OtherId== otherId).ToListAsync();
foreach(var s in listOfStuff)
{
s.OtherId = defaultId;
}
Am I doing something wrong with ForEachAsync?
Thanks!