expressappframework-118047-app-shell-and-base-infrastructure-application-solution-components-modules-register-buil-in-xaf-module.md
XAF includes a number of ready-to-use built-in modules. This topic describes how to register a built-in module in a new or existing XAF application.
Add* method to register the module.The following code samples register Reports, Dashboards, and Office modules in the application.
public class Startup {
// ...
public void ConfigureServices(IServiceCollection services) {
// ...
services.AddXaf(Configuration, builder => {
// ...
builder.Modules
.AddReports(/*...*/)
.AddDashboards(/*...*/)
.AddOffice(/*...*/)
// ...
});
}
}
public class ApplicationBuilder : IDesignTimeApplicationFactory {
public static WinApplication BuildApplication(string connectionString) {
// ...
builder.Modules
.AddReports(/*...*/)
.AddDashboards(/*...*/)
.AddOffice(/*...*/)
// ...
}
// ...
}
Display the list of module NuGet packages and AddModule methods
You can use the ModuleBase.RequiredModuleTypes property to specify required dependencies for your module. XAF loads these dependent modules with the current module. Follow the steps below to register additional modules in the Module project:
public sealed class _MyApplicationModule : ModuleBase {
//...
public _MyApplicationModule() {
InitializeComponent();
this.RequiredModuleTypes.Add(typeof(DevExpress.ExpressApp.SystemModule.SystemModule));
this.RequiredModuleTypes.Add(typeof(DevExpress.ExpressApp.ReportsV2.ReportsModuleV2));
this.RequiredModuleTypes.Add(typeof(DevExpress.ExpressApp.Dashboards.DashboardsModule));
this.RequiredModuleTypes.Add(typeof(DevExpress.ExpressApp.Office.OfficeModule));
// ...
}
}
Display the list of module types and NuGet packages
You can add modules to your application when you use the Template Kit to create a new XAF solution. Select modules in the Additional Modules section.
See Also
Best practices for creating reusable XAF modules with a View Variants module extension
How to Register DI Services in a Custom Module with Application Builder Extensions