Browse Source

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.
pull/25021/head
SALİH ÖZKARA 1 month ago
parent
commit
06eaf708eb
  1. 2
      docs/en/docs-nav.json
  2. 4
      docs/en/low-code/fluent-api.md
  3. 2
      docs/en/low-code/foreign-access.md
  4. 22
      docs/en/low-code/index.md
  5. 28
      docs/en/low-code/interceptors.md
  6. 2
      docs/en/low-code/model-json.md
  7. 2
      docs/en/low-code/reference-entities.md

2
docs/en/docs-nav.json

@ -1998,7 +1998,7 @@
"isIndex": true
},
{
"text": "Fluent API & Attributes",
"text": "Attributes & Fluent API",
"path": "low-code/fluent-api.md"
},
{

4
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.

2
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)

22
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)

28
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:

2
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)

2
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)

Loading…
Cancel
Save