且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ASP.Net MVC 2(VS2010)实体框架项目中自动生成简单的CRUD控制器和视图?

更新时间:2023-02-12 22:29:24

我的答案 - 答案是使用ASP.NET动态数据实体Web应用程序而不是ASP.NET MVC 2 Web应用程序项目模板。其余的是1-2-3-容易,并在此解释: http:/ /msdn.microsoft.com/en-us/library/cc488469.aspx


I have a standard template "ASP.NET MVC 2 Web application" solution, an empty (meaning no data inserted, but with all tables etc. ready and waiting) SQL Server database, an Entity Framework 4 model (edmx). Is there a way to generate simple CRUD controllers and form views for all the entities in the model?

A buddy out there helped me with the answer - the answer is to use a "ASP.NET Dynamic Data Entities Web Application" instead of "ASP.NET MVC 2 Web Application" project template. The rest is 1-2-3-easy and is explained here: http://msdn.microsoft.com/en-us/library/cc488469.aspx