views:

146

answers:

2

Hello, I would like your advice about how best to solve my problem.

In a Web server is running. NET Framework 4.0. Whatever the methods and technologies you would advise me. applications built on the basis Asp.NET MVC 2.

I have a database table in MS SQL Server. For each table in database, I must implement the interface for viewing, editing, and deleting. So code generator must generate model, controller and views.. Generation should happen after clicking on the button in WEB UI. as Model I use .NET Entity Framework.

Now, I need to generate controllers and views.

So if i have a table with name tableN1. and below its colums:

  • [ID] [bigint] IDENTITY(1,1) NOT NULL,
  • [name] [nvarchar 20] NOT NULL,
  • [fullName] [nvarchar 50] NOT NULL,
  • [age] [int] NOT NULL
  • [active] [bit] NULL

agree: if the type bit, then generate a checkbox. nvarchar (20) - textbox nvarchar (max)-textarea and so on.

for this table, i want to generate views and controller. thanks.

PS. solution for this problem must be FREE

+1  A: 

You could use CodeSmith or t4 templates

Daniel Dyson
I'd agree it's generally more economical to use a paid-for 3rd party product than to write this kind of thing from scratch yourself (presuming you place any value on your time and effort).
Dan Diplo
Yes, 3rd party is often better for this kind of thing. I included the T4 link because it is a very good article to get people started on how T4 works, escpecially with MVC. It is also free.
Daniel Dyson
+2  A: 

You can use T4 Templates for this.

The Add Controller and Add View dialogs use this behind the scenes in ASP.NET MVC.

RedFilter