Hello!
I did all the ToList() to all lookup methods but still having same 2 exceptions.
For the others methods i am calling, like "moveDirectory" that updates data on the database can i make the submitChanges and close the reader? Maybe is something like that? Or in the dispose of the connection is all solved?
Example:
burningice wrote:
I did all the ToList() to all lookup methods but still having same 2 exceptions.
For the others methods i am calling, like "moveDirectory" that updates data on the database can i make the submitChanges and close the reader? Maybe is something like that? Or in the dispose of the connection is all solved?
Example:
using (DataConnection connection = new DataConnection())
{
var subfiles = (from f in connection.Get<Composite.Media.DBMediaFile>()
where f.FolderPath.Contains(oldFolder + "/")
select f);
foreach (var file in subfiles)
{
file.FolderPath = newFolder;
connection.Update<Composite.Media.DBMediaFile>(file);
}
}
Regardsburningice wrote:
You're most likely iterating over a lazy-loaded IEnumerable collection, while doing new data lookups. Fix for this is usually to call .ToList() before enumerating to be sure not to keep the datareader open.
Here is an example of fixing the very same issue https://bitbucket.org/burningice/compositec1contrib/diff/Sorting/Web/UI/SortData.cs?diff2=33ffdfc48891&at=default