Scaffolding

by 

| August 25, 2022 | in

Sometimes we just need a few screens to perform some basic data editing. Often this is necessary for an admin system.

We could build full systems for that (which has some advantages), but we might be better off with some scaffolded UI.

In software development, scaffolding is when some pre-generated code is used to get a project started quickly. This approach isn’t intended to make the project production ready. Scaffolded code often requires some work to get it “ready for prime time”.

To scaffold some UI code, we will create a new MVC project.

Starting a new MVC project

Then create a Customer entity framework model and a database context.

Creating a new scaffolded item

Adding a new scaffolded item

Stepping through the adding of a new scaffolded item

Now we can scaffold out a controller and some views. Visual Studio will do all the hard work here.

This will generate a controller and views to access these tables. While these scaffolded views will not be ready for end users, they are probably good enough for some admin screens.

generated code

author avatar
Chad Michel Senior Software Architect
Chad is a lifelong Nebraskan. He grew up in rural Nebraska and now lives in Lincoln. Chad and his wife have a son and daughter.

Related posts