Create a Solution
- 3 minutes to read
This lesson guides you through the XAF Solution Wizard. In the Wizard, you will complete the following steps:
- Add two projects to the solution: ASP.NET Core Blazor and Windows Forms.
- Select an ORM tool to use for data management.
- Turn on user authentication.
- Review available built-in modules and enable the Validation module.
This lesson also describes how to use migrations to update your database schema after you change the application’s data model or how to force your application to work with an in-memory database (during the development/debugging phase).
At the end of this lesson, you can run the application for the first time.
Step-by-Step Instructions
From Visual Studio’s main menu, select File | New | Project… to invoke the Create a new project dialog.
Select DevExpress v24.1 XAF Template Gallery and click Next.
Specify the project’s name (MySolution) and click Create.
In the invoked Template Gallery window, switch to the .NET section. Select XAF Solution Wizard (.NET) and click Run Wizard.
On the first page of the Solution Wizard, you can select target platforms. Select two options - Desktop (Windows Forms) and Web (ASP.NET Core Blazor). Click Next.
Choose the Entity Framework Core ORM library.
Tip
For additional information on how to choose an ORM that suits your needs, refer to the following topic: Why We Recommend EF Core over XPO for New Development.
In the next window, you can enable XAF’s functional testing and multitenancy capabilities. Do not select anything and continue to the next step since these options are not required for this tutorial.
In this window you can specify an authentication type for your application. In this tutorial, we implement user authentication at a later stage. Do not choose anything and click Next.
Select the ready-to-use XAF modules you want to add to your application. This tutorial requires the Validation module. Click Finish.
Solution Structure
The solution contains the following projects:
- MySolution.Module
- A module project that contains platform-independent code. Use this project to define the business logic that applies to all target platforms.
- MySolution.Blazor.Server
- An ASP.NET Core Blazor application that generates a user interface based on the business logic you define in MySolution.Module.
- MySolution.Win
- A WinForms application that generates a user interface based on the business logic you define in MySolution.Module.
Refer to the Application Solution Structure topic for information on the XAF solution structure.
Database Connection
When you create a new application, the application wizard attempts to find an installed Microsoft SQL Server instance (LocalDB or Express) and sets the connection string accordingly. You can also connect to a different database system as described in the following topic: Connect an XAF Application to a Database Provider.
First Run
You can now run the application. Click Start Debugging or press F5.
The ASP.NET Core Blazor project is set as the startup project. To run the Windows Forms application, right-click the MySolution.Win project in the Solution Explorer and select the Set as Startup Project item from the context menu.
The following images show the resulting ASP.NET Core Blazor and Windows Forms applications.
- ASP.NET Core Blazor
- Windows Forms