- 5 minutes to read
XAF features the Solution Wizard, which allows you to create a new application in a few steps. The wizard allows you to:
- Choose the target platform
- Choose data model type (Entity Framework Core, or eXpressPersistent Objects (XPO))
- Set Security System settings
- Select Additional Modules to include in your application.
The wizard generates a solution according to the specified settings.
The Solution Wizard is available when you add a new project.
In the Add a new project dialog, find the DevExpress v22.2 XAF Template Gallery and click Next.
Configure your new project and click Create. The Template Gallery invokes. In the Template Gallery, select a target framework (.NET 6+ or .NET Framework), an XAF solution, and a programming language (C# or VB.NET). Click Run Wizard.
You can also run the Solution Wizard from the DevExpress Template Gallery. To find the wizard, choose XAF in the Platform combo box.
Step 1 – Choose the Target Platforms
In this step, you can select:
- For the .NET Framework solution: Desktop (Windows Forms), Web (ASP.NET Web Forms), or multiple applications at once.
- For the .NET 6+ solution: Desktop (Windows Forms), Web (ASP.NET Core Blazor), or multiple applications at once.
The wizard will add the required platform-specific application and module projects.
Step 2 – Choose the ORM
In this step, you can choose your data model type.
- For the .NET Framework solution: eXpress Persistent Objects (XPO).
- For the .NET 6+ solution: Entity Framework Core or eXpress Persistent Objects (XPO).
The wizard will add code that registers an appropriate Object Space Provider (see XafApplication.ObjectSpaceProvider). If you choose Entity Framework Code First or Entity Framework Core, the wizard will generate the DbContext class code.
Step 3 – Enable the Security System and Choose the Authentication Type
In this step, you can enable the Security System and select the authentication type.
If you selected Windows and eXpress Persistent Objects in the previous steps, you can also choose the client-side security mode or set up the middle-tier security.
If you add an ASP.NET Core Blazor UI project in the first step, the wizard suggests you the following security options:
The wizard will add code that configures the Security System and populates the data model with the entities required to persist Security System data (users, roles and permissions). If you choose Standard authentication, it will also add code that creates the “Admin” user with an empty password to the Updater.cs (Updater.vb) file. If you choose Active Directory authentication, a similar code will be added, but the user name will be taken from your current Windows account.
With the Security System enabled, the wizard also adds the code demonstrated in the How to: Store the Application Model Differences in the Database topic. This code configures the Database Model Difference Storage in both WinForms and ASP.NET Web Forms modules.
Step 4 – Choose Additional Modules
In this last step, you can choose the XAF additional modules to include.
The wizard will register the selected modules and add the entities required by these modules to the data model.
The following image demonstrates the generated solution.
The wizard attempts to detect your installed SQL server and changes the connection string accordingly. Supported servers are Microsoft SQL Server (including the Express and LocalDB editions). To use another database system (PostgreSQL, MySQL, Oracle, SQLite, Firebird, etc.), change the ConnectionString argument in the App.config and Web.config files of the WinForms/ASP.NET Web Forms application projects. Refer to the Connect an XAF Application to a Database Provider topic for details about connecting to different database systems.
Add a Project to an Existing XAF Solution
You can also run the Solution Wizard for an existing solution to create additional XAF projects. Right-click the solution in the Solution Explorer, choose Add | New Project… and select DevExpress v22.2 XAF Template Gallery and click Next. In the Template Gallery, select the newly added project settings and click Run Wizard. The image below shows the Wizard’s start page in this case.
The table below lists the available projects and their descriptions.
WinForms Application Project
Generate an XAF-powered Windows Forms projects for desktop application development (.NET Framework | .NET 6+).
ASP.NET Web Forms Application Project
Generate an XAF-powered ASP.NET Web Forms projects for web application development (.NET Framework).
ASP.NET Core Blazor App
Generate an XAF-powered ASP.NET Core Blazor Server projects for web application development (.NET 6+).
Reusable Module Library
Create a Class Library project to reuse data model, business logic, UI elements, and settings within XAF-powered apps and modules (.NET Framework | NET 6).
Middle Tier App Server
Create a Middle Tier App Server project to secure database access for XAF-powered Windows Forms client apps using the XPO ORM (.NET Framework).
Workflow App Server
Create a Workflow App Server project to start long-running processes as workflows within XAF-powered apps using the Windows Workflow Foundation (.NET Framework).
ASP.NET Core Web API Service
Generate an ASP.NET Core Web API Service project to reuse existing data models and Security System settings (users, roles, and permissions) stored in an XAF application database in the non-XAF .NET application.