Tag: Entity Framework
-
No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’ – MVC5
Hey everyone, Just an error I came across while trying to use a new solution project: No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’ The fix for this was simply to run the following command in the package manager console: PM> Install-Package EntityFramework Thanks to StackOverflow for the details: http://stackoverflow.com/a/18642452/522859
-
View Generated SQL in Entity Framework (EF)
Hey everyone, Just a quick post on how to view the generated sql in entity framework. To start with, just add the following line to your db context constructor: public class TestDbContext : DbContext { public TestDbContext() : base(“name=TestDbContext”) { this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); //This line } … With this line added, you should…
-
Duplicate type name within an assembly. – Entity FrameWork (EF)
Hey everyone, I ran into this error message while trying to debug a project today: “Duplicate type name within an assembly.” The workaround to this was actually pretty weird. Remove all of your breakpoints that appear before this exception and place one after it instead. That’s it! A bit of a weird issue, but…
-
There is already an open DataReader associated with this Command which must be closed first. – ASP.NET MVC
Hey everyone, I ran into the following error this morning: There is already an open DataReader associated with this Command which must be closed first. It turns out there are a few causes for this. My issue was that I was attempting to open a result set while already iterating over another one. //Retrieve list…