Module Designer (.NET Framework)
- 4 minutes to read
The Module Designer allows you to view and customize module components: referenced modules, Controllers, and business classes. You can also apply most module customizations in the Application Designer or directly in code.
Note
In .NET 6 applications, the Module Designer is not available because of the changes in Visual Studio’s designer architecture. You can perform related tasks in code:
To invoke the Module Designer, double-click the Module.cs (Module.vb) file in a module project or right-click this file and select View Designer in the context menu.
The Module Designer consists of the following sections:
Module
Use this section to specify the module’s name and description. Click the module icon twice to set the modules name. The Application Designer displays this property value when you select this module in the Modules section. You can also use the Description property in the Properties window to specify this module’s description.
Required Modules
Modules provide an XAF application’s functionality. Each module represents a feature (for example, data validation, reporting, etc.). XAF supplies the following built-in modules:
Basic Modules
Features that are required in every custom module.
-
Additional features that can be added to any module or application project.
The Required Modules section provides a list of modules included in the module project and allows you to do the following:
View the Modules Your Module Uses
All the modules from the Required Modules section are loaded when you invoke the Model Editor for the application project or run the application.
Add an XAF Module
For this purpose, drag a module from the Toolbox‘s DX.24.1: XAF Modules page onto the Required Modules section.
After this, a module’s type (not instance) is added to the ModuleBase.RequiredModuleTypes collection. In this case, some module settings (for example, ReportsModuleV2.ReportDataType) are not available in the Module Designer. To access these settings, use the Application Designer.
You can also add a module in code or in the Application Designer as described in the Ways to Register a Module topic.
Add a Custom Module
A custom module you implement in an XAF solution is automatically added to the Toolbox. To add this module, drag it from the Toolbox‘s corresponding page onto the Required Modules section.
Remove a Module
Right-click the module and select Delete in the invoked context menu.
Controllers
The Controllers section allows you to view Controllers of the application’s module and the modules listed in the Required Modules section. You can also view each Controller’s Actions (represented by child nodes).
All the Controllers listed in this section are created in the corresponding application.
Exported Types
The Exported Types section allows you to specify the business classes the Application Model should load. The application’s business model is based on these classes.
This section lists the following business classes:
- Classes implemented in the current module.
- Classes implemented in the assemblies referenced in the current module.
- Classes implemented in the modules added to the current module’s Required Modules list.
Application Model loads only the classes marked in bold. To mark a class, use one of the following approaches:
- Select a class and press the SPACEBAR.
- Right-click a class and select the Use Type in Application item in the invoked context menu.
Press the SPACEBAR again or use the context menu to unmark a business class.
The Model Editor‘s BOModel | <Class> node provides information about classes in the Application Model. You can also view or edit the information on business classes’ Views in the Views node.
Note
- When you add a class, all the related classes are added as well.
- The classes from the modules listed in the Required Modules section are always marked in bold. You cannot cancel adding them to the Application Model.
Use the ModuleBase.AdditionalExportedTypes collection in a module constructor if you want to add business classes to the Application Model in code.
Important Note
Rebuild your solution after your changes in the Model Designer. Otherwise, you cannot view them in the Model Editor.