Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you know of any ASP.NET MVC code generators? [closed]

Does anyone know of a good/usable ASP.NET MVC code/solution generator. Ideally it would build from a domain model, but from a data model is also acceptable.

If you do, can you answer the following:

  1. Does it produce "good" code?
  2. Can it be extended?
  3. What do you like and not like about it if you have used it?
  4. What great fearures does it come with that stand out?

If there isn't one you know of then do you think this is something missing from the community or do you not think it is needed? What features would you like to see in one?

Can't wait to hear your answers...

Thanks Scott

like image 231
Scott McKenzie Avatar asked Sep 28 '09 23:09

Scott McKenzie


3 Answers

S#arp Architecture includes scaffolding generator using T4. It generates model, views, controllers, and tests from the template model definition. You get full CRUD. Since it uses T4 (Visual Studio template language I suppose) you can extend default templates as you want.

Here's an example of the template:

EntityScaffoldingDetails entityScaffoldingDetails =
    new EntityScaffoldingDetails("Organization.Worker");

/*
 * Property names should be PascalCase.
 * Do not include a property for Id as it will be included automatically.
 */
entityScaffoldingDetails.EntityProperties.Add(
    new EntityProperty("FirstName", "string", "Joe", "[NotNull, NotEmpty]", true) 
);
entityScaffoldingDetails.EntityProperties.Add(
    new EntityProperty("LastName", "string", "Smith", "[NotNull, NotEmpty]", true)
);
entityScaffoldingDetails.EntityProperties.Add(
    new EntityProperty("BirthDate", "DateTime", DateTime.Parse("1/1/1975"))
);
entityScaffoldingDetails.EntityProperties.Add(
    new EntityProperty("Manager", "Employee", null, "[NotNull]")
);

///////////////////////////////////////////////////

// The first parameter should reflect the root directory of your solution
//ScaffoldingGenerator generator = new ScaffoldingGenerator(
    //@"D:\Work\Project\", "Orders", entityScaffoldingDetails); 

// Uncomment this line when you're ready for the scaffolding generator to fire...be sure to recomment after it completes to avoid accidental generating!
//generator.Run();

One small addition: I would not recommend using it as is, because, for example, I'd prefer controllers to work with ViewModel, not entities. And I don't use scaffolding much. But it is pretty flexible, though you may need to learn T4.

like image 153
queen3 Avatar answered Nov 15 '22 08:11

queen3


You could try a Visual Studio 2010 extension called Radarc. It has a repository of extensions (called Formulas) which allows you to generate solutions for different architectures and technologies. Using Radarc with MVC Formula you can create ASP.Net MVC 3 applications with EF Code First either from a new domain model or importing an existing database.

I am working in this product team so I am not too objective to reply all your questions, but yes it can be extended.

like image 25
RubenJMarrufo Avatar answered Nov 15 '22 09:11

RubenJMarrufo


Have you taken a look at Naked Objects MVC ? at least for academic reasons is very interesting.

The Naked Objects MVC framework will take a Domain model (written as POCOs) and render it as a complete HTML application without the need for writing any user interface code - by means of a small set of generic View and Controller classes. The framework uses reflection rather than code generation. The developer may then choose to create customised Views and/or Controllers, using standard ASP.NET MVC patterns, for use where the generic user interface is not suitable.

like image 36
AlejandroR Avatar answered Nov 15 '22 10:11

AlejandroR