Erro:已有打開的與此 Command 相關聯的 DataReader,必須首先將它關閉。
處理方式有兩種
1,設定ConnectionString加上MultipleActiveResultSets=true,但只適用於SQL
2005以後之版本
2.先讀出放置在List中
foreach(Employee emp
in context.Employees.ToList())
{
emp
.Customer .... //通過,因emp這時候已經不是context中的參考物件,而是獨立的instance,與context脫鉤
}