xaf

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

XAF (eXpressApp Framework) — Skill Index

XAF (eXpressApp Framework) — 技能索引

DevExpress XAF is a cross-platform .NET application framework for building business applications (Blazor Server and WinForms). It provides MVVM architecture, ORM integration (EF Core and XPO), security, validation, and rich module ecosystem.
Versions covered: v24.2 and v25.1 Platforms: Blazor Server, WinForms, Web API (OData) Official docs: https://docs.devexpress.com/eXpressAppFramework/112670/expressapp-framework DevExpress MCP: https://api.devexpress.com/mcp/docs

DevExpress XAF是一款用于构建业务应用(Blazor Server和WinForms)的跨平台.NET应用框架。它提供MVVM架构、ORM集成(EF Core和XPO)、安全、验证以及丰富的模块生态系统。
覆盖版本: v24.2和v25.1 支持平台: Blazor Server、WinForms、Web API (OData) 官方文档: https://docs.devexpress.com/eXpressAppFramework/112670/expressapp-framework DevExpress MCP: https://api.devexpress.com/mcp/docs

Sub-Skills — When to Use Each

子技能 — 适用场景

Data Modeling

数据建模

SkillLoad When
xaf-xpo-models
Defining XPO persistent objects (XPObject, BaseObject, associations, PersistentAlias)
xaf-ef-models
Defining EF Core entities (BaseObject EF, virtual properties, DbContext, migrations)
xaf-nonpersistent
Creating NonPersistent objects for custom data sources, API wrappers, input dialogs
技能加载时机
xaf-xpo-models
定义XPO持久化对象(XPObject、BaseObject、关联关系、PersistentAlias)时
xaf-ef-models
定义EF Core实体(BaseObject EF、虚拟属性、DbContext、迁移)时
xaf-nonpersistent
为自定义数据源、API封装、输入对话框创建非持久化对象时

UI Construction

UI构建

SkillLoad When
xaf-controllers
Creating controllers, SimpleAction/PopupWindowShowAction/SingleChoiceAction/ParametrizedAction
xaf-editors
Working with built-in property editors, list editors, GridListEditor customization
xaf-custom-editors
Building custom property editors (Blazor/WinForms) or custom list editors
xaf-conditional-appearance
Conditionally hiding/disabling/coloring UI elements via [Appearance] attribute
技能加载时机
xaf-controllers
创建控制器、SimpleAction/PopupWindowShowAction/SingleChoiceAction/ParametrizedAction时
xaf-editors
使用内置属性编辑器、列表编辑器、GridListEditor自定义时
xaf-custom-editors
构建自定义属性编辑器(Blazor/WinForms)或自定义列表编辑器时
xaf-conditional-appearance
通过[Appearance]属性条件隐藏/禁用/着色UI元素时

Platform-Specific

平台专属功能

SkillLoad When
xaf-blazor-ui
Blazor-specific UI, thread safety (InvokeAsync), Razor components in XAF, JS interop
xaf-winforms-ui
WinForms-specific UI, XtraGrid access, background workers, layout, splash
技能加载时机
xaf-blazor-ui
处理Blazor专属UI、线程安全(InvokeAsync)、XAF中使用Razor组件、JS互操作时
xaf-winforms-ui
处理WinForms专属UI、XtraGrid访问、后台工作器、布局、启动页时

Security & Multi-Tenancy

安全与多租户

SkillLoad When
xaf-security
Roles, permissions, authentication (Standard/AD/OAuth2), programmatic permission checks
xaf-multi-tenant
Multi-tenant SaaS apps with separate DB per tenant (v24.2+)
技能加载时机
xaf-security
配置角色、权限、身份认证(标准/AD/OAuth2)、编程式权限检查时
xaf-multi-tenant
开发按租户隔离数据库的多租户SaaS应用(v24.2+)时

Services & API

服务与API

SkillLoad When
xaf-web-api
Building/consuming XAF OData Web API (JWT, custom endpoints, $filter/$expand)
xaf-validation
Validation rules (RuleRequiredField, RuleCriteria, custom rules, programmatic validation)
技能加载时机
xaf-web-api
构建/调用XAF OData Web API(JWT、自定义端点、$filter/$expand)时
xaf-validation
配置验证规则(RuleRequiredField、RuleCriteria、自定义规则、编程式验证)时

Modules & Features

模块与功能

SkillLoad When
xaf-reports
XtraReports integration (setup, predefined reports, export, designer, parameters)
xaf-dashboards
Dashboard analytics (setup, data sources, designer, permissions)
xaf-office
File attachments, Spreadsheet editor, RichText editor, PDF viewer
技能加载时机
xaf-reports
集成XtraReports(配置、预定义报表、导出、设计器、参数)时
xaf-dashboards
实现仪表盘分析(配置、数据源、设计器、权限)时
xaf-office
处理文件附件、电子表格编辑器、富文本编辑器、PDF查看器时

Deployment

部署

SkillLoad When
xaf-deployment
IIS/Azure/Docker for Blazor, ClickOnce/MSI for WinForms, migrations, license, logging
技能加载时机
xaf-deployment
为Blazor部署IIS/Azure/Docker、为WinForms部署ClickOnce/MSI、处理迁移、许可证、日志时

Diagnostics & Quality

诊断与质量

SkillLoad When
xaf-memory-leaks
Diagnosing memory leaks, auditing event handler cleanup, reviewing ObjectSpace/CollectionSource lifetime

技能加载时机
xaf-memory-leaks
诊断内存泄漏、审计事件处理器清理、检查ObjectSpace/CollectionSource生命周期时

Quick Architecture Reference

快速架构参考

MySolution/
├── MySolution.Module/          ← platform-agnostic (business objects, controllers, modules)
│   ├── BusinessObjects/
│   ├── Controllers/
│   └── MySolutionModule.cs
├── MySolution.Blazor.Server/   ← Blazor-specific (Program.cs, BlazorApplication.cs)
│   └── DatabaseUpdate/Updater.cs
├── MySolution.Win/             ← WinForms-specific (Program.cs, WinApplication.cs)
└── MySolution.WebApi/          ← Web API service (Program.cs, OData endpoints)

MySolution/
├── MySolution.Module/          ← 平台无关(业务对象、控制器、模块)
│   ├── BusinessObjects/
│   ├── Controllers/
│   └── MySolutionModule.cs
├── MySolution.Blazor.Server/   ← Blazor专属(Program.cs、BlazorApplication.cs)
│   └── DatabaseUpdate/Updater.cs
├── MySolution.Win/             ← WinForms专属(Program.cs、WinApplication.cs)
└── MySolution.WebApi/          ← Web API服务(Program.cs、OData端点)

Key Concepts

核心概念

  • ObjectSpace (
    IObjectSpace
    ) — unit of work; wraps EF Core DbContext or XPO Session. Not thread-safe. Never store in singleton services.
  • XafApplication — application lifecycle, module registration, ObjectSpace creation.
  • ModuleBase — platform-agnostic module; registers business objects, controllers, navigation items.
  • Application Model — XML/in-memory model describing Views, Actions, Navigation — customizable without recompilation.
  • DatabaseUpdater — runs on startup to apply schema changes and seed data (
    Updater.cs
    ).

  • ObjectSpace (
    IObjectSpace
    ) — 工作单元;封装EF Core DbContext或XPO Session。非线程安全。切勿存储在单例服务中。
  • XafApplication — 应用生命周期管理、模块注册、ObjectSpace创建。
  • ModuleBase — 平台无关模块;注册业务对象、控制器、导航项。
  • Application Model — 描述视图、动作、导航的XML/内存模型,无需重新编译即可自定义。
  • DatabaseUpdater — 应用启动时运行,用于应用 schema 变更和初始化数据(
    Updater.cs
    )。

Common Pitfalls (Quick Reference)

常见陷阱(快速参考)

PitfallFix
ObjectSpace
in singleton service
Use
IObjectSpaceFactory
+
using var os = factory.CreateObjectSpace(...)
async/await
+
ConfigureAwait(false)
in Blazor
Remove
ConfigureAwait(false)
— Blazor needs sync context
Non-virtual EF Core propertiesAll EF Core entity properties must be
virtual
XPO property without
SetPropertyValue
Use backing field +
SetPropertyValue
for change tracking
AddDbContext
instead of
AddDbContextFactory
XAF requires
IDbContextFactory<T>
NonPersistent provider registered firstRegister
.AddNonPersistent()
after persistent providers

陷阱修复方案
在单例服务中使用
ObjectSpace
使用
IObjectSpaceFactory
+
using var os = factory.CreateObjectSpace(...)
在Blazor中使用
async/await
+
ConfigureAwait(false)
移除
ConfigureAwait(false)
— Blazor需要同步上下文
EF Core属性非虚拟所有EF Core实体属性必须声明为
virtual
XPO属性未使用
SetPropertyValue
使用 backing field +
SetPropertyValue
实现变更跟踪
使用
AddDbContext
而非
AddDbContextFactory
XAF需要
IDbContextFactory<T>
非持久化提供器优先注册持久化提供器注册完成后调用
.AddNonPersistent()

Useful Links

有用链接