Scaffold Your ASP.NET MVC Web App For Rapid CRUD Functionality

September 6th, 2012 0 Comments

The term “Scaffolding” is used by many software technologies to mean “quickly generating a basic outline of your software that you can then edit and customise”. The scaffolding package we’re creating for ASP.NET MVC is greatly beneficial in several scenarios:

  • If you’re learning ASP.NET MVC for the first time, because it gives you a fast way to get some useful, working code, that you can then edit and adapt according to your needs. It saves you from the trauma of looking at a blank page and having no idea where to start!
  • If you know ASP.NET MVC well and are now exploring some new add-on technology such as an object-relational mapper, a view engine, a testing library, etc., because the creator of that technology may have also created a scaffolding package for it.
  • If your work involves repeatedly creating similar classes or files of some sort, because you can create custom scaffolders that output test fixtures, deployment scripts, or whatever else you need. Everyone on your team can use your custom scaffolders, too.

Other features in MvcScaffolding include:

  • Support for C# and VB projects
  • Support for the Razor and ASPX view engines
  • Supports scaffolding into ASP.NET MVC areas and using custom view layouts/masters
  • You can easily customize the output by editing T4 templates
  • You can add entirely new scaffolders using custom PowerShell logic and custom T4 templates. These (and any custom parameters you’ve given them) automatically appear in the console tab-completion list.
  • You can get NuGet packages containing additional scaffolders for different technologies (e.g., there’s a proof-of-concept one for LINQ to SQL now) and mix and match them together



You can install the package using the NuGet Package Manager Console, so it only takes a few seconds and you don’t have to download anything using your browser.  To do so,

  • Open the Package Manager Console window using Visual Studio’s View->Other Windows->Package Manager Console menu item.
  • Enter the following:
Install-Package MvcScaffolding


Create Model:

Add the following class to your Models folder, then compile your solution (Ctrl-Shift-B):

namespace MvcApplication1.Models
    public class Test
        public int TestId { get; set; }
        public string Name { get; set; }
        public string City { get; set; }
        public DateTime Founded { get; set; }


Let The Magic Begin!

Create a complete Create-Read-Update-Delete (CRUD) UI for this model by issuing a single scaffolding command into the Package Manager Console:

Scaffold Controller Team


Notice that it’s created everything you needed, including the controller and all of the logic required for the CRUD functionality, and the associated views.  It will include form validation as well.  It’s all there and ready to go.  Does it get any easier?


5 Things When Considering A Web Development Framework

May 10th, 2011 0 Comments

There are so many frameworks in web development that, to be frank, most developers find it confusing at times. Many developers are jumping around from one to another, if for no other reason, to add it to their resume. This article is designed to help cut through the confusion, and the bias online, and provide some thoughts that will help in your decisions.

This is a basic list of things to consider when choosing a framework:

1. Who’s behind the framework? Is it backed and endorsed by a large company, or perhaps a small group of developers looking to make a name, or otherwise just a new company looking to emerge? This should be very important in making a decision with not only the current framework you use with your projects, but even deeper, the platform and technology direction overall.

2. Is the code constantly being updated, tested, and maintained by a large professional team of developers? Technology changes, and so should the frameworks you use. It’s a constant pursuit to improve and debug that requires a lot of resources and man hours.

3. The code base should be of the highest quality, fully standardized and professional coding practices that will stand the test of time. It’s not about being a perfectionist, but it is about creating real solutions with solid products that have a reasonable life cycle.

4. A framework is only as good as it’s documentation and support. If it’s not easy to use, if it’s doesn’t produce better products, if it’s not speeding the time of development, then there is no point at all in even attempting to use it. This happens from great efforts to clearly document and to demonstrate common scenarios with written and video tutorials, etc.

5. What kind of work do you want? Do you want to work with professional organizations and long term contract work or jump from client to client with short turn around low level work? You must choose the technology path that meets your goals, and just the same, the framework goes nearly hand in hand with that direction.

Now that we know how you should choose, let’s look at the current options:

Tier 1:
Microsoft – .NET

Tier 1 options are driven by large commercial for-profit companies with a large number of developers supporting and maintaining them, a large amount of money backing them, and are solid “enterprise worthy” directions. As a result, they are found as your tier 1 options.

Tier 2:
JAVA – Struts
JAVA – Spring
PHP – Zend Framework
Python – Django

Tier 2 options are also driven by quality companies with a large number of developers supporting them, and are solid directions that are considered “enterprise worthy” in many cases. Django may be a surprise by some, however, Python has proven to be a force to reckon with in the development community, and Django has played a large part in that movement. The other options in this tier should be no surprise.

Tier 3:
Ruby – Rails
PHP – Yii
PHP – Symfony
PHP – CodeIgniter

Tier 3 options are solid options, however, they are for the most part community driven by a smaller group of developers. Tier 3 options tend to be popular for a few years, then lose traction. They are also prone to complete overhauls where the framework is built again from the ground up to address issues and poor long term vision, which may break functionality of existing projects.

Tier 4:
If you’re not in the first 3 tiers, one should question whether you’re willing to roll the dice on such a development path for your projects. Sure, anyone can build their own framework, and many of the tier 4 and lower options are just not stable enough to guarantee their future.

Some may agree with the assessments, and of course, some will not as their favorite framework falls lower on the scale then expected. However, the vast majority of non-biased software/web/mobile architects will agree with these findings. With that said, there is no “wrong” framework to use provided it eases your development process, but if you’re looking for career paths and long term life cycles, you should consider these 5 points.

Zend Framework The Easy Way

July 25th, 2010 0 Comments

Zend Framework changes quickly, so the easiest way to maintain your server installment for all platforms is the google code pear channel.  That’s the only channel that seem to be updated on a regular basis.

pear channel-discover
pear install zend/zend   OR   pear install zend/zend-1.10.6  (choose the version # you want)

… and at any time you can upgrade using

pear upgrade-all

Now you’ll always have the latest and greatest releases of the Zend Framework installed.  Happy coding