只是尝试在嵌套的foreach
循环中转储存储的实例的字符串。
foreach (var Company in db.Companies)
{
Console.WriteLine($" - {Company.Name}");
foreach (var Department in db.Departments)
{
Console.WriteLine($" - {Department.Name}");
}
}
只是尝试访问db.Departments
,最终尝试重用已打开的连接 - >错误!