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 applications, and see the default application state.
在本节课中,您将学习如何创建一个新的XAF解决方案。您还可以运行生成的WinForms和ASP.NET Web应用程序,并查看默认的应用程序状态。
- In the main menu of Visual Studio, select File | New | Project... to invoke the New Project dialog.
-
In the Installed | Templates tree, expand the desired language (Visual C# or Other Languages | Visual Basic), and then choose DevExpress XAF. In the panel to the right, select DevExpress v19.2 XAF Solution Wizard, specify the new solution's name ("MySolution") and click OK.
- 在Visual Studio的主菜单中,选择文件| New | Project…以调用新项目对话框。
- 在已安装的|模板树中,展开所需的语言(Visual c#或其他语言| Visual Basic),然后选择DevExpress XAF。在右侧的面板中,选择DevExpress v19.2 XAF解决方案向导,指定新解决方案的名称(“MySolution”),然后单击OK。
-
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, Mobile (maintenance mode) applications, or multiple applications at once. Choose the WinForms and ASP.NET platforms and click Next.
-
这将调用解决方案向导。在向导的第一个屏幕中,选择目标平台。您可以创建单独的WinForms, ASP。NET、移动(维护模式)应用程序或多个应用程序同时使用。选择WinForms和ASP.NET平台,然后单击Next。
-
In the next screen, choose Entity Framework Code Fist or eXpress Persistent Objects, and click Next.
-
在下一个屏幕中,选择Entity Framework Code first或eXpress Persistent Objects,然后单击next。
Note
You can use the Entity Framework (EF)
or eXpress Persistent Objects (XPO) as your project's object-relational mapping (ORM)
请注意
您可以使用实体框架(EF)
或者将持久对象(XPO)表示为项目的对象-关系映射(ORM)
-
tool. In this tutorial, only the EF Code First and XPO approaches are considered. Note that EF is not supported by two extra modules: Audit Trail and Clone Object. If you are going to use these modules, choose XPO. Otherwise, either ORM can be used.
-
In the next screen, you can choose the security options of your application. Choose Active Directory as the Authentication type, Allow/Deny as Default Permission Policy (and select Client-Side Security - Integrated Mode as the Database security type if you chose the XPO ORM in the previous step) and click Next.
-
工具。在本教程中,只考虑EF代码优先和XPO方法。请注意,EF不支持两个额外的模块:审计跟踪和克隆对象。如果要使用这些模块,请选择XPO。否则,可以使用任一ORM。
-
在下一个屏幕中,您可以选择应用程序的安全选项。选择Active Directory作为身份验证类型,将Allow/Deny作为默认的权限策略(如果在上一步中选择了XPO ORM,则选择客户端Security - Integrated Mode作为数据库安全类型),然后单击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.
-
在下一个屏幕上,您可以选择所需的XAF模块,这些模块将自动添加到您的应用程序中。选择Business Class库自定义模块并单击Finish。
Note
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 applications.
- MySolution.Module.Web - the module project that contains code specific to the ASP.NET Web application.
- MySolution.Module.Win - the module project that contains code specific to the WinForms application.
- MySolution.Web - the ASP.NET 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.
- MySolution。模块-包含WinForms和ASP通用代码的基本模块项目。净的Web应用程序。
- MySolution.Module.Web -包含特定于ASP的代码的模块项目。净的Web应用程序。
- MySolution.Module.Win -包含特定于WinForms应用程序的代码的模块项目。
- MySolution.Web - ASP.NET应用程序项目与WinForms应用程序类似,但生成的是基于浏览器的接口,而不是WinForms接口。不要将此项目用于功能实现。所有应用程序逻辑都应该在适当的模块项目中实现。
- MySolution。WinForms应用程序项目,它依赖于基本和WinForms模块,自动生成Windows用户界面。不要将此项目用于功能实现。所有应用程序逻辑都应该在适当的模块项目中实现。
Tutorial_BMD_Lesson1_2
You can refer to the Application Solution Structure topic for additional information on the XAF solution structure.
有关XAF解决方案结构的更多信息,可以参考应用程序解决方案结构主题。
Note
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 application projects. Refer to the Connect an XAF Application to a Database Provider topic for details about connecting to different database systems.
请注意
向导尝试检测安装的SQL server并相应地更改连接字符串。受支持的服务器是Microsoft SQL Server(包括Express和LocalDB版本)。要使用另一个数据库系统(PostgreSQL、MySQL、Oracle、SQLite、Firebird等),请更改App.config和Web中的ConnectionString参数。配置文件的WinForms/ASP。网络应用程序项目。有关连接不同数据库系统的详细信息,请参阅将XAF应用程序连接到数据库提供者主题。
You can now run the WinForms and ASP.NET applications. By default, the WinForms project is set as the startup project. To run the ASP.NET Web 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.
现在可以运行WinForms和ASP。网络应用程序。默认情况下,WinForms项目被设置为启动项目。来运行ASP。NET Web应用程序,右键单击MySolution。在“解决方案资源管理器”中,并从上下文菜单中选择“设置为启动项目”项。然后,单击Start Debugging或按F5键。
The following images show the resulting WinForms and ASP.NET applications. They will already contain the security options for your Active Directory account.
WinForms
下面的图像显示了生成的WinForms和ASP。网络应用程序。它们将已经包含您的Active Directory帐户的安全选项。
WinForms
ASP.NET
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.
默认情况下,向导在WinForms应用程序中启用选项卡MDI UI类型和Ribbon表单样式。请参考“选择WinForms UI类型”和“切换WinForms Ribbon界面主题”,以了解如何更改这些选项。