markjprice / cs7dotnetcore

Repository for the Packt Publishing book titled "C# 7 and .NET Core" by Mark J. Price
http://cs7dotnetcore.azurewebsites.net/
28 stars 21 forks source link

Ch08 Explicit Loading InvalidOperationException #1

Closed jyox closed 7 years ago

jyox commented 7 years ago

In Chapter 8, in the section implementing explicit loading following the VS 2017 settings, I kept encountering InvalidOperationException Exception: There is already an open DataReader associated with this Command which must be closed first. anytime I tried confirming an explicit product load.

Seems to be solved by updating the connection string with MultipleActiveResultSets=True : optionsBuilder.UseSqlServer(@"Data Source=(localdb)\mssqllocaldb;Initial Catalog=Northwind;Integrated Security=true;MultipleActiveResultSets=True;");

markjprice commented 7 years ago

Thank you for spotting this issue, jyox!

I have fixed this in the repo, and I will add an erratum to the book's web site.