c# - ASP.NET MVC controller action and "There is already an open DataReader associated with this Command which must be closed first" error -
i have asp.net mvc 5 application using entity framework , datatables (http://datatables.net/). problem not specific datatables, explain doing in order present full picture.
i using server-side processing option of datatables make ajax call server , data populate table of data on client. controller action responding ajax call querying database (through ef) appropriate data return client.
now, datatables framework offers search capability each time character entered search box, ajax call made server data. imagine entering characters rapidly search box on client, , each character makes ajax call server in turn queries database new data based on search criteria. can see these ajax requests come in faster time needed complete database query , return results (and close datareader), understand error. question recommended approach solving problem?
i come world of desktop applications , still relatively new web applications. based on past experience, first thought put lock around database query 1 happen @ time, reason doesn't feel right in web application.
i have read multipleactiveresultsets setting ef. enabling multipleactiveresultsets solve problem, have seen other people saying careful doing without explanation why bad.
i know applying tolist() query explicit execution , have done that, doesn't solve initial multiple request problem.
is enabling multipleactiveresultsets right solution? locking around database query right solution? web application experts recommend?
Comments
Post a Comment