商信互联
XAF随附了解决方案向导,它使您可以通过几个简单的步骤快速创建新的应用程序。您需要做的就是选择目标平台,数据模型类型(实体框架代码优先或eXpressPersistent对象(XPO)),安全系统设置以及要包含在应用程序中的其他模块。该向导将根据指定的设置自动生成解决方案。
您可以在DevExpress YouTube频道上找到“解决方案向导”视频教程:DevExpress XAF:解决方案向导。
该解决方案向导可使用文件| 新增| Visual Studio主菜单中的Project ...命令,并使用Add | 解决方案资源管理器中的“新建项目...”上下文菜单命令。在C#模板位于Visual C#中| DevExpress XAF类别。VB.NET鈥在Visual Basic中| DevExpress XAF类别。
在此步骤中,您可以一次选择Windows,Web,Mobile(维护模式)或多个应用程序。
该向导将添加所需的特定于平台的应用程序和模块项目。
在此步骤中,您可以选择数据模型类型-实体框架代码优先或eXpress持久对象(XPO)。
该向导将添加用于注册适当的对象空间提供程序的代码(请参见XafApplication.ObjectSpaceProvider)。如果选择Entity Framework Code First,则向导将生成DbContext类代码。
您也可以使用CTRL click选择EF和XPO(实体框架代码优先,再加上eXpress持久对象)。在这种情况下,向导将生成与“如何:在单个应用程序中同时使用实体框架和XPO”示例中的解决方案类似的解决方案。
在此步骤中,您可以启用安全系统,选择身份验证类型和默认权限策略。
If you selected eXpress Persistent Objects in the previous step, you can also choose the client-side security mode or set up the middle-tier security.
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 modules.
In this last step, you can choose the XAF extra 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 application projects. Refer to the Connect an XAF Application to a Database Provider topic for details about connecting to different database systems.
您也可以为现有解决方案运行解决方案向导,以创建其他XAF项目。用鼠标右键单击在解决方案资源管理器中,选择添加| 新建项目...,然后选择DevExpress v 19.2 XAF解决方案向导。在这种情况下,下图显示了向导的起始页。
下表列出了可用的项目及其描述。
模板名称 | 描述 | 也可以看看 |
---|---|---|
WinForm应用程序项目 | 用于创建桌面应用程序的XAF项目。 | |
ASP.NET应用程序项目 | 用于创建Web应用程序的XAF项目。 | |
模块项目 | 用于创建自定义XAF模块的类库项目。 | |
应用服务器项目 | 一个为XAF应用程序创建中间层服务器的项目。 | |
工作流服务器项目 | 一个项目,用于为启用了工作流程的XAF应用程序创建工作流程服务器。 |