Tools for auto-generating ASP.NET MVC CRUD UI? - asp.net-mvc

Does anyone know of any tools for generating ASP.NET MVC CRUD User Interfaces (E.g. the controllers and views for Admin tools), given:
A set of model objects.
A set of repositories for retrieving those objects.
Thanks

There is a project on codeplex called MVCCrud this will automate repository and controller. Also optionally supports JqGrid (searching, sorting etc). It isnt included in the project but its very simple to add some T4 templates to generate the desired view.
If you just want normal crud functionality this is very very quick. Only downside is the only repository is Linq2Sql, but you can easily add your own using their interface it is prity simple to extend or use parts of.

The Crud Template which are shipped with ASP.NET MVC are based on T4 which is a code generation tool which ships with Visual Studio. This means you can take the templates and customize them based on your taste and make your own...
take a look at Scott Hanselman's ninja tips and tricks video's he goes into details here:
http://channel9.msdn.com/posts/matthijs/ASPNET-MVC-2-Ninja-Black-Belt-Tips-by-Scott-Hanselman/

Serenity Platform
Serenity is an open source project aiming to reduce boiler-plate code in your development project.
It comes with a T4 based code generator that will produce services and UI for your tables.

Related

ASP.NET MVC 5 Custom Scaffolding Option [t4 templates]

Currently , I am developing a framework , I want to add custom scaffolding option in visual studio menu.
By default "MVC5 Controller with views, using Entity Framework" option 3 from the dialog box chooses "CodeTemplates\MvcControllerWithContext\Controller.cs.t4" , that t4 again targets view t4 templates inside
"CodeTemplates\MvcView\ModelMetadataFunctions.cs.include.cs.t4"
"CodeTemplates\MvcView\Create.cs.t4"
"CodeTemplates\MvcView\Edit.cs.cs.t4"
"CodeTemplates\MvcView\Delete.cs.cs.t4"
"CodeTemplates\MvcView\List.cs.cs.t4"
I have been modifying t4 templates almost a year, I haven't found a single piece of evidence that suggest that how it is targeting those views or how to add option in the scaffolding dialog. I have googled a lot , however haven't found anything close.
In summary , I am only looking for the place where I can add or modify the locations for those t4 templates and add a reference of a new scaffold in the scaffolding dialog box.
Any of the answer will be dearly appreciated. Thank you.
Before continuing to implement your framework using T4, you should be aware that the ASP.Net vNext team have quietly dropped support for T4 from MVC6 projects, so unless that decision is reversed, you will not be able to upgrade your framework.
As of Visual Studio 2015 CTP6, MVC6 projects do not support Single File Generators, which are a requirement for T4. The reasons given by the ASP.Net vNext team are described on the official GitHub repository for ASP.Net.
https://github.com/aspnet/Home/issues/272
UPDATE
David Fowler from the team has now (29-04-2015) confirmed that Single File Generators will be supported in MVC6, which in turn should allow support for T4.
UPDATE 2
To revert back to your original question on the topic of using Custom Code Templates for Scaffolding, this is not finalised for MVC6 and Visual Studio 2015.
I raised this question on the ASP.Net GitHub issue tracker thread mentioned above; Sayed Ibrahim Hashimi (MSFT) replied there will be some discussion regarding which technology and implementation will be followed, and at the moment the main candidates are T4 or Razor generator.
Sayed pointed to the following article that shows some early thoughts, but stresses that this is not finalised, and people should not time invest in this approach as it is likely to change.
http://blogs.msdn.com/b/webdev/archive/2014/08/23/how-to-customize-scaffolding-templates-for-asp-net-vnext.aspx

Separate solution into different projects

I'm currently learning ASP.Net MVC; I'm using Visual Studio Express 2012 with MVC4 (which is the last version) and I'm totally new to this stuff. My goal is to rewrite a huge web application to MVC, so I was told to separate my main solution into 3 projects using the code-first method:
The core (models and controllers I guess)
The UI (views, scripts, and Content)
And the Database (Entity Framework 5.0 will be used)
I'm quite familiar with MVC, but not separating stuff into different projects. Now I'm a bit lost, I don't have a clue on how to do that, which should reference who, where, how, etc.
Your solution could be structured this way:
UI - ASP.NET MVC application project containing the controllers, views, view models, mapping logic between your domain models and view models, scripts, styles, ...
DAL (EF 5.0, EF autogenerated domain models, Data Contexts, ...) everything that is specific to the data retrieval
The UI layer will then reference the DAL layer.
Some people might also opt to externalize the controllers, view models and mapping logic into a third layer which in turn will reference the DAL layer. The UI layer in this case will reference both other layers.
There are tutorials available on here: http://www.asp.net/mvc
It really helped me out to get the basics of MVC, but be aware - sometimes there are parts missing in the video's, but you can find the code which isn't provided easily elsewhere.
Good luck :)
The tutorials are used to show code first.
create an empty solution using the Visual Studio Blank Solution template
add a solution folder (folder name will be your project name)
then right click that folder and select add project then select "class library" (for The c# classes domain logic)
same again right click the folder and select add project then select asp.net mvc3 template
then same way you create the test template as a new project.
For more information you can follow this book http://www.apress.com/9781430234043

How to write an MVC3 Project Template that will offer option Razor or .aspx views

I have written two separate project templates to create MVC3 projects (both based on the standard Microsoft template, but with additional controllers/views of my own) - one with ASPX views, and the other with Razor views.
But, rather than have two separate templates, I would rather mimic the way that the Microsoft MVC3 template works, which offers both view engine options, selected in a second dialog. I know that this is done with a Wizard, but I can't find the Wizard in the MVC source code (which I've downloaded). Does anybody know where to find the Wizard, or have other helpful suggestions? Thanks.
The custom MVC New Project dialog exists in Microsoft.VisualStudio.Web.Mvc.3.0.dll. We do not ship the source code for that assembly.
I used the Export Template Wizard to create an ASP.NET MVC3 Project Template of my own. This worked OK, but did not offer the same options that Microsoft ships with their Visual Studio MVC assembly. I also ran into an issue where the strongly-typed views were not being updated with the correct namespace. They were keeping the namespace of my original project, while the Controllers and Model was correct.
We would love to have the source code made available for MVC 3 Project Templates!
Here is the Wizard I used. It definitely comes in handy. http://visualstudiogallery.msdn.microsoft.com/57320b20-34a2-42e4-b97e-e615c71aca24/
Phil Haack has documented how to create a custom MVC3 project template that will appear inside that wizard (as opposed to a normal project template that won't)
haacked.com/archive/2011/06/06/creating-a-custom-asp-net-mvc-project-template.aspx
If you follow that process you'll only end up with razor as the possible view engine. To get other view engines, you need to expand the reg files to list spark etc. Details on doing that are provided in this stack overflow answer:
Add custom viewengine to New project dialog?

Are there add-on libraries or tools available for ASP.NET MVC development?

My first experience with ASP.NET MVC and the Entity Framework has raised my interest in this framework and I would like to implement some basic applications, covering the basic requirements of real-world web applications. So far the support given by VS 2008 is already impressive.
For some areas however, it might be a time saver to use existing add-ons or libraries of all kind. Are there already commercial or open solutions which I should take a look at?
Some of them:
S#arp architecture
MVCContrib
MVC Project Awesome
Be sure to check out example projects.
Telerik has made some UI stuff too (haven't checked out yet).
You might be interested to check out other view engines like:
Spark (this one kicks a$$)
NHaml
Haack recently posted about .less - might be worth checking out for managing css
T4MVC by David Ebbo library is a nice solution how to make your asp.net mvc app more strongly typed.
For UI testing - Watin framework.
Here's Jimmy talking about implementation and solution of common problems when doing UI testing. Seems to me that he prefers Gallio + NBehave + MbUnit combo but i personally like BehaveN (it doesn't need test runner, is not tied with particular unit test framework).
HtmlAgilityPack is a nice tool if working with raw html is necessary.
MvcTurbine might simplify technical part of your asp.net-mvc project.
Found useful MvcExtensions extension made by Kazi Manzur Rashid.
For managing javascript and css - Chirpy.
Object to object mapper for MVVM support - AutoMapper.
elmah is great for error logging.
Not necessarily MVC specific, but:
MVC lends itself to take advantage of all the jQuery UI controls and pretty things.
There's also Elmah, and StructureMap for DI/IOC.
Nothing much else to add here except that xVal is a really nice validation library, utilising jQuery. My company is currently in the process of moving from a 'roll-your-own' solution to this.
There are some useful links at the bottom of this post.
Including:
MVC HtmlHelper for Gravatar
Paging HtmlHelper for ASP.NET MVC
Marquee and GridView HtmlHelpers for ASP.NET MVC
ReCAPTCHA HtmlHelper (and also a solution to use ReCAPTCHA in ASP.NET MVC)
ASP.Net MVC Extension method to create a Security Aware Html.ActionLink
CheckboxList Helper
Also, keep an eye on some of the big component developers. Telerik has a demo of some MVC components and I hear DeveloperExpress has some on the way too.
Just to add details to Telerik's MVC support:
We just kicked-off our official support for ASP.NET MVC with last week's CTP. Our new UI Extensions for MVC will aim to bring the productivity of WebForms to MVC without violating any MVC concepts. Our new extensions are built from the ground-up specifically for MVC and they will leverage jQuery on the client for all behaviors and Ajax.
Further, the Extensions are completely open source, licensed under the Microsoft Public License (MS-PL) - the same license that the ASP.NET MVC framework ships under. You can find the CTP source today on Telerik.com or on CodePlex:
http://telerikaspnetmvc.codeplex.com/
All of that said, this is our early support. We will ship the first 3 UI Extensions in November and build from there in 2010. The first planned Extensions are:
Grid
Menu
TabStrip
You can find more details, demos, and downloads on Telerik.com:
www.telerik.com/mvc
Hope that helps.

Modular Architecture - ASP.NET MVC

I've searched (google and SO) about this topic and couldn't find a thorough answer to my question(s).
I'm building an ASP.NET MVC 2 application that will be distributed to other people (with source code). These people will need to create modules/plugins that use the application's base.
The base is a simple ASP.NET MVC Application with Linq-To-Sql file, repositories, authorization/membership.
Is it possible to create a plugin that would work by simply adding a .DLL file in a folder?
Right now, you can create a "plugin" by opening the source project of the base application, creating a few controllers/views that do somethings, using the base application's authorization/membership and repositories. You would also be required to edit the Linq-to-Sql file and add in any tables that you need.
However, to "install" this plugin, I would need to copy the controllers/views for this plugin into my base application and edit the Linq-to-Sql class to include the tables necessary for this plugin, then build the solution. Is there a simpler method?
I read of .DLL plugins, but how would someone build a plugin like this starting from the base application.
If the 'plugin' creates tables with foreign keys of the "User" table in the main application, how does one separate those tables/relationships in a separate file and have the base application recognize those relationships?
As you can tell, I'm asking multiple questions that are kind of all over the place. This is a new topic/issue for me and I have no idea where to start. Theme mere concept of having my application interact with a separate .DLL file is foreign to me.
Any help/links would be greatly apprecaited.
Does this answer the same question: Plug-in architecture for ASP.NET MVC?
I think this could be applied to mvc too: http://msdn.microsoft.com/en-us/library/ms972962.aspx

Resources