The requested page is not available for the requested platform. You are viewing the content for Default platform.

Scaffolding

  • 3 min to read

The DevExtreme Scaffolder for Visual Studio allows you to generate views and API controllers for DevExtreme-based controls.

Scaffold API Controllers

The Scaffolder allows you to create an API controller that uses Entity Framework Core Data Model to access data. The scaffolded API controller contains REST actions that perform CRUD operations on entities from the selected data context.

Follow the instructions below to scaffold a controller:

  1. In Solution Explorer, right-click the Controllers folder. In the invoked menu, hover the pointer over Add and then click Controller... or New Scaffolded Item....

    Add New Scaffolded Item in Context Menu

  2. In the Add Scaffold window, choose DevExtreme API Controller with actions, using Entity Framework and click Add.

    Add Scaffold Window

  3. In the Add Controller window, select the data context and model for which to generate the controller, enter the controller's name, and click Add.

    Add Controller Window

    Note

    If your project does not contain a data context, use the Getting Started with EF Core on ASP.NET Core with an Existing Database walkthrough.

Finally, scaffold a control that works with the controller.

Scaffold Controls

The DevExtreme Scaffolder enables you to scaffold data-bound DevExtreme controls. You can insert them into an existing view or create a new view.

Insert Into an Existing View

Follow the steps below to scaffold a DevExtreme control and insert it into an existing view.

  1. Open the view. Right-click on the position where to insert the DevExtreme control's configuration and select Insert a DevExtreme Control Here in the invoked menu.

    Insert a DevExtreme Control Here on the context menu

  2. In the wizard, follow the steps: choose a DevExtreme control to scaffold, configure data binding and related settings. At the last step, click Add to finish the scaffolding.

    The Insert a DevExtreme Control window

Note

Scaffolding is implemented for major controls. To configure a missing control manually, use the instruction from the Create a Control article.

Create a New View

You can also create a new view with a scaffolded DevExtreme control on it. It is an MVC view or a Razor page, depending on the type of project.

  1. In Solution Explorer, right-click the folder where to place the view. In the invoked menu, move the cursor to Add and then click View.../Razor Page... or New Scaffolded Item....

    Add New Scaffolded Item on the context menu

  2. In the Add Scaffold window, choose MVC View with a DevExtreme Control or Razor Page with a DevExtreme Control and click Add.

    The Add Scaffold window

  3. In the wizard, follow the configuration steps: enter the view's name, choose the DevExtreme control to scaffold, and configure data binding and related settings. At the last step, click Add to finish the scaffolding.

    The Add View window

Finally, reference the view as a partial view or use it as a separate page.

Note

Scaffolding is implemented for major controls. To configure a missing control manually, use the instruction from the Create a Control article.