ASP.NET MVC 3: Automatically create a view when adding a controller (without Entity Framework)

I am trying to learn MVC. I want to automatically generate the required view code when I add a controller. This is possible if I select the "Controller with read / write actions and views using Entity Framework" option. However, I do not use Entity Framework. How can I achieve similar behavior without using Entity Framework? And why can't it automatically generate a view when I don't use the Entity Framework?

Also, is there a good MVC3 tutorial that doesn't use Entity Framework (with the ability to download code)?

Link

  • How to configure ASP.net MVC on Scaffold using ADO.net Data Service?

  • Levergaing T4Scaffolding for WCF Web API

  • ASP.NET MVC 3 and NHibernate Scaffolding

  • Launch an ASP.NET MVC 3 Project with the MvcScaffolding Package

  • LINQ to SQL or Entity Framework again for new MVC 3 project

  • MVC Scaffolding for WCF Services

  • Create a drop-down list for MVC3 using Entity Framework (.edmx Model) and Razor Views && & && Inserting a database record into multiple tables

+1
asp.net-mvc asp.net-mvc-3 razor entity-framework
Feb 17 '12 at 12:28
source share
1 answer

You can find some of what you are looking for in the Steve Sanderson MvcScaffolding package.

Nuget

Install-Package MvcScaffolding 

After installation (probably set some EF requirements), you could tint the basic CRUD views for your model as follows, assuming the model type is MySweetModel

 Scaffold Views MySweetModel 

Note that this command will not create a controller class, but should create the following views in the /Views/MySweetModel

  • _CreateOrEdit.cshtml
  • Create.cshtml
  • Delete.cshtml
  • Details.cshtml
  • Edit.cshtml
  • Index.cshtml

It looks like you can override the default T4 templates , but I never used MvcScaffolding outside the EF area. It is also possible that someone has already done this for your save layer, for example. NHibernate or whatever you use. I would have looked a bit before implementing my own templates.

+7
Feb 17 '12 at 12:50
source share



All Articles