문제

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??

도움이 되었습니까?

해결책

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.

다른 팁

It ended up being impossible to use the built-in scaffoling for ASP.NET MVC 3 without an outrageous amount of extra work - so I ended up going back to ASP.NET Webforms for this little project of mine.

Hope you had tried this:

Scaffold Controller Participant -force -repository -DbContextType "DBEntities" 

where DBEntities is the name of model class generated by entity framework.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top