I'm using OData with Entity Framework and am having some problems when using $expand.
I'm getting this error:
"There is already an open DataReader associated with this Command which must be closed first."
It's occurring when I try to access an associated entity (Bank) from within a property.
```
public string Currency
{
get
{
return Bank.Currency.Description;
}
}
```
This error only occurs when I $expand the entity when querying the "parent" entity.
Should OData support this scenario?
Comments: Thanks, enabling MARS fixed the error. However, it is fetching one Bank record at a time, is there any way to make it eager load all the Bank records? It's like I need some way to specify that I want to `Include(c => c.Bank)` when `$expand=Client` is specified in the URL.
I'm getting this error:
"There is already an open DataReader associated with this Command which must be closed first."
It's occurring when I try to access an associated entity (Bank) from within a property.
```
public string Currency
{
get
{
return Bank.Currency.Description;
}
}
```
This error only occurs when I $expand the entity when querying the "parent" entity.
Should OData support this scenario?
Comments: Thanks, enabling MARS fixed the error. However, it is fetching one Bank record at a time, is there any way to make it eager load all the Bank records? It's like I need some way to specify that I want to `Include(c => c.Bank)` when `$expand=Client` is specified in the URL.