This project is read-only.

MVC4 Razor Filtering Example - issues getting the example to run...

Mar 19, 2014 at 6:04 PM
I have opened the MVC4 Razor - Filtering example in VS2013. I've converted the DB to use LocalDB.

To test the DB connection I've updated the EDMX file from the DB and everything connects properly.

When I try to build the example I am getting two main errors.
Error 4 The type or namespace name 'MetaSubTasks' could not be found (are you missing a using directive or an assembly reference?) \Models\SubTasksView.cs
Error 6 'System.Data.Entity.DbSet<Mvc_Examples.Models.ToDo>' does not contain a definition for 'AddObject' and no extension method 'AddObject' accepting a first argument of type 'System.Data.Entity.DbSet<Mvc_Examples.Models.ToDo>' could be found (are you missing a using directive or an assembly reference?) \ToDoViewModel.cs
I have not upgraded the projects to include EF6 or any other newer packages yet because I was hoping to get a baseline with a working example first and then step thru updating the project to newer packages.

Any insight into what might be the problem here?
Mar 20, 2014 at 11:13 AM
Unluckely we can't update all examples to the last version of all Nuget packages for two reasons: 1)they are updated too frequentely, 2)some people still use previous version. Accordingly we leave all old examples as they are, and each time we add some new updated examples... but we can't just cover all subjects in all versions.
The best way to use an example is to create a new project and copying in it all pieces of code you need, possibly updating some method if the methods used here become obsolete, or are no more supported.
The UI parts of all examples should always be up to date so you may copy them as they are(Views and controllers), but the remainder of some examples may be obsolete.
In your case, the AddObject method of the DbSet class is no more available. You need to modify the method that passes updates, deletes, and insertions to the database to use the new methods of the last EF release. You might try to just comment out its code to see if the project compile, and then you might modify it. This should solve the second error. Probably the first error is a consequence of the first one.