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")

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.

No comments: