Search code examples
.netasp.net-mvc-3visual-studioscaffolding

When to use MVC Scaffolding via NuGet vs MVC Scaffolding via MVC3 Tools Update


I am a little confused about the various different "mainstream" scaffolding options for MVC3. There is a NuGet package called MVCScaffolding. It first showed up in Jan 2011, but seems to be active and have recent updates, and be developed by Scott Hanselman, among others. Then in May 2011 came the MVC3 Tools Update. This seems like it incorporated the original scaffolding ideas into an "out of the box" scaffolding options. However, this has not been updated since.

So - what is the relationship between these two scaffoldings (if any). Are there cases when one should be used over the other, or is it just a matter of taste? Does Visual Studio 2012 or MVC4 change the game on any of this?

Thanks for any input.


Solution

  • From my investigations so far:

    MVCScaffolding:

    • Designed to use the Code First EF implementation*, with DBContext data context & POCO models
    • Provides a very fast way to create an MVC web app build using the Repository data access pattern

    MVC3 Tools Scaffolding

    • A way to create Controllers and Views for a model, using either the EF Database First, or EF Code First approach
    • The Controllers it creates use the data context directly (as opposed to via a data access abstraction like a Repository)

    *There is a way to get the MVCScaffolding working with Database First, but you have to work it a little.

    My Conclusions (subjective)

    • Code First, use MVCScaffolding.
    • Database First, use MVC3 Tools scaffolding.

    Overall, the Code First & MVC3 Scaffolding seems a more "best practice" approach. The Repository creates more clean opportunities for unit tests, and the POCOs mean there is not data access code bleeding across application tiers.

    As for MVC4, I am not sure.

    I hope this helps!