SqlException from Entity Framework - New transaction is not allowed because there are other threads running in the session
SqlException from Entity Framework - New transaction is not allowed because there are other threads running in the session
SqlException from Entity Framework - New transaction is not allowed because there are other threads running in the session
Re: SqlException from Entity Framework - New transaction is not allowed because there are other threads running in the session
After much pulling out of hair I discovered that the `foreach` loops were the culprits. What needs to happen is to call EF but return it into an `IList` of that target type then loop on the `IList`.
Example:
```
IList clientList = from a in _dbFeed.Client.Include("Auto") select a;
foreach (RivWorks.Model.NegotiationAutos.Client client in clientList)
{
var companyFeedDetailList = from a in _dbRiv.AutoNegotiationDetails where a.ClientID == client.ClientID select a;
// ...
}
```
Example:
```
IList clientList = from a in _dbFeed.Client.Include("Auto") select a;
foreach (RivWorks.Model.NegotiationAutos.Client client in clientList)
{
var companyFeedDetailList = from a in _dbRiv.AutoNegotiationDetails where a.ClientID == client.ClientID select a;
// ...
}
```