Introduction To Scaffolding in Visual Studio 2013 RC

Introduction

This article describes CRUD Operations using Visual Studio 2013 RC. In this version CRUD operations are done the same as in 2013 Preview with some changes in the Scaffolding option. MVC Scaffolding is completely changed in Visual Studio 2013 RC.

In that context, I am developing an MVC application in which CRUD operations are done with the new MVC Scaffolding in Visual Studio 2013 RC.

Prerequisites

  • Visual Studio 2013 RC 
  • ASP.NET Web Application with MVC Project Template

Start with Scaffolding

As you already know, in ASP.NET Web Applications, Scaffolding is a code generation framework. Using Scaffolding in Visual Studio RC 2013, you can save time developing standard types of Web Applications. We use Scaffolding to add moderate code to interact the data model.

Let's have a look at Scaffolding below.

Note: Before beginning please create a MVC 5 Application and add a class in the model. Have a look here

Step 1: In your Solution Explorer, right-click on your Controller to add a Scaffold.

Scaffolding-in-RC2013.jpg

Step 2: Select the option as shown in the figure below:

AddScaffold-in-RC2013.jpg

As you can see, the Add Scaffold wizard is different in this version. WebForm Scaffolding is removed from this version because it is not ready yet. Microsoft is trying to remove this in the future release.

Step 3: Enter the Controller name, Model class and data context class as shown in the figure below:

AddController-in-.jpg

Note: If you get an error then it may be possible that you didn't build your solution before scaffolding.

Step 4:  Visual Studio starts Scaffolding and adds a controller as you give. It creates and adds many files and folders to your application. You can see in your Solution Explorer.

Scaffolding2-in-RC2013.jpg

SolutionExplorer.jpg

You can see the EmployeesController.cs file that was automatically created with the CRUD methods defined.

Controller.jpg

Step 5: Debug your application and create some employee details.

Summary

So far with this article you will learned the new Scaffolding methodology and its use in the latest version of Visual Studio 2013 Release Candidate. The Scaffolding wizard is completely rewritten in this version.


Similar Articles