Create a Solution using the Wizard
- 4 minutes to read
In this lesson, you will learn how to create a new XAF solution. You will also be able to run the generated WinForms and ASP.NET Web Forms applications, and see the default application state.
From the Visual Studio main menu, select File | New | Project… to invoke the New Project dialog.
Select DevExpress v22.1 XAF Template Gallery for C# or Visual Basic and click Next. Specify the project name (“MySolution”) and click Create.
In the invoked Template Gallery, select XAF Solution Wizard (.NET Framework) in the .NET Framework section and click Run Wizard.
This will invoke the Solution Wizard. In the first screen of the wizard, choose the target platform(s). You can create separate WinForms, ASP.NET Web Forms applications, or multiple applications at once. Choose the WinForms and Web platforms and click Next.
In the next screen, choose eXpress Persistent Objects and click Next.
In the next screen, you can choose the security options of your application. Choose Active Directory as the Authentication type, select Client-Side Security - Integrated Mode as the Database security type, and click Next.
On the next screen, you can choose the required XAF modules, which will automatically be added to your application. Select the Business Class Library Customization module and click Finish.
Most of the other modules will be added manually in the Extra Modules section.
Once the solution has been created, you will see five projects in the Solution Explorer.
- MySolution.Module - the basic module project that contains code common to WinForms and ASP.NET Web Forms applications.
- MySolution.Module.Web - the module project that contains code specific to the ASP.NET Web Forms application.
- MySolution.Module.Win - the module project that contains code specific to the WinForms application.
- MySolution.Web - the ASP.NET Web Forms application project is similar to the WinForms application, but generates a browser-based interface instead of a WinForms interface. Do not use this project for feature implementation. All application logic should be implemented in the appropriate Module projects.
- MySolution.Win - the WinForms application project, which relies on basic and WinForms modules, automatically generates the Windows user interface. Do not use this project for feature implementation. All application logic should be implemented in the appropriate Module projects.
You can refer to the Application Solution Structure topic for additional information on the XAF solution structure.
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.
You can now run the WinForms and ASP.NET Web Forms applications. By default, the WinForms project is set as the startup project. To run the ASP.NET Web Forms application, right-click the MySolution.Web project in the Solution Explorer, and select the Set as StartUp Project item from the context menu. Then, click Start Debugging or press the F5 key.
The following images show the resulting WinForms and ASP.NET Web Forms applications. They will already contain the security options for your Active Directory account.
ASP.NET Web Forms
By default, the wizard enables the Tabbed MDI UI type and the Ribbon Form Style in the WinForms application. Refer to the Choose the WinForms UI Type and Toggle the WinForms Ribbon Interface topics to learn how to change these options.
Next Lesson: Inherit from the Business Class Library Class