In a Nutshell

Lattis uses a configuration file to load all necessary resources into memory. This file should be created by the framework users and must be called Application.config. It also needs to be placed at the application's root directory. Although it's possible to specify other resources in Application.config, the actions might the most important one.

Actions are described in terms of user defined classes that must inherit from Lattis.Control.Action or Lattis.Control.LookupAction. Lattis.Control.Action class provides a method that should be overridden by the user defined subclasses to determine the desired behaviour. This method must return an instance of a Lattis.Control.ActionForward, a data structure that contains the necessary information about the destiny of the request. Usually, there are more than one Lattis.Control.ActionForward mapped for each requested Lattis.Control.Action. Lattis.Control.LookupAction works in a similar way to Lattis.Control.Action (actually, it extends it), however it will use reflection and a query string key to determine which method of the user defined subclass should be invoked. The user implemented methods must also return a Lattis.Control.ActionForward instance. Here's a simple configuration file example.


This file describes that when a request identified by the path ActionDoMyStuff.aspx hits the Web server, the application's FrontController will delegate - the details about how it happens don't matter at this moment - it to the user defined class MyApplication.Actions.ActionDoMyStuff. In this case, this class inherits from Lattis.Control.Action and override it's Execute() method - this is the method actually called by the framework. Inside the Execute() method of MyApplication.Actions.ActionDoMyStuff class, the user shoud write the necessary code to accomplish all business needs, what could be accessing the application's façades, data access objects, persistence mechanisms or any other legacy systems or data structures.

After the business job is done, the Execute() method should return a Lattis.Control.ActionForward instance. The Lattis.Control.ActionForward options are identified by the Forward-Config tags in Application.config file and can be located by their names. For instance, if the Execute() method of MyApplication.Actions.ActionDoMyStuff returns a Lattis.Control.ActionForward identified by the name Success, the request will be forwared to page SuccessPage.aspx. Additionally, if a System.Exception is raised during the execution of method Execute() the request will automatically be forwarded to page MyExceptionPage.aspx.