Adding Scaffolder Items

To add Scaffolded items by using the AB Suite MVC Scaffolder, perform the following:

  1. In the Solution Explorer window, right-click Views, point to Add, and then select New Scaffolded Items... from the context menu.

    The Add Scaffolder dialog box appears.

  2. In the Templates pane, select AB Suite Custom Scaffolder. This is a custom Scaffolder for AB Suite applications. It updates your MVC application with artifacts, such as Views and Controllers, based on the DataModel definitions generated from your Client Framework application.

  3. Click Add.

    The Agile Business Suite Custom MVC Scaffolder dialog box appears.

  4. From the Select an assembly list, select the required DataModels assembly.

  5. In Generate MVC Views from Client Framework DataModels group, select either of the following:

    • Select Generate all Views?, to generate MVC Razor Views for all the DataModels in the selected assembly. If you want to generate a single View, you must select the required DataModel from the Select a DataModel list.

    • Select Generate as Partial View?, to generate partial Views for aggregated classes. For example, in the AB Suite Sample system, you can create a partial View for the Action_Line class. The other Views would include the partial View as required.

    • Select Separate Sign Controls?, to generate separate sign fields for the signed numbers. If you do not select this field, the control added on the View displays the number along with the sign.

    • Select Overwrite existing View?, if you want to overwrite a previously generated View.

      Note: You must not select the Overwrite existing Views? field, if you want to retain any design changes that you made to a previously generated View.

    • Select Use Layout Page?, to use a layout page that can be applied to all the Views.

      • Select Default, if you want to use a default layout page.

      • Select Custom, if you want to use a custom layout page.

    • From the Select a DataModel list, select a DataModel that is generated for an ispec in the DataModels assembly. This generates a View for the selected DataModel. This option is disabled if you select Generate all Views?.

    • In the Presentation Metadata Location box, enter the path or browse to the location of the Presentation Metadata.

      The Presentation Metadata contains a set of XML files that are generated when an existing AB Suite model is converted to an AB Suite User Experience mode model. The XML files contain presentation information of the forms in an AB Suite application. This information can be used by the Scaffolder to create appropriate control types in the Scaffolded Razor Views.

      If you are not using a converted AB Suite User Experience mode model, leave this field empty.

  6. Select Add Web API Support to add Web API support. This generates the required Controllers that expose RESTful services for application transactions. You can make HTTP requests to the website from the browser application to send and receive data to and from the AB Suite system. This option would typically be used for the development of Single Page Applications (SPAs) and other HTTP clients that perform operations by using Ajax requests.

  7. Select Use Authentication, if you have created an application that requires authentication. This option adds the "Authorize" attribute on the generated Controllers. If the request for a Controller action is not authorized based on the authentication mechanism applied to the website, the request is denied.

  8. Click Add.

When the AB Suite Custom Scaffolder runs, it generates or updates the following files in the MVC application.

These Controllers be extended to include custom API methods as required.

You can now run the application by performing the following:

  1. Right-click the project and select Build from the context menu.

  2. Right-click the project and select Set as StartUp Project.

  3. Right-click the project, point to Debug, and then select Start New Instance.

    The default ASP.NET page that is generated by the MVC application appears.

  4. Access the Views by specifying the Controller name followed by the View name in the URL.

    For example, http://localhost:8080/<ControllerName>/<ViewName>

Note: The MVC client tries to match the host context and displays the corresponding View. For example, if the fireup ispec is sent to the client, the View that is displayed initially is for the fireup ispec.

You can now interact with the application by entering data into the controls in the View and submitting the form. When a form is submitted the corresponding View appears as a response from the host application.