From 85bed4ebfc2d01cbef10d86fedbac38ab80c7728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SAL=C4=B0H=20=C3=96ZKARA?= Date: Tue, 24 Feb 2026 10:36:58 +0300 Subject: [PATCH] Docs: rename Fluent API & add interceptors example Rename documentation headings and links from "Fluent API & Attributes" to "Attributes & Fluent API" across the low-code docs and navigation for consistency. Add a Fluent API example for registering interceptors (with sample C#) and a reference link in interceptors.md. Fix a typo changing "DefaultsLayer" to "DefaultLayer" and add a license notice and minor formatting fixes in the low-code index. --- docs/en/docs-nav.json | 2 +- docs/en/low-code/fluent-api.md | 4 ++-- docs/en/low-code/foreign-access.md | 2 +- docs/en/low-code/index.md | 22 +++++++++++--------- docs/en/low-code/interceptors.md | 28 ++++++++++++++++++++++++++ docs/en/low-code/model-json.md | 2 +- docs/en/low-code/reference-entities.md | 2 +- 7 files changed, 46 insertions(+), 16 deletions(-) diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index ee3d0eae76..04d394c7c0 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -1990,7 +1990,7 @@ "isIndex": true }, { - "text": "Fluent API & Attributes", + "text": "Attributes & Fluent API", "path": "low-code/fluent-api.md" }, { diff --git a/docs/en/low-code/fluent-api.md b/docs/en/low-code/fluent-api.md index 501fc77bac..f42c47833d 100644 --- a/docs/en/low-code/fluent-api.md +++ b/docs/en/low-code/fluent-api.md @@ -5,7 +5,7 @@ } ``` -# Fluent API & Attributes +# Attributes & Fluent API C# Attributes and the Fluent API are the **recommended way** to define dynamic entities. They provide compile-time checking, IntelliSense, refactoring support, and keep your entity definitions close to your domain code. @@ -74,7 +74,7 @@ The Low-Code System uses a layered configuration model. From lowest to highest p 2. **JSON Layer** — `model.json` file (see [model.json Structure](model-json.md)) 3. **Fluent Layer** — `AbpDynamicEntityConfig.EntityConfigurations` -A `DefaultsLayer` runs last to fill in any missing values with conventions. +A `DefaultLayer` runs last to fill in any missing values with conventions. > When the same entity or property is configured in multiple layers, the higher-priority layer wins. diff --git a/docs/en/low-code/foreign-access.md b/docs/en/low-code/foreign-access.md index 34503772f3..f7545dad05 100644 --- a/docs/en/low-code/foreign-access.md +++ b/docs/en/low-code/foreign-access.md @@ -145,4 +145,4 @@ The `DynamicEntityAppService` checks these relations when building entity action * [model.json Structure](model-json.md) * [Reference Entities](reference-entities.md) -* [Fluent API & Attributes](fluent-api.md) +* [Attributes & Fluent API](fluent-api.md) diff --git a/docs/en/low-code/index.md b/docs/en/low-code/index.md index a21dcf677d..dd8b7298ec 100644 --- a/docs/en/low-code/index.md +++ b/docs/en/low-code/index.md @@ -7,6 +7,8 @@ # Low-Code System +> You must have an ABP Team or a higher license to use this module. + The ABP Low-Code System allows you to define entities using C# attributes or Fluent API and automatically generates: * **Database tables** (via EF Core migrations) @@ -23,13 +25,13 @@ No need to write DTOs, application services, repositories, or UI pages manually. Traditionally, adding a new entity with full CRUD functionality to an ABP application requires: -1. Entity class in Domain -2. DbContext configuration in EF Core -3. DTOs in Application.Contracts -4. AppService in Application -5. Controller in HttpApi -6. Razor/Blazor pages in UI -7. Permissions, menu items, localization +* Entity class in Domain +* DbContext configuration in EF Core +* DTOs in Application.Contracts +* AppService in Application +* Controller in HttpApi +* Razor/Blazor pages in UI +* Permissions, menu items, localization **With Low-Code, a single C# class replaces all of the above:** @@ -214,7 +216,7 @@ public class OrderLine : DynamicEntityBase } ```` -See [Fluent API & Attributes](fluent-api.md) for the full attribute reference. +See [Attributes & Fluent API](fluent-api.md) for the full attribute reference. ### model.json (Declarative) @@ -244,7 +246,7 @@ See [model.json Structure](model-json.md) for the full specification. | Feature | Description | Documentation | |---------|-------------|---------------| -| **Attributes & Fluent API** | Define dynamic entities with C# attributes and configure programmatically | [Fluent API & Attributes](fluent-api.md) | +| **Attributes & Fluent API** | Define dynamic entities with C# attributes and configure programmatically | [Attributes & Fluent API](fluent-api.md) | | **model.json** | Declarative dynamic entity definitions in JSON | [model.json Structure](model-json.md) | | **Reference Entities** | Read-only access to existing C# entities (e.g., `IdentityUser`) for foreign key lookups | [Reference Entities](reference-entities.md) | | **Interceptors** | Pre/Post hooks for Create, Update, Delete with JavaScript | [Interceptors](interceptors.md) | @@ -358,6 +360,6 @@ Custom commands and queries are automatically discovered and registered at start ## See Also -* [Fluent API & Attributes](fluent-api.md) +* [Attributes & Fluent API](fluent-api.md) * [model.json Structure](model-json.md) * [Scripting API](scripting-api.md) diff --git a/docs/en/low-code/interceptors.md b/docs/en/low-code/interceptors.md index bfdb5db11e..f789ecaac8 100644 --- a/docs/en/low-code/interceptors.md +++ b/docs/en/low-code/interceptors.md @@ -47,6 +47,34 @@ public class Organization The `Name` parameter must be one of: `"Create"`, `"Update"`, or `"Delete"`. The `InterceptorType` can be `Pre`, `Post`, or `Replace`. When `Replace` is used, the default database operation is completely skipped and only your JavaScript handler executes. Multiple interceptors can be added to the same class (`AllowMultiple = true`). +## Defining Interceptors with Fluent API + +Use the `Interceptors` list on an `EntityDescriptor` to add interceptors programmatically in your [Low-Code Initializer](index.md#1-create-a-low-code-initializer): + +````csharp +AbpDynamicEntityConfig.EntityConfigurations.Configure( + "MyApp.Organizations.Organization", + entity => + { + entity.Interceptors.Add(new CommandInterceptorDescriptor + { + CommandName = "Create", + Type = InterceptorType.Pre, + Javascript = "if(!context.commandArgs.data['Name']) { globalError = 'Name is required!'; }" + }); + + entity.Interceptors.Add(new CommandInterceptorDescriptor + { + CommandName = "Delete", + Type = InterceptorType.Post, + Javascript = "context.log('Deleted: ' + context.commandArgs.entityId);" + }); + } +); +```` + +See [Attributes & Fluent API](fluent-api.md#adding-interceptors) for more details on Fluent API configuration. + ## Defining Interceptors in model.json Add interceptors to the `interceptors` array of an entity: diff --git a/docs/en/low-code/model-json.md b/docs/en/low-code/model-json.md index a3ae4fbf74..2f58876a29 100644 --- a/docs/en/low-code/model-json.md +++ b/docs/en/low-code/model-json.md @@ -416,7 +416,7 @@ When you modify `model.json`, you need database migrations for the changes to ta ## See Also -* [Fluent API & Attributes](fluent-api.md) +* [Attributes & Fluent API](fluent-api.md) * [Interceptors](interceptors.md) * [Custom Endpoints](custom-endpoints.md) * [Scripting API](scripting-api.md) diff --git a/docs/en/low-code/reference-entities.md b/docs/en/low-code/reference-entities.md index 85f13395a1..b937175c7a 100644 --- a/docs/en/low-code/reference-entities.md +++ b/docs/en/low-code/reference-entities.md @@ -144,4 +144,4 @@ if (user) { * [model.json Structure](model-json.md) * [Foreign Access](foreign-access.md) -* [Fluent API & Attributes](fluent-api.md) +* [Attributes & Fluent API](fluent-api.md)