The Modules
Each module must provide
A set of module views that can be used either to display data from a single module instance or data taken from all instances that are included in the global instance
A main module view that is used to display all the data from a particular instance or all data from all instances that are included in the global instance
A module business service class that derives from ModuleBase and provides the required members (see "The ModuleBase Class") and any other methods that are required by the presentation code of the module
The module might also need other code to work properly. Some things that might be required are
A display item control that displays a single item (for example, a news story); this control can be accessed through default.aspx but is used only if the module writer chooses to use it
An edit item page that enables the member to edit an item (or enter the details of a new item)
One or more persistent object classes to store the data for the module
The ModuleBase Class
The business service class for each module derives from the ModuleBase class. The core business service class also derives from this class.
ModuleBase exists to provide some standard features that all the business service classes require and also to define some features each class is required to provide.
The class provides one property, ModuleInstance, which contains the ModuleInstance persistent object for the module instance on which the business service class instance has been created to operate. This ModuleInstance is provided when the instance of the business service class is created. If no ModuleInstance is provided, the instance of the business service class will operate on the global instance (and thus all globally exposed data in the module).
ModuleBase also provides the IsGlobal property so that code can determine whether an instance of a business service class is currently operating on the global instance. This is typically used by the business service class code itself to decide which data to expose.
ModuleBase includes three members without implementations, which must be implemented by each business service class that derives from it:
NameA property that returns the name of the module to which the business service class belongs.
PrepareForDeletionA method that is called when a particular instance of the module is about to be deleted. This method should be used to clean up any remaining data. For example, the ImageGallery module uses this method to delete the image files that belong to it.
GetSearchResults(String)A method that is called to get search results from a module instance. This method is covered later in this chapter in the "Search" section.