I have the following code in my controller and in the mapping of my entity I navigate a foreign key. (Plate = anomalie.voiture.plaque)
That gives me the following exception:
An exception of type 'System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.dll but was not handled in user code
There is already an open DataReader associated with this Connection which must be closed first.
I tried to add an include() but doesn't solve the problem. Any ideas ?
ActionResult Read([DataSourceRequest]DataSourceRequest request)
(var context =
IQueryable<anomalie> damages = context.anomalie;
damages.Include(d => d.voiture);
var result = Json(damages.ToDataSourceResult(request, damage =>
Date = damage.dtajout,
Description = damage.avarie,
Driver = damage.chauffeur,
Plate = damage.voiture.plaque,
Service = damage.service,
State = damage.etat.ToString()
var result = damages.Select(damage=>
Thanks for your reply,
Indeed that's the solution I've found a bit after posting here (as always, everytime you ask a question on forum or SO you'll find the answer yourself 20 minutes later... :p)
That's working for me !