Application Controller

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Problem

When you have the page flow logic and screen navigation implemented in views (Web pages), you must change the source code (code-behind) of the views to change the page flow.

Forces

  • You want to centralize the flow of the application and screen navigation so that you can change flow or logic in a single location, with no changes (or minimal changes) to the source code of views.
  • You want to minimize the effort required to update the page flow logic.
  • You want to minimize page flow logic code duplication in views.

Solution

Create a separate object, the application controller, to control and centralize the page flow and screen navigation logic. Write your view code to interact with the application controller to execute page flow and screen navigation logic.

To enable flow between pages, the application controller manages and maintains state across user interactions. It can also interact with the model to perform business actions and define the flow of the application based on the state of the model.

Figure 1 illustrates the logical view of the Application Controller pattern.

Ff709908.1130425b-b075-4eb6-bed1-b2fd032ed0f0(en-us,PandP.10).png

Figure 1

Logical view of the Application Controller pattern

Liabilities

  • There are more solution elements to manage.
  • You need a way to create and connect views and controllers.

Examples

  • For a simple implementation of this pattern, see the ContactsController class in the Model-View-Presenter QuickStart.
  • For a simple implementation of this pattern in the context of a business module, see the CustomersController class in the Modularity QuickStart.

More Information

For more information about how to consume an application controller from presenter classes, see How to: Use a Module Controller from a Presenter.

Show: