Tag: EF
-
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…