Get the product featured in the book "Delivering Mobile-Friendly WebSites With MVC4"!

I've been writing ASP code generators since 1997, enabling people on my team to quickly come up to speed with classic ASP and ASP.NET. The original name for these programs was the Amazing ASP Generator. Recently the emphasis has been on making websites mobile friendly, so I've been incorporating that into these templates. With the advent of MVC4 and NuGet, it became much easier to distribute this application to others. When I converted them to fit into the "Recipe" model, I decided to rename this app to the The MVC4 FoodTruck, since a Food Truck is a way to quickly create good food based on a recipe that's also very mobile. You'll want to come back to the Food Truck often because you'll like the product.

You create an MVC4 website from a standard template in Visual Studio 2010, then add pages to the site using the tool. Point to a database, pick a table from a list, and the tool will generate a full complement of items:
  • Generates ASP.NET MVC4 pages that lists the data
  • Generates ASP.NET MVC4 pages for Add/Update/Delete functionality
  • All of the data access is encapsulated in LINQ
  • BONUS! All of these pages are optimzed for Mobile Devices also and morph their format based on the device type!

Breaking Change!

The ASP.NET MVC4 RoadMap documentation hinted that Recipes would be relocated at some point:

From the ASP.NET MVC 4 RoadMap

The ASP.NET MVC 4 Beta also contains a couple of experimental features that were included to get early feedback. These features won’t be ready for the final MVC 4 release and will be removed after the Beta. However, they do lay a foundation for future work.

  • Recipes: Recipes are a way to deliver tooling via NuGet packages in order to automate a task within a project. For example, recipes can be used to replace the existing Add Area, Add Controller, and Add View dialog boxes. Recipes can also add completely new functionality. Although we shipped support for recipes in Beta, we think recipes are a more natural fit for NuGet. Therefore, we'll move recipe support out of the MVC 4 release and have it supported by NuGet in a future release.

Unfortunately, they have now removed this feature from the MVC4 Release Candidate, and I have been unable to find any way to bring it back any other way. Supposedly, it will be released in the future, but I don't have any way of knowing when, where, or how. I've posted several questions and comments to Microsoft, but don't have any official answer.


Using the FoodTruck without the Recipe Feature

The FoodTruck application for creating lots of code quickly that we looked at in Chapter 11 is built on the MVC4 recipe framework, so that code will not work from within an MVC3 or MVC4 RC project. However, there is a nifty little feature that I added in the recipe that will allow you to use it anyway. To use this application, install the package by going to the Package Manager Console, and running the command "Install-Package LCI.FoodTruck.MVC4".

It's installed now, but you won't see it on any popup because the "Recipe" submenu does not exist - you'll have to manually go find and run the executable yourself. Locate the Packages folder for your project – usually it is right beside your project folder. Look in the Packages\LCI.FoodTruck.MVC4.*\recipes folder, and you should see both a DLL and an EXE file. The DLL is what is used by MVC4 Beta Recipes. However, you can run the stand-alone EXE file outside of Visual Studio. Everything works the same, except that you have to fill in the Path and the Namespace yourself on the Generate Code page.

Once you generate your code, that new code will not be included in your project (because this wasn't opened by the project), so you will have to go into the project yourself and include the files. Click on the "Show All Files" icon in your Solutions Explorer and you should see them in your folder. Right click on each file and choose the option "Include In Project". With this method, you should be able to generate the same models, views, and controllers that you could generate for MVC4 Beta.


Get It Now!

You can download the NuGet Package from within Visual Studio using the command:
   Install-Package LCI.FoodTruck.MVC4

I hope you find this as useful as I do. Let me know if you find any bugs using the bug reporting form.

Lyle

Facebook Twitter Amazon Give Klout!
© 2017 Luppes Consulting, Inc.
Switch To: Desktop View Tablet View Phone View Default View