-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed as not planned
Labels
Description
ApplicationDbContext _context;
Cdkeys = this._context.Set<CdKey>();
KeyValues = this._context.Set<KeyValue>();
var keys = Cdkeys.Where(k => k.BuildType == (int)BuildKeyType.Test);
foreach(var key in keys)
{
var values = KeyValues.Where(v => v.KeyId == key.Id).ToList();//InvalidOperationException:
//There is already an open DataReader associated with this Command which must be closed first.
}
var keys = Cdkeys.Where(k => k.BuildType == (int)BuildKeyType.Test).ToList();//Because the loading is done
foreach(var key in keys)
{
var values = KeyValues.Where(v => v.KeyId == key.Id).ToList();//So,No error
}
- I don't think this lazy loading is bad, instead I think it's very cool.
- I hope the official can have some documentation about this, or help other through my example.