Search code examples
asp.net-mvc-3entity-framework-4dynamic-dataef-database-first

Adding dynamic data (for data scaffolding) to an ASP.NET MVC 3 site


I'm doing my first ASP.NET MVC 3 project here, and since I need to support stored procedures, I decided to use Entity Framework 4.1 with the "database-first" approach, e.g. with all the EDMX goodness.

Since I absolutely need the stored procedure support, I cannot use code-first (as much as I'd love to).

All the cool new MVC scaffolding stuff seems to be based on code-first (which I cannot use - see above) -- or is there a way / a setting to influence it so that it'll use ObjectContext instead of DbContext??.

So how do I create a quickie section of my MVC 3 app to scaffold some lookup tables - using the EF 4.1 database-first approach? Can I use dynamic data? How do I add this to an existing MVC 3 (.NET 4) project?? Can't seem to find any "add new item" entry for dynamic data..... and all the how-to videos I find are for MVC 1 or 2 and .NET 3.5 - do they still apply??


Solution

  • Please see this comment at here. I think you should customize the T4 template for your business. And Stev also have a good article at here.