Showing posts with label Entity Framework. Show all posts
Showing posts with label Entity Framework. Show all posts

Thursday, June 10, 2021

EF Logging

This is going to make it a lot more practical for me to use EF:
To log SQL statements, add "Microsoft.EntityFrameworkCore.Database.Command": "Information" to the appsettings.json or appsettings.Development.json file

Wednesday, October 22, 2014

MVC 4 with EF 5 in a Visual Studio 2013 World

Was very painful to figure out how to not get an error when I had the gall to add another DBSet to my Context.  Kept getting errors in the Controller when calling the View with the ToList method on the passed object.

Turns out it has to do with adding this to the context:

        public MyAppContext()
            : base("MyAppContext")
        {
        }


UPDATE:
Well this created all sorts of problems!
Even though the app functioned locally, when I went to deploy, it couldn't seem to create an mdf, and then inspection of my project showed that even though it seemed to be functioning complete with persisting data, no mdf was being created.

Not sure if this is what did it, but I just went ahead and created a DAL folder within which to move the Context class.  Now everything works.

Tuesday, September 23, 2014

Making Things More Complicated to Make Them Easier?

This is probably where Entity Framework started to go awry.



Wednesday, June 11, 2014

Entity Framework (EF) is really just a load of T4

(aka .tt files)
See: T4 Templates and the Entity Framework by Scott Allen , January 2011
http://msdn.microsoft.com/en-us/data/gg558520.aspx