Logic Controllers

Controllers is the standard XAF mechanism to develop custom functions. In major projects a very common situation is when a business entity is accompanied by a large number of View Controllers that provide specific functionality. In turn, the use of large number of View Controllers entails a number of problems:

  • When invoking a View for persistent object, the system initializes all instances of the View Controllers;
  • View activated slowly, because it takes significant time to create a large number of View Controllers;
  • When invoking a View, excessive memory consumption occurs, because memory contains a large number of View Controllers.

Logic Controllers allow to avoid the inconvenience associated with a large number of View Controllers. They are an additional layer between the business object and the UI layer, presented in the form View Controller. Logic Controller is defined similarly to the View Controller. Logic Controllers provide many similar methods, properties and events with the same signature. The main difference is that Logic Controllers do not serve as containers for Actions.  


Thus, if the View Controller does not declare Actions, to improve performance it makes sense to convert it into a Logic Controller.

The feature is that all the Logic Controllers use only one View Controller to handle events. This behavior is provided by the Xafari.BC.LogicControllers.LogicControllerService service and a special View Controller. Service registers Logic Controllers and manages their collection. Special View Controller tracks occurring events and routes them to Logic Controllers, associated with the required type.

To learn more about Logic Controllers, refer to the following topics: