Plug-in MVC Architecture(插件式 MVC 架构 )
Applications built with the XAF consist of multiple functional blocks. The diagram below:
使用XAF构建的应用程序由多个功能块组成。下图:
- Shows the basic blocks.
- 显示基本块。
- Indicates when and how these blocks are created.
- 指示何时以及如何创建这些块。
- Shows you the areas where you can extend your applications.
- 向您展示可以扩展应用程序的区域。
This topic overviews each application building block.
本主题概述每个应用程序构建块。
Storage(存储)
ORM Layer(ORM层)
XAF works with data via an ORM Layer. With ORM, you have no need to create a database, configure tables, relations, and so on: ORM create a database for you.
XAF通过ORM层处理数据。使用ORM,您无需创建数据库、配置表、关系等:ORM为您创建数据库。
XAF supports the following ORMs:
XAF支持以下ORM:
- eXpressPersistent Objects (XPO)
- Entity Framework Core
ORM tools allow you to use familiar code structures (classes, properties, and their attributes) to describe data for your application:
ORM工具允许您使用熟悉的代码结构(类、属性及其属性)来描述应用程序的数据: - To create a data table, declare a class.
- 要创建数据表,请声明一个类。
- Class’ public properties define data fields in the data table.
- 类的公共属性定义数据表中的数据字段。
- The actual data set is a collection of class instances.
- 实际的数据集是类实例的集合。
- To specify relations between tables, decorate classes and properties with specially designed attributes.
- 为指定表之间的关系,使用专门设计的属性来修饰类和属性。
XAF uses the Microsoft SQL Server by default. To change a DBMS used by your application, modify a connection string as described in the following topic: Connect an XAF Application to a Database Provider.
XAF默认使用MicrosoftSQL服务器。要更改应用程序使用的DBMS,请按照以下主题中的说明修改连接字符串:将XAF应用程序连接到数据库提供程序。
Business Class Library(业务类库)
The Business Class Library implements the following:
业务类库实现以下内容:
- Classes that define frequently used entities like Person, Note, Organization, etc. You can review the source code of these classes for information on how to implement your data structures. Most customers implement their own business classes for production use. These built-in classes are mostly used for demo purposes.
- 定义常用实体的类,如人员、注释、组织等。您可以查看这些类的源代码,以获取有关如何实现数据结构的信息。大多数客户实现自己的业务类以供生产使用。这些内置类主要用于演示目的。
- Interfaces that you may need to implement in your data classes. Some sub-systems of the XAF require data to conform to particular rules. For instance, the security sub-system requires the User class to implement the IPermissionPolicyUser interface. If you develop your own class to represent application users, you have to implement this interface.
- 您可能需要在数据类中实现的接口。XAF的一些子系统要求数据符合特定规则。例如,安全子系统需要User类来实现IPermissionPolicyUser接口。如果您开发自己的类来表示应用程序用户,则必须实现此接口。
The image below shows some classes you can find in the Business Class Library.
下图显示了您可以在Business Class Library中找到的一些类。
User Interface (UI)*(用户界面(UI))
WinForms and ASP.NET Web Forms Applications
WinForms和ASP.NETWeb窗体应用程序
XAF separates business logic from the application’s visual representation. XAF can creates the following UIs based on the same business logic:
XAF将业务逻辑与应用程序的可视化表示分开。XAF可以基于相同的业务逻辑创建以下UI:
- A desktop application: a WinForms application (for the .NET Framework or .NET)
- 桌面应用程序:WinForms应用程序(用于. NET Framework或.NET)
- A web application: an ASP.NET Core Blazor application (for .NET solutions) or ASP.NET Web Forms application (for the .NET Framework).
- Web应用程序:ASP.NETCore Blazor应用程序(用于. NET解决方案)或ASP.NETWeb窗体应用程序(用于.NET Framework)。
When you create a new application solution with the XAF, a solution may include a web, desktop, or both projects. For more information about application solution components, refer to the following topic: Application Solution Structure.
使用XAF创建新的应用程序解决方案时,解决方案可能包括Web、桌面或两个项目。有关应用程序解决方案组件的更多信息,请参阅以下主题:应用程序解决方案结构。
Views(视图)
XAF automatically generates CRUD UI based on application data.
XAF根据应用程序数据自动生成CRUD UI。
Example. You have declared an ORM class that describes a person. This is all you need to get an application for storing contact information. You can start the application and it will display a person list using a grid control. You can add new entries or modify existing ones. These operations are performed using the automatically generated set of individual editors; each bound to a particular field.
示例:您已经声明了一个描述一个人的ORM类。这就是您获得一个存储联系信息的应用程序所需要的一切。您可以启动该应用程序,它将使用网格控件显示一个人列表。您可以添加新条目或修改现有条目。这些操作是使用自动生成的单个编辑器集执行的;每个编辑器都绑定到一个特定的字段。
The automatically generated UI elements used to display and manage data are called Views. In XAF, there are three types of Views.
用于显示和管理数据的自动生成的UI元素称为视图。在XAF中,有三种类型的视图。
* List View(列表视图)
List Views are root modules of your application. Usually, these are grids that display collections that you work with (data tables). You see one of them when you start your project, and you can switch between them using the Navigation System.
列表视图是应用程序的根模块。通常,这些是显示您使用的集合(数据表)的网格。当您开始项目时,您会看到其中一个,并且您可以使用导航系统在它们之间切换。
* Detail View(详细视图)
This View type deals with a single object (data record) and presents property values using standalone editors. You see these views when adding a new record or when modifying an existing one.
此视图类型处理单个对象(数据记录)并使用独立编辑器呈现属性值。您在添加新记录或修改现有记录时会看到这些视图。
* Dashboard View(仪表板视图)
This is a View that allows you to display multiple Views side-by-side on a single screen.
这是一个允许您在单个屏幕上并排显示多个视图的视图。
Views are built with the following DevExpress component suites:
视图是使用以下DevExpress组件套件构建的:
- WinForms controls.(WinForms控件)
- ASP.NET Web Forms controls.(ASP.NETWeb窗体控件)
- Blazor components.(Blazor组件)
You can use any control you require to represent a List View or an editor within a Detail View. For information on Views and other elements that form a user interface, review documents from the UI Construction help section.
您可以使用任何控件来表示详细信息视图中的列表视图或编辑器。有关视图和构成用户交互界面的其他元素的信息,请查看UI构建帮助部分中的文档。
See also: UI Customization Categories by Skill Level(另请参阅:按技能级别划分的UI自定义类别)
Additional Modules(附加模块)
You can extend XAF applications functionality with additional modules shipped with the eXpressAppFramework. A module is a ready-to-use feature that can be integrated to your XAF application.
您可以使用eXpressAppFramework附带的其他模块扩展XAF应用程序功能。模块是一种即用型功能,可以集成到您的XAF应用程序中。
You can add the following modules to your XAF app:
您可以将以下模块添加到您的XAF应用程序中:
- Modules shipped with XAF (Security, Reports, Dashboards, Office, Charts, Maps, etc.)(XAF附带的模块(安全、报告、仪表板、办公室、图表、地图等))
- Third-party modules (see XAF Community Extensions).(第三方模块(请参阅XAF社区扩展))
- Your own custom modules.(您自己的自定义模块)
Refer to the following topics for details.
有关详细信息,请参阅以下主题。 - In-Depth Tutorial - Additional Modules(深入教程-附加模块)
Behavior(行为)
Built-in Controllers(内置控制器)
Controllers are objects that manage your application flow. They are also responsible for end-user interaction. Even the simplest applications built with the XAF use a number of built-in Controllers supplied with the System Module and Additional Modules. These default Controllers are mostly responsible for data management. With their help, you can add new records, delete existing ones, perform full text search, etc.
控制器是管理应用程序流的对象。它们还负责最终用户交互。即使是使用XAF构建的最简单的应用程序也使用许多随系统模块和附加模块提供的内置控制器。这些默认控制器主要负责数据管理。在它们的帮助下,您可以添加新记录、删除现有记录、执行全文搜索等。
For the most part, Controllers serve as containers for Actions. Actions are abstractions of end-user interaction elements - buttons, menus, etc. An Action specifies the visual representation of a UI element and its associated code. So, you do not have to deal with low-level implementation details of particular editors, toolbar systems, context menus or anything else. At the same time, this higher-level of abstraction allows the same Action to be used in desktop and web applications.
在大多数情况下,控制器充当操作的容器。操作是最终用户交互元素(按钮、菜单等)的抽象。操作指定UI元素及其相关代码的可视化表示。因此,您不必处理特定编辑器、工具栏系统、上下文菜单或其他任何东西的低级实现细节。同时,这种更高级别的抽象允许在桌面和Web应用程序中使用相同的Action。
For information on implementing your own Controllers and Actions, review the following documents:
有关实现您自己的控制器和操作的信息,请查看以下文档:
- Basic ASP.NET Core Blazor Tutorial | Define Custom Logic and UI Elements(基本ASP.NET核心Blazor教程|定义自定义逻辑和UI元素)
- In-Depth Tutorial (Blazor and WinForms) | Add Actions (Menu Commands) section(深入教程(Blazor和WinForms)|添加操作(菜单命令)部分)
This tutorial section shows you how to extend your application user interface with the help of Controllers. You will create Controllers with different Action types and Controllers without a single Action.
本节向您展示如何借助控制器扩展应用程序用户交互界面。您将创建具有不同操作类型的控制器和没有单个操作的控制器。 - Controllers and Actions(控制器和操作)
This section explains how to use the Controllers-Actions technique in the XAF to extend your applications with new features.
本节介绍如何使用XAF中的Controllers-Actions技术来扩展具有新功能的应用程序。
Application Model(应用模型)
The Application Model stores all the information to build the XAF application UI. For example, this information includes editor classes used for particular data types, or labels associated with particular fields.
应用程序模型存储构建XAF应用程序UI的所有信息。例如,此信息包括用于特定数据类型的编辑器类,或与特定字段关联的标签。
The Application Model is automatically filled with metadata queried from application components - like business objects or Controllers.
应用程序模型自动填充从应用程序组件(如业务对象或控制器)查询的元数据。
The XAF features the Model Editor, which is integrated with Microsoft Visual Studio. You can use the Model Editor to edit the Application Model in both design time and runtime. To run it at design time, double-click a .xafml file from any module or application project located in the Solution Explorer.
XAF具有与Microsoft Visual Studio集成的模型编辑器。您可以使用模型编辑器在设计时和运行时编辑应用程序模型。要在设计时运行它,请双击解决方案资源管理器中任何模块或应用程序项目中的. xafml文件。
Application Model definition files are stored in XML format, you can edit them manually.
应用程序模型定义文件以XML格式存储,您可以手动编辑它们。
For more information about the Application Model, refer to the following topics:
有关应用程序模型的更多信息,请参阅以下主题:
- Basic ASP.NET Core Blazor Tutorial | Define Custom Logic and UI Elements(基本ASP.NET核心Blazor教程|定义自定义逻辑和UI元素)
- The Customize the Application UI and Behavior section in In-Depth Tutorial (Blazor)(深入教程(Blazor)中的自定义应用程序UI和行为部分)
- Lessons in this section of the XAF tutorial demonstrate how you can use the Application Model to change the application user interface. XAF教程本节中的课程演示了如何使用应用程序模型来更改应用程序用户交互界面。
- Application Model(应用模型)
This help section details how the Application Model is loaded, and how you can use it to customize the application user interface.
本帮助部分详细介绍了如何加载应用程序模型,以及如何使用它来自定义应用程序用户交互界面。 - Application Migration to XAF(应用程序迁移到XAF)