Browse Source

Merge branch 'dev' into feat/#23891

pull/24547/head
erdemcaygor 8 months ago
parent
commit
fc34eac64c
  1. 6
      Directory.Packages.props
  2. 1
      README.md
  3. 8
      docs/en/Community-Articles/2025-11-15-Announcing-SSR-Support/article.md
  4. 60
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/POST.md
  5. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/1.png
  6. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/2.png
  7. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/21.png
  8. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/3.png
  9. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/4.png
  10. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/41.png
  11. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/42.png
  12. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/5.png
  13. BIN
      docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/cover.png
  14. BIN
      docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/cover.png
  15. 145
      docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/architecture-diagram.svg
  16. 82
      docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/automatic-caching-flow.svg
  17. 141
      docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-invalidation-flow.svg
  18. 135
      docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-scoping-diagram.svg
  19. 797
      docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/post.md
  20. 1
      docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/summary.md
  21. 14
      docs/en/cli/index.md
  22. 2
      docs/en/contribution/angular-ui.md
  23. 6
      docs/en/docs-nav.json
  24. 9
      docs/en/framework/infrastructure/artificial-intelligence/index.md
  25. 38
      docs/en/framework/ui/angular/component-replacement.md
  26. 2
      docs/en/framework/ui/angular/data-table-column-extensions.md
  27. 2
      docs/en/framework/ui/angular/dynamic-form-extensions.md
  28. 2
      docs/en/framework/ui/angular/entity-action-extensions.md
  29. 19
      docs/en/framework/ui/angular/form-validation.md
  30. 4
      docs/en/framework/ui/angular/http-requests.md
  31. 24
      docs/en/framework/ui/angular/lazy-load-service.md
  32. 2
      docs/en/framework/ui/angular/list-service.md
  33. 4
      docs/en/framework/ui/angular/localization.md
  34. 2
      docs/en/framework/ui/angular/page-toolbar-extensions.md
  35. 91
      docs/en/framework/ui/angular/permission-management-component-replacement.md
  36. 8
      docs/en/framework/ui/angular/pwa-configuration.md
  37. 22
      docs/en/framework/ui/angular/quick-start.md
  38. 2
      docs/en/framework/ui/angular/router-events.md
  39. 10
      docs/en/framework/ui/angular/service-proxies.md
  40. 280
      docs/en/framework/ui/angular/ssr-configuration.md
  41. 2
      docs/en/framework/ui/angular/subscription-service.md
  42. 2
      docs/en/framework/ui/angular/testing.md
  43. 8
      docs/en/framework/ui/angular/theming.md
  44. 38
      docs/en/framework/ui/angular/track-by-service.md
  45. 2
      docs/en/get-started/empty-aspnet-core-application.md
  46. 11
      docs/en/get-started/layered-web-application.md
  47. 4
      docs/en/get-started/microservice.md
  48. 8
      docs/en/get-started/single-layer-web-application.md
  49. BIN
      docs/en/images/elsa-studio-wasm.png
  50. 98
      docs/en/modules/ai-management/index.md
  51. 85
      docs/en/modules/elsa-pro.md
  52. 3
      docs/en/modules/identity-pro.md
  53. 0
      docs/en/modules/identity/ldap.md
  54. 2
      docs/en/release-info/migration-guides/abp-5-0-angular.md
  55. 2
      docs/en/samples/easy-crm.md
  56. 2
      docs/en/samples/microservice-demo.md
  57. 2
      docs/en/solution-templates/layered-web-application/web-applications.md
  58. 2
      docs/en/suite/editing-templates.md
  59. 2
      docs/en/suite/generating-crud-page.md
  60. 2
      docs/en/suite/solution-structure.md
  61. 4
      docs/en/tutorials/book-store/part-03.md
  62. 2
      docs/en/tutorials/todo/layered/index.md
  63. 2
      docs/en/tutorials/todo/single-layer/index.md
  64. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo/Abp/AspNetCore/Mvc/NewtonsoftJson/AbpAspNetCoreMvcNewtonsoftModule.cs
  65. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs
  66. 16
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
  67. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/ObjectExtending/MvcUiObjectExtensionPropertyInfoExtensions.cs
  68. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  69. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs
  70. 5
      framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs
  71. 2
      framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor
  72. 10
      framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs
  73. 40
      framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/SelectExtensionProperty.razor.cs
  74. 22
      framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionOptionsExtensions.cs
  75. 34
      framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpUnnamedOptionsManager.cs
  76. 6
      framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpSqliteOptions.cs
  77. 39
      framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/Interceptors/SqliteBusyTimeoutSaveChangesInterceptor.cs
  78. 22
      framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/Sqlite/AbpEntityFrameworkCoreSqliteModule.cs
  79. 51
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContextOptions.cs
  80. 30
      framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs
  81. 2
      framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs
  82. 2
      framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs
  83. 18
      framework/src/Volo.Abp.Kafka/Volo/Abp/Kafka/ProducerPool.cs
  84. 5
      framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ExtensionPropertyUiFormConfiguration.cs
  85. 4
      framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs
  86. 18
      framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ObjectExtensionPropertyInfo.cs
  87. 39
      framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs
  88. 20
      framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs
  89. 18
      framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs
  90. 1
      framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreTestModule.cs
  91. 4
      framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestModule.cs
  92. 2
      framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/AbpMemoryDbTestModule.cs
  93. 18
      latest-versions.json
  94. 5
      modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.abppkg.analyze.json
  95. 2
      modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor
  96. 6
      modules/account/src/Volo.Abp.Account.Blazor/Volo.Abp.Account.Blazor.abppkg.analyze.json
  97. 5
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml
  98. 6
      modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.abppkg.analyze.json
  99. 5
      modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingEntityFrameworkCoreTestModule.cs
  100. 2
      modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs

6
Directory.Packages.props

@ -7,7 +7,7 @@
<PackageVersion Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="4.0.0" />
<PackageVersion Include="aliyun-net-sdk-sts" Version="3.1.3" />
<PackageVersion Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
<PackageVersion Include="AsyncKeyedLock" Version="7.1.6" />
<PackageVersion Include="AsyncKeyedLock" Version="7.1.8" />
<PackageVersion Include="Autofac" Version="8.4.0" />
<PackageVersion Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageVersion Include="Autofac.Extras.DynamicProxy" Version="7.1.0" />
@ -168,7 +168,7 @@
<PackageVersion Include="Slugify.Core" Version="5.1.1" />
<PackageVersion Include="Spectre.Console" Version="0.51.1" />
<PackageVersion Include="StackExchange.Redis" Version="2.9.17" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="9.0.4" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.0.1" />
<PackageVersion Include="System.Collections.Immutable" Version="10.0.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Linq.Dynamic.Core" Version="1.6.7" />
@ -196,4 +196,4 @@
<PackageVersion Include="Fody" Version="6.9.3" />
<PackageVersion Include="System.Management" Version="10.0.0" />
</ItemGroup>
</Project>
</Project>

1
README.md

@ -14,6 +14,7 @@
- [Quick Start](https://abp.io/docs/latest/tutorials/todo) is a single-part, quick-start tutorial to build a simple application with the ABP Framework. Start with this tutorial if you want to understand how ABP works quickly.
- [Web Application Development Tutorial](https://abp.io/docs/latest/tutorials/book-store) is a complete tutorial on developing a full-stack web application with all aspects of a real-life solution.
- [Modular Monolith Application](https://abp.io/docs/latest/tutorials/modular-crm/index): A multi-part tutorial that demonstrates how to create application modules, compose and communicate them to build a monolith modular web application.
- [Microservice Tutorial](https://abp.io/docs/latest/tutorials/microservice/index): A multi-part guide that walks you through building a microservice solution with ABP, from creating independent services and enabling inter-service communication to exposing them through an API Gateway and generating CRUD pages with ABP Suite.
## What ABP Provides?

8
docs/en/Community-Articles/2025-11-15-Announcing-SSR-Support/article.md

@ -29,14 +29,14 @@ Server-Side Rendering refers to an approach which renders your Angular applicati
You can easily add SSR support to your existing ABP Angular application using the Angular CLI with ABP schematics:
> Adds SSR configuration to your project
```bash
# Generate SSR configuration for your project
ng generate @abp/ng.schematics:ssr-add
# Alternatively, you can use the short form
```
> Short form
```bash
ng g @abp/ng.schematics:ssr-add
```
If you have multiple projects in your workspace, you can specify which project to add SSR to:
```bash

60
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/POST.md

@ -0,0 +1,60 @@
# .NET Conf China 2025: Changing the World, Changing Ourselves - See You Again in Shanghai
![](./images/1.png)
.NET Conf China 2025 is an annual community event for developers, celebrating the release of .NET 10 (LTS) and the achievements of the past year in China. As an extension of .NET Conf 2025, this event brings together local tech communities, well-known companies, and open-source organizations. It has become the largest .NET online and offline conference in China, dedicated to spreading .NET technology in Chinese and fostering collaboration and exchange.
## Event Highlights: Key Topics and Takeaways
This year’s conference focused on three main themes: performance improvements, AI integration, and cross-platform development. Topics covered how to achieve performance gains while maintaining engineering quality, balancing between multi-platform consistency and native capabilities, and taking generative AI from “demo-level” to “production-ready.” On the community and ecosystem side, the event showcased the .NET Foundation’s and domestic and international companies’ progress in supporting architectures like ARM, LoongArch, and RISC-V. It also highlighted best practices in DevOps, observability, and engineering toolchains, creating a complete path from ideas to implementation.
### Opening Keynote
Scott Hanselman kicked off .NET Conf China 2025 with a video keynote, announcing that .NET 10 is now available on the official website. He framed the release around four pillars—AI, cloud-native, cross-platform, and performance—including integration with the Microsoft Agent Framework for building and orchestrating multi-agent systems in .NET/C#, industry-leading container and Kubernetes support with .NET Aspire simplifying local containerized development, a richer cross-platform desktop ecosystem (.NET MAUI, Avalonia, Uno Platform), and major performance gains such as Native AOT and single-file publishing for faster startup and easier distribution across platforms.
He underscored China’s importance as .NET’s second-largest market, with roughly 13% of users, and noted that generative AI usage in China has doubled in 2025. The local community is seeing strong momentum around ML.NET, .NET Aspire, and the C# Dev Kit in VS Code. Reflecting on his Baby Smash game written 20 years ago, which now runs cross-platform on .NET 10, he called on developers to modernize: move existing Web, WinForms, and WPF apps to the cloud, improve performance, ship as a single executable, and weave in AI capabilities.
On AI, he emphasized a human-centered stance: AI and agents should augment, not replace, developers. In the future, developers will orchestrate and govern agents, and human judgment will matter more than ever. He closed by thanking the open-source community for its many proposals and pull requests, stressing that .NET is an open-source platform built together by Microsoft and the community, and wishing everyone an inspiring conference and a joyful journey with .NET 10.
![2](./images/2.png)
### Roundtable Discussion
The roundtable discussion, titled “Empowering with AI, Breaking Through Cross-Platform Barriers, and Ecosystem Innovation,” focused on practical implementation. It explored typical paths for large models and intelligent agents in enterprises, key considerations for choosing cross-platform UI frameworks, and the evolution of these frameworks. Panelists discussed questions like: How can AI capabilities be integrated into existing business processes instead of creating an “experimental” pipeline? How should cross-platform solutions be evaluated in terms of performance, ecosystem, and team skillsets? What are the unique opportunities for domestic ecosystems in the global tech landscape? And how can community collaboration help developers quickly adopt best practices? A shared consensus emerged: in the short term, focus on running scenarios; in the long term, return to engineering fundamentals. Both toolchains and methodologies are equally important.
![](./images/21.png)
### In-Depth Sessions
The afternoon featured four breakout sessions, covering a wide range of topics with deep dives into both foundational technologies and real-world project reviews:
- **Frontend and Cross-Platform:** Focused on the progress of Avalonia, Blazor, and WebAssembly, as well as the integrated experience of .NET Aspire in multi-service applications. Speakers shared insights on reusing core logic between desktop and web, shortening cold start times with incremental compilation and resource trimming, and performance profiling and optimization in WASM scenarios.
- **AI Agents and Enterprise Adoption:** Discussed multi-agent orchestration, the MCP plugin ecosystem, and enterprise data compliance. From common pitfalls of “demo-level” AI to the “five-step method” for moving from POC to production, the session covered use cases like knowledge retrieval, process automation, intelligent customer service, and developer assistants, emphasizing evaluation metrics, prompt engineering, and monitoring governance.
- **.NET Practices and Engineering:** Focused on the latest capabilities and performance practices of EF Core, the boundaries of NativeAOT, automated testing strategies, and observability implementation. Discussions included database migration strategies, caching and concurrency control for hot paths, end-to-end tracing, and structured logging.
- **Solutions and Case Studies:** From Clean Architecture/DDD to AI-powered business evolution, topics included application modernization, SaaS transformation, and edge-cloud collaboration in AIoT. Speakers broke down modular governance, team collaboration, and release strategies for complex systems, putting “delivering value continuously” at the center stage.
![](./images/3.png)
## ABP Booth Highlights: Showcases, Conversations, and Fun
The story of ABP began with a promise to create a better starting point. From the frustration of “copy-pasting boilerplate code,” we crafted a modular, opinionated framework. We chose open source and community collaboration. We founded Volosoft to turn our vision into reality with professional tools. Today, tens of thousands of developers explore the ABP framework, and thousands of teams rely on the ABP platform to deliver production-grade .NET applications faster and more securely.
![](./images/4.png)
At .NET Conf China 2025, we brought our “developer platform built for developers” to every visitor. Our booth demonstrations started with “a production-ready skeleton from the start”: modular layered architecture, built-in authentication and authorization systems, multi-tenancy support, audit logging, and localization—all out of the box. On the frontend and backend, ABP offers diverse options like MVC, Blazor, and Angular, enabling teams to quickly implement solutions on familiar stacks while maintaining flexibility for future evolution. We also showcased how ABP integrates with containerization, CI/CD, and observability, emphasizing “engineering built into the framework, not reinvented by every team.”
![](./images/42.png)
**Interaction and Prizes:** Sharing technology should also be warm and engaging. We hosted a QR code raffle at the booth, with prizes including ABP stickers, the book *Mastering ABP Framework*, and Bluetooth headphones. Multiple rounds of raffles and group photos made the interactions more memorable. Many developers shared their ABP experiences and plans for improvement right at the booth, and a few impromptu “code walkthroughs” naturally happened. The love and joy for technology were captured in every handshake and discussion.
![](./images/41.png)
## Looking Ahead: Building the Ecosystem Together
From an open-source journey to a complete development platform for the future, we’ve always believed that developers deserve a better starting point. Around performance, intelligence, and cross-platform capabilities, we will continue investing in engineering, ecosystem collaboration, and best practice sharing. We also welcome more partners to contribute through documentation and examples, share your experiences, and submit your ideas. Together, let’s make “useful infrastructure” more stable, efficient, and business-friendly.
We look forward to exchanging ideas, sharing practices, and building the ecosystem together at the next gathering. Technology meets creativity, and the possibilities are endless. We’re on the road and waiting for you at the next event.
See you next year at .NET Conf China 2026!
![](./images/5.png)

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 KiB

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/21.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/41.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/42.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 KiB

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 KiB

BIN
docs/en/Community-Articles/2025-11-30-NET-Conf-China-2025/images/cover.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/cover.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

145
docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/architecture-diagram.svg

@ -0,0 +1,145 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 700">
<defs>
<style>
.box { fill: #f8f9fa; stroke: #1890ff; stroke-width: 2; }
.highlight-box { fill: #e6f7ff; stroke: #1890ff; stroke-width: 3; }
.service-box { fill: #fff7e6; stroke: #fa8c16; stroke-width: 2; }
.cache-box { fill: #f0f5ff; stroke: #597ef7; stroke-width: 2; }
.event-box { fill: #f6ffed; stroke: #52c41a; stroke-width: 2; }
.text { font-family: Arial, sans-serif; font-size: 14px; fill: #333; }
.title { font-family: Arial, sans-serif; font-size: 18px; fill: #1890ff; font-weight: bold; }
.section-title { font-family: Arial, sans-serif; font-size: 14px; fill: #1890ff; font-weight: bold; }
.small-text { font-family: Arial, sans-serif; font-size: 11px; fill: #666; }
.arrow { stroke: #666; stroke-width: 2; fill: none; marker-end: url(#arrowhead); }
.dashed { stroke-dasharray: 5, 5; }
</style>
<marker id="arrowhead" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#666" />
</marker>
</defs>
<!-- Title -->
<text class="title" x="500" y="35" text-anchor="middle">AutoCache Architecture</text>
<!-- Application Layer -->
<rect class="service-box" x="50" y="80" width="250" height="140" rx="5" />
<text class="section-title" x="175" y="105" text-anchor="middle">Application Service</text>
<rect class="box" x="70" y="120" width="210" height="40" rx="3" />
<text class="text" x="175" y="143" text-anchor="middle">BookAppService</text>
<text class="small-text" x="85" y="180" fill="#fa8c16">[Cache(typeof(Book))]</text>
<text class="small-text" x="85" y="195" fill="#666">public Task&lt;BookDto&gt; GetAsync()</text>
<!-- Interceptor Layer -->
<rect class="highlight-box" x="400" y="80" width="250" height="140" rx="5" />
<text class="section-title" x="525" y="105" text-anchor="middle">Cache Interceptor</text>
<rect class="box" x="420" y="120" width="210" height="40" rx="3" />
<text class="text" x="525" y="143" text-anchor="middle">AutoCacheInterceptor</text>
<text class="small-text" x="430" y="180">• Detect [Cache] attribute</text>
<text class="small-text" x="430" y="195">• Intercept method calls</text>
<!-- Cache Manager -->
<rect class="cache-box" x="750" y="80" width="200" height="140" rx="5" />
<text class="section-title" x="850" y="105" text-anchor="middle">Cache Manager</text>
<rect class="box" x="770" y="120" width="160" height="40" rx="3" />
<text class="text" x="850" y="143" text-anchor="middle">AutoCacheManager</text>
<text class="small-text" x="775" y="180">• Generate cache keys</text>
<text class="small-text" x="775" y="195">• Store/Retrieve data</text>
<!-- Arrows between layers -->
<path class="arrow" d="M 300 150 L 400 150" />
<path class="arrow" d="M 650 150 L 750 150" />
<!-- Distributed Cache -->
<rect class="cache-box" x="750" y="270" width="200" height="100" rx="5" />
<text class="section-title" x="850" y="295" text-anchor="middle">Distributed Cache</text>
<rect class="box" x="770" y="310" width="160" height="40" rx="3" />
<text class="text" x="850" y="333" text-anchor="middle">Redis / Memory</text>
<!-- Arrow to cache -->
<path class="arrow" d="M 850 220 L 850 270" />
<text class="small-text" x="860" y="250">Get/Set</text>
<!-- Entity Domain -->
<rect class="service-box" x="50" y="270" width="250" height="100" rx="5" />
<text class="section-title" x="175" y="295" text-anchor="middle">Domain Layer</text>
<rect class="box" x="70" y="310" width="210" height="40" rx="3" />
<text class="text" x="175" y="333" text-anchor="middle">Book Entity</text>
<!-- Event Bus -->
<rect class="event-box" x="400" y="270" width="250" height="100" rx="5" />
<text class="section-title" x="525" y="295" text-anchor="middle">Event Bus</text>
<rect class="box" x="420" y="310" width="210" height="40" rx="3" />
<text class="text" x="525" y="333" text-anchor="middle">EntityChangedEvent</text>
<!-- Invalidation Handler -->
<rect class="event-box" x="750" y="420" width="200" height="100" rx="5" />
<text class="section-title" x="850" y="445" text-anchor="middle">Invalidation Handler</text>
<rect class="box" x="770" y="460" width="160" height="40" rx="3" />
<text class="text" x="850" y="483" text-anchor="middle">Clear Related Caches</text>
<!-- Key Manager -->
<rect class="cache-box" x="400" y="420" width="250" height="100" rx="5" />
<text class="section-title" x="525" y="445" text-anchor="middle">Cache Key Manager</text>
<rect class="box" x="420" y="460" width="210" height="40" rx="3" />
<text class="text" x="525" y="483" text-anchor="middle">IAutoCacheKeyManager</text>
<!-- Event flow arrows -->
<path class="arrow" d="M 175 370 L 175 400 L 525 400 L 525 370" />
<text class="small-text" x="280" y="395">Publish</text>
<path class="arrow" d="M 525 370 L 525 420" />
<text class="small-text" x="535" y="400">Handle</text>
<path class="arrow" d="M 650 470 L 750 470" />
<text class="small-text" x="675" y="465">Invalidate</text>
<path class="arrow" d="M 850 420 L 850 370" />
<text class="small-text" x="860" y="400">Remove keys</text>
<!-- Scope information -->
<rect class="box" x="50" y="420" width="250" height="100" rx="5" />
<text class="section-title" x="175" y="445" text-anchor="middle">Cache Scopes</text>
<text class="small-text" x="65" y="470">• Global - Shared by all users</text>
<text class="small-text" x="65" y="487">• CurrentUser - Per user ID</text>
<text class="small-text" x="65" y="504">• AuthenticatedUser - Auth status</text>
<!-- Flow labels -->
<text class="small-text" x="50" y="570" fill="#1890ff" font-weight="bold">① Method Call</text>
<text class="small-text" x="50" y="590" fill="#666">Application service method is called</text>
<text class="small-text" x="270" y="570" fill="#1890ff" font-weight="bold">② Intercept</text>
<text class="small-text" x="270" y="590" fill="#666">Interceptor detects [Cache] attribute</text>
<text class="small-text" x="490" y="570" fill="#1890ff" font-weight="bold">③ Check Cache</text>
<text class="small-text" x="490" y="590" fill="#666">Manager checks distributed cache</text>
<text class="small-text" x="710" y="570" fill="#1890ff" font-weight="bold">④ Invalidate</text>
<text class="small-text" x="710" y="590" fill="#666">Entity changes clear related caches</text>
<!-- Legend -->
<line x1="50" y1="640" x2="950" y2="640" stroke="#ddd" stroke-width="1" />
<rect x="50" y="655" width="20" height="15" class="service-box" />
<text class="small-text" x="75" y="667">Application Layer</text>
<rect x="250" y="655" width="20" height="15" class="highlight-box" />
<text class="small-text" x="275" y="667">Cache Components</text>
<rect x="450" y="655" width="20" height="15" class="cache-box" />
<text class="small-text" x="475" y="667">Storage Layer</text>
<rect x="650" y="655" width="20" height="15" class="event-box" />
<text class="small-text" x="675" y="667">Event Handling</text>
</svg>

After

Width:  |  Height:  |  Size: 7.0 KiB

82
docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/automatic-caching-flow.svg

@ -0,0 +1,82 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 400">
<defs>
<style>
.box { fill: #f8f9fa; stroke: #1890ff; stroke-width: 2; }
.highlight-box { fill: #e6f7ff; stroke: #1890ff; stroke-width: 2; }
.cache-box { fill: #f0f5ff; stroke: #597ef7; stroke-width: 2; }
.text { font-family: Arial, sans-serif; font-size: 14px; fill: #333; }
.title { font-family: Arial, sans-serif; font-size: 16px; fill: #1890ff; font-weight: bold; }
.small-text { font-family: Arial, sans-serif; font-size: 12px; fill: #666; }
.arrow { stroke: #666; stroke-width: 2; fill: none; marker-end: url(#arrowhead); }
.cache-arrow { stroke: #52c41a; stroke-width: 2; fill: none; marker-end: url(#arrowhead-green); }
.miss-arrow { stroke: #ff4d4f; stroke-width: 2; fill: none; marker-end: url(#arrowhead-red); }
</style>
<marker id="arrowhead" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#666" />
</marker>
<marker id="arrowhead-green" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#52c41a" />
</marker>
<marker id="arrowhead-red" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#ff4d4f" />
</marker>
</defs>
<!-- Title -->
<text class="title" x="450" y="30" text-anchor="middle">Automatic Caching Flow</text>
<!-- Client Call -->
<rect class="box" x="50" y="80" width="180" height="80" rx="5" />
<text class="text" x="140" y="115" text-anchor="middle">Client Call</text>
<text class="small-text" x="140" y="135" text-anchor="middle">GetAsync(bookId)</text>
<!-- Interceptor -->
<rect class="highlight-box" x="320" y="80" width="180" height="80" rx="5" />
<text class="text" x="410" y="110" text-anchor="middle">AutoCache</text>
<text class="text" x="410" y="130" text-anchor="middle">Interceptor</text>
<text class="small-text" x="410" y="145" text-anchor="middle">[Cache] detected</text>
<!-- Cache Check Diamond -->
<polygon class="cache-box" points="670,70 770,120 670,170 570,120" stroke="#1890ff" stroke-width="2" fill="#e6f7ff"/>
<text class="text" x="670" y="120" text-anchor="middle">Cache</text>
<text class="text" x="670" y="137" text-anchor="middle">Hit?</text>
<!-- Arrows -->
<path class="arrow" d="M 230 120 L 320 120" />
<path class="arrow" d="M 500 120 L 570 120" />
<!-- Cache Hit Path -->
<path class="cache-arrow" d="M 770 120 L 820 120 L 820 250 L 140 250 L 140 160" />
<text class="small-text" x="800" y="200" fill="#52c41a" font-weight="bold">✓ HIT</text>
<text class="small-text" x="780" y="265" fill="#52c41a">Return cached result (Fast!)</text>
<!-- Cache Miss Path -->
<path class="miss-arrow" d="M 670 170 L 670 240" />
<text class="small-text" x="685" y="210" fill="#ff4d4f" font-weight="bold">✗ MISS</text>
<!-- Execute Method -->
<rect class="box" x="580" y="260" width="180" height="80" rx="5" />
<text class="text" x="670" y="290" text-anchor="middle">Execute</text>
<text class="text" x="670" y="310" text-anchor="middle">Actual Method</text>
<text class="small-text" x="670" y="325" text-anchor="middle">Query Database</text>
<!-- Store in Cache -->
<rect class="cache-box" x="320" y="260" width="180" height="80" rx="5" />
<text class="text" x="410" y="290" text-anchor="middle">Store Result</text>
<text class="text" x="410" y="310" text-anchor="middle">in Cache</text>
<text class="small-text" x="410" y="325" text-anchor="middle">For future use</text>
<!-- Return to Client -->
<text class="small-text" x="270" y="285" text-anchor="middle">Return result</text>
<!-- Miss path arrows -->
<path class="arrow" d="M 580 300 L 500 300" />
<path class="arrow" d="M 320 300 L 230 300 L 230 120" />
<!-- Legend -->
<rect x="50" y="360" width="15" height="15" fill="#52c41a" opacity="0.3" />
<text class="small-text" x="70" y="372">Cache Hit (5-10ms)</text>
<rect x="250" y="360" width="15" height="15" fill="#ff4d4f" opacity="0.3" />
<text class="small-text" x="270" y="372">Cache Miss (100-500ms)</text>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

141
docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-invalidation-flow.svg

@ -0,0 +1,141 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 600">
<defs>
<style>
.box { fill: #f8f9fa; stroke: #1890ff; stroke-width: 2; }
.db-box { fill: #fff7e6; stroke: #fa8c16; stroke-width: 2; }
.cache-box { fill: #f0f5ff; stroke: #597ef7; stroke-width: 2; }
.event-box { fill: #f6ffed; stroke: #52c41a; stroke-width: 2; }
.invalidate-box { fill: #fff1f0; stroke: #ff4d4f; stroke-width: 2; }
.text { font-family: Arial, sans-serif; font-size: 14px; fill: #333; }
.title { font-family: Arial, sans-serif; font-size: 18px; fill: #1890ff; font-weight: bold; }
.section-title { font-family: Arial, sans-serif; font-size: 14px; fill: #1890ff; font-weight: bold; }
.small-text { font-family: Arial, sans-serif; font-size: 11px; fill: #666; }
.arrow { stroke: #666; stroke-width: 2; fill: none; marker-end: url(#arrowhead); }
.event-arrow { stroke: #52c41a; stroke-width: 2; fill: none; marker-end: url(#arrowhead-green); }
.invalidate-arrow { stroke: #ff4d4f; stroke-width: 3; fill: none; marker-end: url(#arrowhead-red); }
.step-number { fill: #1890ff; font-family: Arial, sans-serif; font-size: 16px; font-weight: bold; }
</style>
<marker id="arrowhead" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#666" />
</marker>
<marker id="arrowhead-green" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#52c41a" />
</marker>
<marker id="arrowhead-red" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#ff4d4f" />
</marker>
</defs>
<!-- Title -->
<text class="title" x="500" y="35" text-anchor="middle">Cache Invalidation Workflow</text>
<!-- Step 1: User Action -->
<circle cx="100" cy="100" r="20" fill="#1890ff" />
<text class="step-number" x="100" y="107" text-anchor="middle" fill="white">1</text>
<rect class="box" x="150" y="70" width="180" height="60" rx="5" />
<text class="text" x="240" y="95" text-anchor="middle">User Action</text>
<text class="small-text" x="240" y="115" text-anchor="middle">UpdateAsync(bookId)</text>
<!-- Step 2: Database Update -->
<circle cx="100" cy="220" r="20" fill="#1890ff" />
<text class="step-number" x="100" y="227" text-anchor="middle" fill="white">2</text>
<rect class="db-box" x="150" y="190" width="180" height="60" rx="5" />
<text class="text" x="240" y="215" text-anchor="middle">Update Database</text>
<text class="small-text" x="240" y="235" text-anchor="middle">Repository.UpdateAsync()</text>
<!-- Step 3: Publish Event -->
<circle cx="100" cy="340" r="20" fill="#1890ff" />
<text class="step-number" x="100" y="347" text-anchor="middle" fill="white">3</text>
<rect class="event-box" x="150" y="310" width="180" height="60" rx="5" />
<text class="text" x="240" y="335" text-anchor="middle">Publish Event</text>
<text class="small-text" x="240" y="355" text-anchor="middle">EntityChangedEvent</text>
<!-- Arrows for steps 1-3 -->
<path class="arrow" d="M 240 130 L 240 190" />
<path class="arrow" d="M 240 250 L 240 310" />
<!-- Step 4: Event Handler -->
<circle cx="500" cy="340" r="20" fill="#1890ff" />
<text class="step-number" x="500" y="347" text-anchor="middle" fill="white">4</text>
<rect class="event-box" x="550" y="310" width="200" height="60" rx="5" />
<text class="text" x="650" y="330" text-anchor="middle">Invalidation</text>
<text class="text" x="650" y="348" text-anchor="middle">Handler</text>
<text class="small-text" x="650" y="363" text-anchor="middle">Listen for changes</text>
<!-- Arrow to handler -->
<path class="event-arrow" d="M 330 340 L 550 340" />
<text class="small-text" x="400" y="330" fill="#52c41a">Event Bus</text>
<!-- Step 5: UnitOfWork Check -->
<circle cx="500" cy="460" r="20" fill="#1890ff" />
<text class="step-number" x="500" y="467" text-anchor="middle" fill="white">5</text>
<rect class="box" x="550" y="430" width="200" height="60" rx="5" />
<text class="text" x="650" y="455" text-anchor="middle">Wait for UoW</text>
<text class="small-text" x="650" y="475" text-anchor="middle">OnCompleted() callback</text>
<!-- Arrow to UoW -->
<path class="arrow" d="M 650 370 L 650 430" />
<!-- Step 6: Clear Cache -->
<circle cx="850" cy="340" r="20" fill="#1890ff" />
<text class="step-number" x="850" y="347" text-anchor="middle" fill="white">6</text>
<rect class="invalidate-box" x="790" y="310" width="160" height="120" rx="5" />
<text class="text" x="870" y="335" text-anchor="middle">Clear Cache</text>
<!-- Cache entries being cleared -->
<line x1="805" y1="355" x2="935" y2="355" stroke="#ff4d4f" stroke-width="1" opacity="0.3"/>
<text class="small-text" x="815" y="375" fill="#ff4d4f">✗ GetAsync(id)</text>
<text class="small-text" x="815" y="392" fill="#ff4d4f">✗ GetListAsync()</text>
<text class="small-text" x="815" y="409" fill="#ff4d4f">✗ Related queries</text>
<!-- Arrow to clear cache -->
<path class="invalidate-arrow" d="M 750 460 L 870 460 L 870 430" />
<text class="small-text" x="785" y="452" fill="#ff4d4f" font-weight="bold">INVALIDATE</text>
<!-- Cache Storage Visualization -->
<rect class="cache-box" x="50" y="500" width="900" height="80" rx="5" />
<text class="section-title" x="500" y="525" text-anchor="middle">Redis / Distributed Cache</text>
<!-- Before invalidation -->
<text class="small-text" x="70" y="550" font-weight="bold">Before:</text>
<rect x="130" y="540" width="120" height="25" fill="#52c41a" opacity="0.3" rx="2" stroke="#52c41a"/>
<text class="small-text" x="190" y="557" text-anchor="middle">Book:Get:123 ✓</text>
<rect x="260" y="540" width="120" height="25" fill="#52c41a" opacity="0.3" rx="2" stroke="#52c41a"/>
<text class="small-text" x="320" y="557" text-anchor="middle">Book:List ✓</text>
<!-- After invalidation -->
<text class="small-text" x="560" y="550" font-weight="bold">After:</text>
<rect x="620" y="540" width="120" height="25" fill="#ff4d4f" opacity="0.2" rx="2" stroke="#ff4d4f" stroke-dasharray="3,3"/>
<text class="small-text" x="680" y="557" text-anchor="middle" fill="#999" text-decoration="line-through">Book:Get:123</text>
<rect x="750" y="540" width="120" height="25" fill="#ff4d4f" opacity="0.2" rx="2" stroke="#ff4d4f" stroke-dasharray="3,3"/>
<text class="small-text" x="810" y="557" text-anchor="middle" fill="#999" text-decoration="line-through">Book:List</text>
<!-- Arrow showing invalidation -->
<path class="invalidate-arrow" d="M 400 552 L 600 552" />
<text class="small-text" x="475" y="545" fill="#ff4d4f" font-weight="bold">CLEARED</text>
<!-- Timeline -->
<line x1="50" y1="100" x2="50" y2="490" stroke="#1890ff" stroke-width="2" opacity="0.3"/>
<text class="small-text" x="15" y="105" fill="#1890ff" transform="rotate(-90, 15, 105)">Timeline</text>
<!-- Info boxes -->
<rect x="400" y="70" width="250" height="100" rx="5" fill="#f0f5ff" stroke="#597ef7" stroke-width="2"/>
<text class="section-title" x="525" y="95" text-anchor="middle">Why Wait for UoW?</text>
<text class="small-text" x="415" y="115">• Ensures transaction completes</text>
<text class="small-text" x="415" y="132">• Prevents cache-DB inconsistency</text>
<text class="small-text" x="415" y="149">• Handles rollback scenarios</text>
<rect x="700" y="70" width="250" height="100" rx="5" fill="#fff1f0" stroke="#ff4d4f" stroke-width="2"/>
<text class="section-title" x="825" y="95" text-anchor="middle">Invalidation Scope</text>
<text class="small-text" x="715" y="115">• All caches with [Cache(Book)]</text>
<text class="small-text" x="715" y="132">• Across all scopes (Global, User)</text>
<text class="small-text" x="715" y="149">• Entity-specific keys by ID</text>
</svg>

After

Width:  |  Height:  |  Size: 7.8 KiB

135
docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/images/cache-scoping-diagram.svg

@ -0,0 +1,135 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 500">
<defs>
<style>
.scope-box { fill: #f8f9fa; stroke: #1890ff; stroke-width: 2; }
.global-box { fill: #fff7e6; stroke: #fa8c16; stroke-width: 2; }
.user-box { fill: #e6f7ff; stroke: #1890ff; stroke-width: 2; }
.auth-box { fill: #f6ffed; stroke: #52c41a; stroke-width: 2; }
.entity-box { fill: #f9f0ff; stroke: #722ed1; stroke-width: 2; }
.text { font-family: Arial, sans-serif; font-size: 14px; fill: #333; }
.title { font-family: Arial, sans-serif; font-size: 18px; fill: #1890ff; font-weight: bold; }
.section-title { font-family: Arial, sans-serif; font-size: 15px; fill: #1890ff; font-weight: bold; }
.small-text { font-family: Arial, sans-serif; font-size: 11px; fill: #666; }
.code-text { font-family: 'Courier New', monospace; font-size: 11px; fill: #333; }
.badge { font-family: Arial, sans-serif; font-size: 10px; fill: white; font-weight: bold; }
</style>
</defs>
<!-- Title -->
<text class="title" x="500" y="35" text-anchor="middle">Cache Scoping Strategies</text>
<!-- Global Scope -->
<rect class="global-box" x="50" y="70" width="200" height="180" rx="5" />
<text class="section-title" x="150" y="95" text-anchor="middle">Global</text>
<circle cx="150" cy="130" r="30" fill="#fa8c16" opacity="0.2" stroke="#fa8c16" stroke-width="2"/>
<text class="text" x="150" y="137" text-anchor="middle" font-size="24">🌍</text>
<text class="small-text" x="65" y="175">Shared by all users</text>
<text class="small-text" x="65" y="190">Ideal for public data</text>
<rect x="65" y="200" width="170" height="35" fill="#fff" opacity="0.7" rx="3"/>
<text class="code-text" x="75" y="215">[Cache(typeof(Book),</text>
<text class="code-text" x="75" y="228">Scope = Global)]</text>
<!-- Current User Scope -->
<rect class="user-box" x="280" y="70" width="200" height="180" rx="5" />
<text class="section-title" x="380" y="95" text-anchor="middle">CurrentUser</text>
<circle cx="350" cy="130" r="25" fill="#1890ff" opacity="0.3" stroke="#1890ff" stroke-width="2"/>
<text class="text" x="350" y="137" text-anchor="middle" font-size="20">👤</text>
<circle cx="410" cy="130" r="25" fill="#1890ff" opacity="0.3" stroke="#1890ff" stroke-width="2"/>
<text class="text" x="410" y="137" text-anchor="middle" font-size="20">👤</text>
<text class="small-text" x="295" y="175">Per user (by ID)</text>
<text class="small-text" x="295" y="190">User-specific data</text>
<rect x="295" y="200" width="170" height="35" fill="#fff" opacity="0.7" rx="3"/>
<text class="code-text" x="305" y="215">[Cache(typeof(Order),</text>
<text class="code-text" x="305" y="228">Scope = CurrentUser)]</text>
<!-- Authenticated User Scope -->
<rect class="auth-box" x="510" y="70" width="200" height="180" rx="5" />
<text class="section-title" x="610" y="95" text-anchor="middle">AuthenticatedUser</text>
<rect x="565" y="110" width="90" height="40" fill="#52c41a" opacity="0.2" rx="3" stroke="#52c41a" stroke-width="2"/>
<text class="text" x="610" y="133" text-anchor="middle" font-size="16">🔐 Auth</text>
<rect x="565" y="155" width="90" height="30" fill="#ddd" opacity="0.4" rx="3" stroke="#999" stroke-width="1"/>
<text class="text" x="610" y="173" text-anchor="middle" font-size="12">Anonymous</text>
<text class="small-text" x="525" y="200">Auth vs Anonymous</text>
<rect x="525" y="210" width="170" height="35" fill="#fff" opacity="0.7" rx="3"/>
<text class="code-text" x="535" y="225">Scope =</text>
<text class="code-text" x="535" y="238">AuthenticatedUser</text>
<!-- Entity Scope -->
<rect class="entity-box" x="740" y="70" width="200" height="180" rx="5" />
<text class="section-title" x="840" y="95" text-anchor="middle">Entity</text>
<rect x="775" y="115" width="50" height="35" fill="#722ed1" opacity="0.2" rx="3" stroke="#722ed1" stroke-width="1"/>
<text class="text" x="800" y="135" text-anchor="middle" font-size="11">ID: 1</text>
<rect x="835" y="115" width="50" height="35" fill="#722ed1" opacity="0.2" rx="3" stroke="#722ed1" stroke-width="1"/>
<text class="text" x="860" y="135" text-anchor="middle" font-size="11">ID: 2</text>
<rect x="895" y="115" width="50" height="35" fill="#722ed1" opacity="0.2" rx="3" stroke="#722ed1" stroke-width="1"/>
<text class="text" x="920" y="135" text-anchor="middle" font-size="11">ID: 3</text>
<text class="small-text" x="755" y="170">Per entity instance</text>
<text class="small-text" x="755" y="185">By primary key</text>
<rect x="755" y="200" width="170" height="35" fill="#fff" opacity="0.7" rx="3"/>
<text class="code-text" x="765" y="215">[Cache(typeof(Book),</text>
<text class="code-text" x="765" y="228">Scope = Entity)]</text>
<!-- Examples Section -->
<line x1="50" y1="280" x2="950" y2="280" stroke="#ddd" stroke-width="2" />
<text class="section-title" x="50" y="310" fill="#1890ff">Common Use Cases</text>
<!-- Global Example -->
<rect class="global-box" x="50" y="325" width="220" height="70" rx="3" />
<text class="small-text" x="60" y="343" font-weight="bold" fill="#fa8c16">Global Scope</text>
<text class="small-text" x="60" y="360">✓ Product catalog</text>
<text class="small-text" x="60" y="375">✓ Configuration settings</text>
<text class="small-text" x="60" y="390">✓ Public announcements</text>
<!-- CurrentUser Example -->
<rect class="user-box" x="290" y="325" width="220" height="70" rx="3" />
<text class="small-text" x="300" y="343" font-weight="bold" fill="#1890ff">CurrentUser Scope</text>
<text class="small-text" x="300" y="360">✓ User profile</text>
<text class="small-text" x="300" y="375">✓ Shopping cart</text>
<text class="small-text" x="300" y="390">✓ User's order history</text>
<!-- AuthenticatedUser Example -->
<rect class="auth-box" x="530" y="325" width="200" height="70" rx="3" />
<text class="small-text" x="540" y="343" font-weight="bold" fill="#52c41a">Auth Scope</text>
<text class="small-text" x="540" y="360">✓ Member-only content</text>
<text class="small-text" x="540" y="375">✓ Navigation menus</text>
<text class="small-text" x="540" y="390">✓ Feature availability</text>
<!-- Entity Example -->
<rect class="entity-box" x="750" y="325" width="200" height="70" rx="3" />
<text class="small-text" x="760" y="343" font-weight="bold" fill="#722ed1">Entity Scope</text>
<text class="small-text" x="760" y="360">✓ Book details by ID</text>
<text class="small-text" x="760" y="375">✓ Product info by SKU</text>
<text class="small-text" x="760" y="390">✓ Invoice by number</text>
<!-- Cache Key Examples -->
<text class="section-title" x="50" y="435" fill="#1890ff">Cache Key Structure</text>
<rect x="50" y="445" width="900" height="40" fill="#f5f5f5" rx="3" stroke="#ddd" stroke-width="1"/>
<text class="code-text" x="60" y="462" fill="#fa8c16" font-weight="bold">Global:</text>
<text class="code-text" x="135" y="462">BookService:GetList:page1:size10</text>
<text class="code-text" x="60" y="477" fill="#1890ff" font-weight="bold">CurrentUser:</text>
<text class="code-text" x="135" y="477">OrderService:GetMyOrders:user:12345</text>
<text class="code-text" x="520" y="462" fill="#52c41a" font-weight="bold">Auth:</text>
<text class="code-text" x="570" y="462">MenuService:GetNav:auth:true</text>
<text class="code-text" x="520" y="477" fill="#722ed1" font-weight="bold">Entity:</text>
<text class="code-text" x="570" y="477">BookService:Get:entity:book-guid-123</text>
</svg>

After

Width:  |  Height:  |  Size: 7.5 KiB

797
docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/post.md

@ -0,0 +1,797 @@
# Implement Automatic Method-Level Caching in ABP Framework
Caching is one of the most effective ways to improve application performance, but implementing it manually for every method can be tedious and error-prone. What if you could cache method results automatically with just an attribute? In this article, we'll explore how to build an automatic method-level caching system in ABP Framework that handles cache invalidation, supports multiple scopes, and integrates seamlessly with your existing application.
By the end of this guide, you'll understand how to implement attribute-based caching that automatically invalidates when entities change, supports user-specific and global caching scopes, and provides built-in metrics for monitoring cache performance.
> 💡 **Complete Implementation Available**: This article is based on a working demo project. You can find the complete implementation in the [AbpAutoCacheDemo repository](https://github.com/salihozkara/AbpAutoCacheDemo), with the core AutoCache library implementation available in [this commit](https://github.com/salihozkara/AbpAutoCacheDemo/commit/946df1fc07de6eddd26eb14013a09968cd59329b).
## What is Automatic Method-Level Caching?
Automatic method-level caching is a technique that intercepts method calls and caches their results without requiring manual cache management code. Instead of writing cache logic in every method, you simply decorate methods with attributes that define caching behavior.
![Automatic Caching Flow](./images/automatic-caching-flow.svg)
The key benefits include:
- **Reduced Boilerplate:** No repetitive cache management code in your business logic
- **Consistent Caching Strategy:** Centralized cache configuration and behavior
- **Smart Invalidation:** Automatic cache clearing when related entities change
- **Multiple Scopes:** Support for global, user-specific, and entity-specific caching
- **Built-in Monitoring:** Track cache hits, misses, and performance metrics
## Architecture Overview
The automatic caching system consists of several key components working together:
![Architecture Diagram](./images/architecture-diagram.svg)
**Core Components:**
1. **CacheAttribute:** The attribute you apply to methods to enable automatic caching
2. **AutoCacheInterceptor:** Intercepts method calls and handles cache operations
3. **AutoCacheManager:** Manages cache storage, retrieval, and key generation
4. **IAutoCacheKeyManager:** Handles cache key mapping and invalidation
5. **AutoCacheInvalidationHandler:** Listens to entity changes and clears related caches
This architecture leverages ABP's dynamic proxy system and event bus to provide seamless caching without modifying your business logic.
## Prerequisites
Before implementing automatic caching, ensure you have:
- ABP Framework 10.0 or later
## Implementation
> 📦 **Repository Structure**: The complete implementation is available in the [AbpAutoCacheDemo repository](https://github.com/salihozkara/AbpAutoCacheDemo). The AutoCache library is located in the `src/AutoCache` folder, making it easy to extract and reuse in your own projects.
### Step - 1: Create the AutoCache Module
First, let's create a separate module for our caching infrastructure. This makes it reusable across projects.
### Step - 1: Create the AutoCache Module
First, let's create a separate module for our caching infrastructure. This makes it reusable across projects.
Create `AutoCache.csproj`:
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="10.0.0" />
<PackageReference Include="Volo.Abp.Core" Version="10.0.0" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="10.0.0" />
</ItemGroup>
</Project>
```
Create the module class `AutoCacheModule.cs`:
```csharp
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.Domain;
using Volo.Abp.Modularity;
namespace AutoCache;
[DependsOn(typeof(AbpDddDomainModule), typeof(AbpCachingStackExchangeRedisModule))]
public class AutoCacheModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistered(AutoCacheRegister.RegisterInterceptorIfNeeded); // 👈 Register interceptor
}
}
```
This module automatically registers the cache interceptor for any class that uses the `CacheAttribute`.
### Step - 2: Define the Cache Attribute
The `CacheAttribute` is the core of our automatic caching system. It specifies which entities affect the cache and what scope to use.
Create `CacheAttribute.cs`:
```csharp
using System;
using Volo.Abp.Domain.Entities;
namespace AutoCache;
[AttributeUsage(AttributeTargets.Method)]
public class CacheAttribute : Attribute
{
/// <summary>
/// Entity types that affect this cache. When these entities change, the cache will be invalidated.
/// </summary>
public Type[] InvalidateOnEntities { get; set; }
/// <summary>
/// Scope of the cache (Global, CurrentUser, AuthenticatedUser, or Entity)
/// </summary>
public AutoCacheScope Scope { get; set; } = AutoCacheScope.Global;
/// <summary>
/// Absolute expiration time relative to now in milliseconds (0 = use default, -1 = disabled)
/// </summary>
public long AbsoluteExpirationRelativeToNow { get; set; }
/// <summary>
/// Sliding expiration time in milliseconds (0 = use default, -1 = disabled)
/// </summary>
public long SlidingExpiration { get; set; }
public bool ConsiderUow { get; set; }
public string AdditionalCacheKey { get; set; }
public CacheAttribute(params Type[] invalidateOnEntities) // 👈 Specify entities that trigger cache invalidation
{
foreach (var entityType in invalidateOnEntities)
{
ArgumentNullException.ThrowIfNull(entityType);
if (!typeof(IEntity).IsAssignableFrom(entityType))
{
throw new ArgumentException($"Type {entityType.FullName} must implement IEntity interface.");
}
}
InvalidateOnEntities = invalidateOnEntities;
}
}
```
**Key Properties:**
- **InvalidateOnEntities:** Array of entity types that, when modified, will clear this cache
- **Scope:** Determines cache visibility (Global, CurrentUser, AuthenticatedUser, Entity)
- **AbsoluteExpirationRelativeToNow / SlidingExpiration:** Control cache lifetime
### Step - 3: Define Cache Scopes
Cache scopes determine how cache entries are partitioned. Create `AutoCacheScope.cs`:
```csharp
using System;
namespace AutoCache;
[Flags]
public enum AutoCacheScope
{
/// <summary>
/// Cache is shared globally across all users
/// </summary>
Global,
/// <summary>
/// Cache is scoped to the current user (based on user ID)
/// </summary>
CurrentUser,
/// <summary>
/// Cache is scoped to authenticated vs unauthenticated users
/// </summary>
AuthenticatedUser,
/// <summary>
/// Cache is scoped to the primary key of the entity involved
/// </summary>
Entity
}
```
![Cache Scoping Strategy](./images/cache-scoping-diagram.svg)
**When to Use Each Scope:**
- **Global:** For data that's the same for all users (e.g., configuration, public lists)
- **CurrentUser:** For user-specific data (e.g., user profile, user's orders)
- **AuthenticatedUser:** For data that differs between authenticated and anonymous users
- **Entity:** For data tied to a specific entity instance (e.g., book details by ID)
### Step - 4: Implement the Cache Interceptor
The interceptor is the heart of automatic caching. It intercepts method calls, checks the cache, and stores results. Create `AutoCacheInterceptor.cs`:
```csharp
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
namespace AutoCache;
public class AutoCacheInterceptor : AbpInterceptor, ITransientDependency
{
private readonly ILogger<AutoCacheInterceptor> _logger;
private readonly AutoCacheOptions _options;
private static readonly MethodInfo GetOrAddCacheAsyncMethod;
private readonly AutoCacheManager _autoCacheManager;
private static readonly ConcurrentDictionary<Type, MethodInfo> MethodCache = new();
static AutoCacheInterceptor()
{
GetOrAddCacheAsyncMethod = typeof(AutoCacheInterceptor).GetMethod(
nameof(GetOrAddCacheAsync),
BindingFlags.NonPublic | BindingFlags.Instance
)!;
}
public AutoCacheInterceptor(
ILogger<AutoCacheInterceptor> logger,
IOptions<AutoCacheOptions> options,
AutoCacheManager autoCacheManager)
{
_logger = logger;
_autoCacheManager = autoCacheManager;
_options = options.Value;
}
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
// Check if caching is enabled and method has [Cache] attribute
if(!_options.Enabled ||
invocation.Method.GetCustomAttributes(typeof(CacheAttribute), true).FirstOrDefault()
is not CacheAttribute attribute)
{
await invocation.ProceedAsync(); // 👈 No caching, proceed normally
return;
}
var proceeded = false;
try
{
// Create generic method based on return type
var genericMethod = MethodCache.GetOrAdd(invocation.Method.ReturnType, t =>
{
var isGenericTask = t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Task<>);
var resultType = isGenericTask ? t.GetGenericArguments()[0] : t;
return GetOrAddCacheAsyncMethod.MakeGenericMethod(resultType);
});
// Execute cache logic
(var result, proceeded) = await (Task<(object, bool)>)genericMethod.Invoke(this, [invocation, attribute])!;
invocation.ReturnValue = result; // 👈 Set cached or fresh result
}
catch (Exception e)
{
_logger.LogError(e, "Error occurred while caching method {MethodName}", invocation.Method.Name);
if(e is AutoCacheExceptionWrapper exceptionWrapper)
{
if (_options.ThrowOnError)
{
throw exceptionWrapper.OriginalException;
}
_logger.LogWarning(
"Cache operation failed, falling back to method execution for {MethodName}",
invocation.Method.Name
);
}
if (!proceeded && invocation.ReturnValue == null)
{
await invocation.ProceedAsync(); // 👈 Fallback to actual method execution
}
}
}
private async Task<(object?, bool)> GetOrAddCacheAsync<TResult>(
IAbpMethodInvocation invocation,
CacheAttribute attribute)
{
var proceeded = false;
var result = await _autoCacheManager.GetOrAddAsync(
invocation.TargetObject,
Factory,
invocation.Arguments,
() => new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = GetExpiration(
attribute.AbsoluteExpirationRelativeToNow,
_options.DefaultAbsoluteExpirationRelativeToNow),
SlidingExpiration = GetExpiration(
attribute.SlidingExpiration,
_options.DefaultSlidingExpiration)
},
attribute.InvalidateOnEntities,
attribute.Scope,
attribute.ConsiderUow,
attribute.AdditionalCacheKey,
invocation.Method.Name);
return (result, proceeded);
async Task<TResult> Factory()
{
await invocation.ProceedAsync(); // 👈 Execute actual method on cache miss
proceeded = true;
return (TResult)invocation.ReturnValue;
}
}
private static TimeSpan? GetExpiration(long milliseconds, long defaultValue)
{
return milliseconds switch
{
0 => defaultValue > 0 ? TimeSpan.FromMilliseconds(defaultValue) : null,
< 0 => null,
_ => TimeSpan.FromMilliseconds(milliseconds)
};
}
}
```
The interceptor intelligently determines whether to serve cached data or execute the actual method.
### Step - 5: Implement the Cache Manager
The `AutoCacheManager` handles the actual cache operations. Create a simplified version:
```csharp
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Logging;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
using Volo.Abp.Users;
namespace AutoCache;
public class AutoCacheManager : IScopedDependency
{
private readonly IAutoCacheKeyManager _autoCacheKeyManager;
private readonly ICurrentUser _currentUser;
private readonly ILogger<AutoCacheManager> _logger;
private readonly IAutoCacheMetrics _metrics;
private readonly AutoCacheOptions _options;
public AutoCacheManager(
IAutoCacheKeyManager autoCacheKeyManager,
ICurrentUser currentUser,
ILogger<AutoCacheManager> logger,
IAutoCacheMetrics metrics,
IOptions<AutoCacheOptions> options)
{
_autoCacheKeyManager = autoCacheKeyManager;
_currentUser = currentUser;
_logger = logger;
_metrics = metrics;
_options = options.Value;
}
public async Task<TResult> GetOrAddAsync<TResult>(
object? caller,
Func<Task<TResult>> func,
object?[]? parameters = null,
Func<DistributedCacheEntryOptions>? optionsFactory = null,
Type[]? invalidateOnEntities = null,
AutoCacheScope scope = AutoCacheScope.Global,
bool considerUow = false,
string? additionalCacheKey = null,
[CallerMemberName] string methodName = "")
{
if (!_options.Enabled)
{
return await func(); // 👈 Caching disabled, execute directly
}
var callerType = caller != null ? ProxyHelper.GetUnProxiedType(caller) : GetType();
parameters ??= [];
// Generate unique cache key based on method, parameters, and scope
var cacheKey = GenerateCacheKey<TResult>(
callerType.Name,
additionalCacheKey,
methodName,
parameters,
scope);
var (cachedResult, exception, wasHit) = await GetOrAddCacheAsync(
cacheKey,
func,
optionsFactory,
considerUow
);
// Record metrics
if (wasHit)
{
_metrics.RecordHit(cacheKey);
}
else
{
_metrics.RecordMiss(cacheKey);
}
if (exception != null)
{
_metrics.RecordError(cacheKey, exception);
if (_options.ThrowOnError)
{
throw exception;
}
}
return cachedResult;
}
private string GenerateCacheKey<TResult>(
string callerTypeName,
string? additionalCacheKey,
string methodName,
object?[] parameters,
AutoCacheScope scope)
{
var keyBuilder = new StringBuilder();
keyBuilder.Append($"{callerTypeName}:{methodName}");
// Add parameters to key
foreach (var param in parameters)
{
keyBuilder.Append($":{param}");
}
// Add scope-specific segments
if (scope.HasFlag(AutoCacheScope.CurrentUser) && _currentUser.Id.HasValue)
{
keyBuilder.Append($":user:{_currentUser.Id}"); // 👈 User-specific cache key
}
if (scope.HasFlag(AutoCacheScope.AuthenticatedUser))
{
keyBuilder.Append($":auth:{_currentUser.IsAuthenticated}");
}
if (!string.IsNullOrEmpty(additionalCacheKey))
{
keyBuilder.Append($":{additionalCacheKey}");
}
return keyBuilder.ToString();
}
// Additional methods for cache retrieval and storage...
}
```
The manager generates unique cache keys based on method signatures, parameters, and scope settings.
### Step - 6: Implement Cache Invalidation
When entities change, related caches must be cleared. Create `AutoCacheInvalidationHandler.cs`:
```csharp
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
namespace AutoCache;
public class AutoCacheInvalidationHandler<TEntity> :
ILocalEventHandler<EntityChangedEventData<TEntity>>
where TEntity : class, IEntity
{
private readonly IAutoCacheKeyManager _autoCacheKeyManager;
private readonly ILogger<AutoCacheInvalidationHandler<TEntity>> _logger;
private readonly IUnitOfWorkManager _unitOfWorkManager;
public AutoCacheInvalidationHandler(
IAutoCacheKeyManager autoCacheKeyManager,
ILogger<AutoCacheInvalidationHandler<TEntity>> logger,
IUnitOfWorkManager unitOfWorkManager)
{
_autoCacheKeyManager = autoCacheKeyManager;
_logger = logger;
_unitOfWorkManager = unitOfWorkManager;
}
public async Task HandleEventAsync(EntityChangedEventData<TEntity> eventData)
{
try
{
var entityType = typeof(TEntity);
var context = new RemoveCacheKeyContext
{
Keys = eventData.Entity.GetKeys()!
};
// Clear cache after unit of work completes
if(_unitOfWorkManager.Current != null)
{
_unitOfWorkManager.Current.OnCompleted(async () =>
{
await _autoCacheKeyManager.RemoveCacheAndCacheKeys(entityType, context); // 👈 Invalidate cache
});
}
else
{
await _autoCacheKeyManager.RemoveCacheAndCacheKeys(entityType, context);
}
}
catch (Exception e)
{
_logger.LogError(
e,
"Error occurred while clearing cache for entity type {EntityType}",
typeof(TEntity).FullName
);
}
}
}
```
![Cache Invalidation Flow](./images/cache-invalidation-flow.svg)
This handler listens to entity change events and automatically clears related caches. The invalidation happens after the unit of work completes to ensure data consistency.
### Step - 7: Configure AutoCache in Your Application
Add the `AutoCacheModule` to your application module dependencies:
```csharp
[DependsOn(
typeof(AutoCacheModule), // 👈 Add AutoCache module
typeof(AbpCachingStackExchangeRedisModule),
// ... other modules
)]
public class YourApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AutoCacheOptions>(options =>
{
options.Enabled = true; // 👈 Enable caching
options.DefaultAbsoluteExpirationRelativeToNow = 3600000; // 1 hour
options.DefaultSlidingExpiration = 600000; // 10 minutes
options.ThrowOnError = false; // Fallback to method execution on cache errors
});
// Configure Redis (if using distributed cache)
Configure<AbpDistributedCacheOptions>(options =>
{
options.KeyPrefix = "YourApp:";
});
}
}
```
### Step - 8: Use Automatic Caching in Application Services
Now comes the easy part - using automatic caching! Simply add the `[Cache]` attribute to your methods:
```csharp
using AutoCache;
[Authorize(AutoCacheDemoPermissions.Books.Default)]
public class BookAppService : ApplicationService, IBookAppService
{
private readonly IRepository<Book, Guid> _repository;
private readonly AutoCacheManager _autoCacheManager;
public BookAppService(IRepository<Book, Guid> repository, AutoCacheManager autoCacheManager)
{
_repository = repository;
_autoCacheManager = autoCacheManager;
}
// Cache this method, invalidate when Book entity changes
[Cache(typeof(Book), Scope = AutoCacheScope.Global)]
public virtual async Task<BookDto> GetAsync(Guid id)
{
// You can also use AutoCacheManager directly for nested caching
var book = await _autoCacheManager.GetOrAddAsync(
this,
async () => await _repository.GetAsync(id),
[id], // 👈 Method parameters
invalidateOnEntities: [typeof(Book)],
scope: AutoCacheScope.Entity);
return ObjectMapper.Map<Book, BookDto>(book!);
}
// Cache book list, invalidate when any Book changes
[Cache(typeof(Book))]
public virtual async Task<PagedResultDto<BookDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
var queryable = await _repository.GetQueryableAsync();
var query = queryable
.OrderBy(input.Sorting.IsNullOrWhiteSpace() ? "Name" : input.Sorting)
.Skip(input.SkipCount)
.Take(input.MaxResultCount);
var books = await AsyncExecuter.ToListAsync(query);
var totalCount = await AsyncExecuter.CountAsync(queryable);
return new PagedResultDto<BookDto>(
totalCount,
ObjectMapper.Map<List<Book>, List<BookDto>>(books)
);
}
// No caching on write operations
[Authorize(AutoCacheDemoPermissions.Books.Create)]
public async Task<BookDto> CreateAsync(CreateUpdateBookDto input)
{
var book = ObjectMapper.Map<CreateUpdateBookDto, Book>(input);
await _repository.InsertAsync(book); // 👈 This will trigger cache invalidation
return ObjectMapper.Map<Book, BookDto>(book);
}
}
```
**What Happens Here:**
1. When `GetAsync` is called, the interceptor checks the cache
2. On cache miss, the actual method executes and the result is cached
3. When `CreateAsync` inserts a `Book`, the invalidation handler clears all caches related to `Book`
4. Next call to `GetAsync` will fetch fresh data
## Advanced Features
### User-Specific Caching
For user-specific data, use `AutoCacheScope.CurrentUser`:
```csharp
[Cache(typeof(Order), Scope = AutoCacheScope.CurrentUser)]
public virtual async Task<List<OrderDto>> GetMyOrdersAsync()
{
var orders = await _orderRepository.GetListAsync(x => x.UserId == CurrentUser.Id);
return ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
}
```
Each user gets their own cache entry, automatically invalidated when their orders change.
### Custom Cache Keys
For fine-grained control, add custom cache key segments:
```csharp
[Cache(
typeof(Product),
Scope = AutoCacheScope.Global,
AdditionalCacheKey = "featured"
)]
public virtual async Task<List<ProductDto>> GetFeaturedProductsAsync()
{
// Only featured products are cached separately
return await GetProductsByCategoryAsync("Featured");
}
```
### Performance Metrics
Monitor cache performance using `IAutoCacheMetrics`:
```csharp
public class CacheMonitoringService : ITransientDependency
{
private readonly IAutoCacheMetrics _metrics;
public CacheMonitoringService(IAutoCacheMetrics metrics)
{
_metrics = metrics;
}
public AutoCacheStatistics GetStatistics()
{
return _metrics.GetStatistics(); // 👈 Get hit rate, miss count, error count
}
}
```
## Testing the Application
### 1. Run the Application
```bash
abp new BookStore -u mvc -d ef
cd BookStore
dotnet run --project src/BookStore.Web
```
### 2. Test Cache Behavior
Create a simple test to verify caching:
```csharp
[Fact]
public async Task Should_Cache_Book_Results()
{
// First call - cache miss
var book1 = await _bookAppService.GetAsync(testBookId);
// Second call - cache hit (should be faster)
var book2 = await _bookAppService.GetAsync(testBookId);
book1.Name.ShouldBe(book2.Name);
}
[Fact]
public async Task Should_Invalidate_Cache_On_Update()
{
// Cache the book
var book1 = await _bookAppService.GetAsync(testBookId);
// Update the book
await _bookAppService.UpdateAsync(testBookId, new CreateUpdateBookDto
{
Name = "Updated Name"
});
// Fetch again - should get updated data (cache was invalidated)
var book2 = await _bookAppService.GetAsync(testBookId);
book2.Name.ShouldBe("Updated Name");
}
```
### 3. Monitor Cache Performance
Check your application logs for cache metrics:
```
[INF] Cache Hit: BookAppService:GetAsync:book-id-123 (Response Time: 5ms)
[INF] Cache Miss: BookAppService:GetListAsync (Response Time: 156ms)
[INF] Cache Invalidation: Book entity changed, cleared 3 cache entries
```
## Key Takeaways
**Automatic caching reduces boilerplate code** - Just add `[Cache]` attribute to methods instead of manual cache management
**Smart invalidation keeps data fresh** - Entity changes automatically clear related caches without manual intervention
**Multiple scoping options** - Support for global, user-specific, authenticated, and entity-level caching strategies
**Built-in fallback handling** - Gracefully falls back to method execution if caching fails
**Performance monitoring** - Track cache hits, misses, and errors for optimization
## Conclusion
Automatic method-level caching dramatically simplifies performance optimization in ABP Framework applications. By using attributes and interceptors, you can add sophisticated caching behavior without cluttering your business logic with cache management code.
The system we've built provides intelligent cache invalidation, multiple scoping strategies, and built-in monitoring - all while maintaining clean, readable code. Whether you're building a small application or an enterprise system, this approach scales elegantly and integrates seamlessly with ABP's architecture.
Ready to implement this in your project? The complete working implementation is available in the [AbpAutoCacheDemo repository](https://github.com/salihozkara/AbpAutoCacheDemo). You can clone the repository, explore the code, and even extract the `src/AutoCache` folder to use it as a standalone library in your own ABP applications. The [main implementation commit](https://github.com/salihozkara/AbpAutoCacheDemo/commit/946df1fc07de6eddd26eb14013a09968cd59329b) shows all the components working together, including interceptor registration, cache key management, and automatic invalidation handlers.r you're building a small application or an enterprise system, this approach scales elegantly and integrates seamlessly with ABP's architecture.
Ready to implement this in your project? Check out the complete working example in the repository linked below, and start improving your application's performance today!
### See Also
- [ABP Caching Documentation](https://abp.io/docs/latest/framework/fundamentals/caching)
- [Interceptors in ABP](https://abp.io/docs/latest/framework/infrastructure/interceptors)
- [Event Bus Documentation](https://abp.io/docs/latest/framework/infrastructure/event-bus)
- [Sample Project on GitHub](https://github.com/salihozkara/AbpAutoCacheDemo)
---
## References
- [ABP Framework Documentation](https://docs.abp.io)
- [Redis Distributed Caching](https://redis.io/docs/)
- [Aspect-Oriented Programming Patterns](https://en.wikipedia.org/wiki/Aspect-oriented_programming)

1
docs/en/Community-Articles/2025-12-06-Implement-Automatic-Method-Level-Caching-in-ABP-Framework/summary.md

@ -0,0 +1 @@
Learn how to implement automatic method-level caching in ABP Framework using attributes and interceptors. This comprehensive guide covers building a reusable cache infrastructure with attribute-based caching, intelligent cache invalidation when entities change, support for multiple cache scopes (Global, CurrentUser, AuthenticatedUser, and Entity), seamless integration with ABP's dynamic proxy system and event bus, and built-in performance metrics for monitoring cache effectiveness in production applications.

14
docs/en/cli/index.md

@ -7,11 +7,7 @@
# ABP CLI
ABP CLI (Command Line Interface) is a command line tool to perform some common operations for ABP based solutions or ABP Studio features.
> With **v8.2+**, the old/legacy ABP CLI has been replaced with a new CLI system to align with the new templating system and [ABP Studio](../studio/index.md). The new ABP CLI commands are explained in this documentation. However, if you want to learn more about the differences between the old and new CLIs, want to learn the reason for the change, or need guidance to use the old ABP CLI, please refer to the [Old vs New CLI](differences-between-old-and-new-cli.md) documentation.
>
> You may need to remove the Old CLI before installing the New CLI, by running the following command: `dotnet tool uninstall -g Volo.Abp.Cli`
ABP CLI (Command Line Interface) is a command line tool to perform some common operations for ABP based solutions or [ABP Studio](../studio/index.md) features.
## Installation
@ -29,16 +25,16 @@ dotnet tool update -g Volo.Abp.Studio.Cli
## Global Options
While each command may have a set of options, there are some global options that can be used with any command;
While each command may have a set of options, there are some global options that can be used with any command:
* `--skip-cli-version-check` or `-scvc`: Skips to check the latest version of the ABP CLI. If you don't specify, it will check the latest version and shows a warning message if there is a newer version of the ABP CLI.
- `--skip-extension-version-check` or `-sevc`: Skips to check the latest version of the ABP CLI extensions. If you don't specify, it will check the latest version and download the latest version if there is a newer version of the ABP CLI extensions.
* `--skip-cli-version-check` or `-scvc`: Skips checking the latest version of the ABP CLI. If you don't specify, it will check the latest version and shows a warning message if there is a newer version of the ABP CLI.
- `--skip-extension-version-check` or `-sevc`: Skips checking the latest version of the ABP CLI extensions. If you don't specify, it will check the latest version and download the latest version if there is a newer version of the ABP CLI extensions.
* `--old`: ABP CLI has two variations: `Volo.Abp.Studio.Cli` and `Volo.Abp.Cli`. New features/templates are added to the `Volo.Abp.Studio.Cli`. But if you want to use the old version, you can use this option **at the end of your commands**. For example, `abp new Acme.BookStore --old`.
* `--help` or `-h`: Shows help for the specified command.
## Commands
Here, is the list of all available commands before explaining their details:
Here is the list of all available commands before explaining their details:
* **[`help`](../cli#help)**: Shows help on the usage of the ABP CLI.
* **[`cli`](../cli#cli)**: Update or remove ABP CLI.

2
docs/en/contribution/angular-ui.md

@ -12,7 +12,7 @@
- Dotnet core SDK https://dotnet.microsoft.com/en-us/download
- Nodejs LTS https://nodejs.org/en/
- Docker https://docs.docker.com/engine/install
- Angular CLI. https://angular.io/guide/what-is-angular#angular-cli
- Angular CLI. https://angular.dev/tools/cli
- Abp CLI https://docs.abp.io/en/abp/latest/cli
- A code editor

6
docs/en/docs-nav.json

@ -1557,6 +1557,10 @@
"text": "Service Proxies",
"path": "framework/ui/angular/service-proxies.md"
},
{
"text": "SSR Configuration",
"path": "framework/ui/angular/ssr-configuration.md"
},
{
"text": "PWA Configuration",
"path": "framework/ui/angular/pwa-configuration.md"
@ -1641,7 +1645,7 @@
"path": "framework/ui/angular/list-service.md"
},
{
"text": "Easy *ngFor trackBy",
"text": "Easy @for() track",
"path": "framework/ui/angular/track-by-service.md"
},
{

9
docs/en/framework/infrastructure/artificial-intelligence/index.md

@ -1,4 +1,11 @@
# Artificial Intelligence
```json
//[doc-seo]
{
"Description": "Explore ABP Framework's AI integration, enabling seamless AI capabilities, workspace management, and reusable modules for .NET developers."
}
```
# Artificial Intelligence (AI)
ABP Framework provides integration for AI capabilities to your application by using Microsoft's popular AI libraries. The main purpose of this integration is to provide a consistent and easy way to use AI capabilities and manage different AI providers, models and configurations in a single application.
ABP introduces a concept called **AI Workspace**. A workspace allows you to configure isolated AI configurations for a named scope. You can then resolve AI services for a specific workspace when you need to use them.

38
docs/en/framework/ui/angular/component-replacement.md

@ -584,8 +584,8 @@ Open the generated `nav-items.component.html` in `src/app/nav-items` folder and
class="bg-transparent border-0 text-white"
/>
<li class="nav-item d-flex align-items-center">
@if ((dropdownLanguages$ | async)?.length > 0) {
<div
*ngIf="(dropdownLanguages$ | async)?.length > 0"
class="dropdown"
ngbDropdown
#languageDropdown="ngbDropdown"
@ -608,24 +608,21 @@ Open the generated `nav-items.component.html` in `src/app/nav-items` folder and
aria-labelledby="dropdownMenuLink"
[class.d-block]="smallScreen && languageDropdown.isOpen()"
>
<a
*ngFor="let lang of dropdownLanguages$ | async"
href="javascript:void(0)"
class="dropdown-item"
(click)="onChangeLang(lang.cultureName)"
>{%{{{ lang?.displayName }}}%}</a
>
@for (lang of dropdownLanguages$ | async; track lang.cultureName) {
<a
href="javascript:void(0)"
class="dropdown-item"
(click)="onChangeLang(lang.cultureName)"
>{%{{{ lang?.displayName }}}%}</a
>
}
</div>
</div>
}
</li>
<li class="nav-item d-flex align-items-center">
<ng-template #loginBtn>
<a role="button" class="nav-link pointer" (click)="navigateToLogin()"
>{%{{{ 'AbpAccount::Login' | abpLocalization }}}%}</a
>
</ng-template>
@if ((currentUser$ | async)?.isAuthenticated) {
<div
*ngIf="(currentUser$ | async)?.isAuthenticated; else loginBtn"
ngbDropdown
class="dropdown"
#currentUserDropdown="ngbDropdown"
@ -641,9 +638,9 @@ Open the generated `nav-items.component.html` in `src/app/nav-items` folder and
aria-haspopup="true"
aria-expanded="false"
>
<small *ngIf="(selectedTenant$ | async)?.name as tenantName"
><i>{%{{{ tenantName }}}%}</i>\</small
>
@if ((selectedTenant$ | async)?.name as tenantName) {
<small><i>{%{{{ tenantName }}}%}</i>\</small>
}
<strong>{%{{{ (currentUser$ | async)?.userName }}}%}</strong>
</a>
<div
@ -661,6 +658,13 @@ Open the generated `nav-items.component.html` in `src/app/nav-items` folder and
>
</div>
</div>
} @else {
<ng-template #loginBtn>
<a role="button" class="nav-link pointer" (click)="navigateToLogin()">
{%{{{ 'AbpAccount::Login' | abpLocalization }}}%}
</a>
</ng-template>
}
</li>
</ul>
```

2
docs/en/framework/ui/angular/data-table-column-extensions.md

@ -171,7 +171,7 @@ It has the following properties:
- **index** is the table index where the record is at.
- **getInjected** is the equivalent of [Injector.get](https://angular.io/api/core/Injector#get). You can use it to reach injected dependencies of `ExtensibleTableComponent`, including, but not limited to, its parent component.
- **getInjected** is the equivalent of [Injector.get](https://angular.dev/api/core/Injector). You can use it to reach injected dependencies of `ExtensibleTableComponent`, including, but not limited to, its parent component.
```js
{

2
docs/en/framework/ui/angular/dynamic-form-extensions.md

@ -107,7 +107,7 @@ Extra properties defined on an existing entity will be included in the create an
It has the following properties:
- **getInjected** is the equivalent of [Injector.get](https://angular.io/api/core/Injector#get). You can use it to reach injected dependencies of `ExtensibleFormPropComponent`, including, but not limited to, its parent components.
- **getInjected** is the equivalent of [Injector.get](https://angular.dev/api/core/Injector). You can use it to reach injected dependencies of `ExtensibleFormPropComponent`, including, but not limited to, its parent components.
```js
{

2
docs/en/framework/ui/angular/entity-action-extensions.md

@ -272,7 +272,7 @@ It has the following properties:
- **index** is the table index where the record is at.
- **getInjected** is the equivalent of [Injector.get](https://angular.io/api/core/Injector#get). You can use it to reach injected dependencies of `GridActionsComponent`, including, but not limited to, its parent component.
- **getInjected** is the equivalent of [Injector.get](https://angular.dev/api/core/Injector). You can use it to reach injected dependencies of `GridActionsComponent`, including, but not limited to, its parent component.
```js
{

19
docs/en/framework/ui/angular/form-validation.md

@ -52,7 +52,7 @@ export const appConfig: ApplicationConfig = {
};
```
When a [validator](https://angular.io/guide/form-validation#defining-custom-validators) or an [async validator](https://angular.io/guide/form-validation#creating-asynchronous-validators) returns an error with the key given to the error blueprints (`uniqueUsername` here), the validation library will be able to display an error message after localizing according to the given key and interpolation params. The result will look like this:
When a [validator](https://angular.dev/guide/forms/form-validation) or an [async validator](https://angular.dev/guide/forms/form-validation) returns an error with the key given to the error blueprints (`uniqueUsername` here), the validation library will be able to display an error message after localizing according to the given key and interpolation params. The result will look like this:
<img alt="An already taken username is entered while creating new user and a custom error message appears under the input after validation." src="./images/form-validation---new-error-message.gif" width="990px" style="max-width:100%">
@ -146,12 +146,13 @@ import { ChangeDetectionStrategy, Component } from "@angular/core";
selector: "app-validation-error",
imports:[CommonModule, LocalizationPipe],
template: `
<div
class="font-weight-bold font-italic px-1 invalid-feedback"
*ngFor="let error of abpErrors; trackBy: trackByFn"
>
{%{{{ error.message | abpLocalization: error.interpoliteParams }}}%}
</div>
@for (error of abpErrors; track $index){
<div
class="font-weight-bold font-italic px-1 invalid-feedback"
>
{%{{{ error.message | abpLocalization: error.interpoliteParams }}}%}
</div>
}
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
@ -250,7 +251,7 @@ buildForm() {
<a ngbNavLink>{%{{ 'AbpIdentity::UserInformations' | abpLocalization }}%}</a>
<ng-template ngbNavContent>
<!-- Automatically displays all entity fields and their validation -->
<abp-extensible-form [selectedRecord]="selected"></abp-extensible-form>
<abp-extensible-form [selectedRecord]="selected" />
</ng-template>
</li>
@ -263,7 +264,7 @@ buildForm() {
<abp-checkbox
[formControl]="roleGroup.controls[roles[i].name]"
[label]="roles[i].name"
></abp-checkbox>
/>
</div>
}
</ng-template>

4
docs/en/framework/ui/angular/http-requests.md

@ -9,7 +9,7 @@
## About HttpClient
Angular has the amazing [HttpClient](https://angular.io/guide/http) for communication with backend services. It is a layer on top and a simplified representation of [XMLHttpRequest Web API](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). It also is the recommended agent by Angular for any HTTP request. There is nothing wrong with using the `HttpClient` in your ABP project.
Angular has the amazing [HttpClient](https://angular.dev/guide/http/making-requests) for communication with backend services. It is a layer on top and a simplified representation of [XMLHttpRequest Web API](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). It also is the recommended agent by Angular for any HTTP request. There is nothing wrong with using the `HttpClient` in your ABP project.
However, `HttpClient` leaves error handling to the caller (method). In other words, HTTP errors are handled manually and by hooking into the observer of the `Observable` returned.
@ -93,7 +93,7 @@ postFoo(body: Foo) {
}
```
You may [check here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/core/src/lib/models/rest.ts#L23) for complete `Rest.Request<T>` type, which has only a few changes compared to [HttpRequest](https://angular.io/api/common/http/HttpRequest) class in Angular.
You may [check here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/core/src/lib/models/rest.ts#L23) for complete `Rest.Request<T>` type, which has only a few changes compared to [HttpRequest](https://angular.dev/api/common/http/HttpRequest) class in Angular.
### How to Disable Default Error Handler of RestService

24
docs/en/framework/ui/angular/lazy-load-service.md

@ -44,10 +44,13 @@ The first parameter of `load` method expects a `LoadingStrategy`. If you pass a
```js
import { LazyLoadService, LOADING_STRATEGY } from '@abp/ng.core';
import { inject } from '@angular/core';
import { AsyncPipe } from '@angular/common';
@Component({
template: `
<some-component *ngIf="libraryLoaded$ | async"></some-component>
@if (libraryLoaded$ | async) {
<some-component/>
}
`
})
class DemoComponent {
@ -59,7 +62,7 @@ class DemoComponent {
}
```
The `load` method returns an observable to which you can subscibe in your component or with an `async` pipe. In the example above, the `NgIf` directive will render `<some-component>` only **if the script gets successfully loaded or is already loaded before**.
The `load` method returns an observable to which you can subscibe in your component or with an `async` pipe. In the example above, the `@if(...)` directive will render `<some-component>` only **if the script gets successfully loaded or is already loaded before**.
> You can subscribe multiple times in your template with `async` pipe. The Scripts will only be loaded once.
@ -74,10 +77,13 @@ If you pass a `StyleLoadingStrategy` instance as the first parameter of `load` m
```js
import { LazyLoadService, LOADING_STRATEGY } from '@abp/ng.core';
import { inject } from '@angular/core';
import { AsyncPipe } from '@angular/common';
@Component({
template: `
<some-component *ngIf="stylesLoaded$ | async"></some-component>
@if (stylesLoaded$ | async) {
<some-component/>
}
`
})
class DemoComponent {
@ -89,7 +95,7 @@ class DemoComponent {
}
```
The `load` method returns an observable to which you can subscibe in your component or with an `AsyncPipe`. In the example above, the `NgIf` directive will render `<some-component>` only **if the style gets successfully loaded or is already loaded before**.
The `load` method returns an observable to which you can subscibe in your component or with an `AsyncPipe`. In the example above, the `@if(...)` directive will render `<some-component>` only **if the style gets successfully loaded or is already loaded before**.
> You can subscribe multiple times in your template with `async` pipe. The styles will only be loaded once.
@ -126,10 +132,13 @@ A common usecase is **loading multiple scripts and/or styles before using a feat
import { LazyLoadService, LOADING_STRATEGY } from '@abp/ng.core';
import { forkJoin } from 'rxjs';
import { inject } from '@angular/core';
import { AsyncPipe } from '@angular/common';
@Component({
template: `
<some-component *ngIf="scriptsAndStylesLoaded$ | async"></some-component>
@if (scriptsAndStylesLoaded$ | async) {
<some-component />
}
`
})
class DemoComponent {
@ -168,10 +177,13 @@ Another frequent usecase is **loading dependent scripts in order**:
import { LazyLoadService, LOADING_STRATEGY } from '@abp/ng.core';
import { concat } from 'rxjs';
import { inject } from '@angular/core';
import { AsyncPipe } from '@angular/common';
@Component({
template: `
<some-component *ngIf="scriptsLoaded$ | async"></some-component>
@if (scriptsLoaded$ | async) {
<some-component />
}
`
})
class DemoComponent {

2
docs/en/framework/ui/angular/list-service.md

@ -126,7 +126,7 @@ Then you can place inputs to the HTML:
## Usage with Observables
You may use observables in combination with [AsyncPipe](https://angular.io/guide/observables-in-angular#async-pipe) of Angular instead. Here are some possibilities:
You may use observables in combination with [AsyncPipe](https://angular.dev/ecosystem/rxjs-interop) of Angular instead. Here are some possibilities:
```js
book$ = this.list.hookToQuery(query => this.bookService.getListByInput(query));

4
docs/en/framework/ui/angular/localization.md

@ -220,7 +220,7 @@ As of v2.9 ABP supports RTL. If you are generating a new project with v2.9 and a
### Step 1. Create Chunks for Bootstrap LTR and RTL
Find [styles configuration in angular.json](https://angular.io/guide/workspace-config#style-script-config) and make sure the chunks in your project has `bootstrap-rtl.min` and `bootstrap-ltr.min` as shown below.
Find [styles configuration in angular.json](https://angular.dev/reference/configs/workspace-config) and make sure the chunks in your project has `bootstrap-rtl.min` and `bootstrap-ltr.min` as shown below.
```json
{
@ -279,7 +279,7 @@ export class AppComponent {}
## Registering a New Locale
Since ABP has more than one language, Angular locale files load lazily using [Webpack's import function](https://webpack.js.org/api/module-methods/#import-1) to avoid increasing the bundle size and to register the Angular core using the [`registerLocaleData`](https://angular.io/api/common/registerLocaleData) function. The chunks to be included in the bundle are specified by the [Webpack's magic comments](https://webpack.js.org/api/module-methods/#magic-comments) as hard-coded. Therefore a `registerLocale` function that returns Webpack `import` function must be passed to `provideAbpCore(withOptions({...}))`.
Since ABP has more than one language, Angular locale files load lazily using [Webpack's import function](https://webpack.js.org/api/module-methods/#import-1) to avoid increasing the bundle size and to register the Angular core using the [`registerLocaleData`](https://angular.dev/api/common/registerLocaleData) function. The chunks to be included in the bundle are specified by the [Webpack's magic comments](https://webpack.js.org/api/module-methods/#magic-comments) as hard-coded. Therefore a `registerLocale` function that returns Webpack `import` function must be passed to `provideAbpCore(withOptions({...}))`.
### registerLocaleFn

2
docs/en/framework/ui/angular/page-toolbar-extensions.md

@ -215,7 +215,7 @@ It has the following properties:
}
```
- **getInjected** is the equivalent of [Injector.get](https://angular.io/api/core/Injector#get). You can use it to reach injected dependencies of `PageToolbarComponent`, including, but not limited to, its parent component.
- **getInjected** is the equivalent of [Injector.get](https://angular.dev/api/core/Injector). You can use it to reach injected dependencies of `PageToolbarComponent`, including, but not limited to, its parent component.
```js
{

91
docs/en/framework/ui/angular/permission-management-component-replacement.md

@ -334,7 +334,7 @@ Open the generated `permission-management.component.html` in `src/app/permission
```html
<abp-modal [visible]="isVisible" (visibleChange)="onVisibleChange($event)" [busy]="modalBusy">
<ng-container *ngIf="data.entityDisplayName">
@if (data.entityDisplayName) {
<ng-template #abpHeader>
<h4>
{%{{{ 'AbpPermissionManagement::Permissions' | abpLocalization }}}%} -
@ -360,19 +360,22 @@ Open the generated `permission-management.component.html` in `src/app/permission
<div class="row">
<div class="overflow-scroll col-md-4">
<ul class="nav nav-pills flex-column">
<li *ngFor="let group of data.groups; trackBy: trackByFn" class="nav-item">
<a
*ngIf="{ assignedCount: getAssignedCount(group.name) } as count"
class="nav-link pointer"
[class.active]="selectedGroup?.name === group?.name"
(click)="onChangeGroup(group)"
>
<div [class.font-weight-bold]="count.assignedCount">
{%{{{ group?.displayName }}}%}
<span>({%{{{ count.assignedCount }}}%})</span>
</div>
</a>
</li>
@for (group of data.groups; track group.name) {
<li class="nav-item">
@if ({ assignedCount: getAssignedCount(group.name) } as count) {
<a
class="nav-link pointer"
[class.active]="selectedGroup?.name === group?.name"
(click)="onChangeGroup(group)"
>
<div [class.font-weight-bold]="count.assignedCount">
{%{{{ group?.displayName }}}%}
<span>({%{{{ count.assignedCount }}}%})</span>
</div>
</a>
}
</li>
}
</ul>
</div>
<div class="col-md-8 overflow-scroll">
@ -393,34 +396,36 @@ Open the generated `permission-management.component.html` in `src/app/permission
}}}%}</label>
</div>
<hr class="mb-3" />
<div
*ngFor="let permission of selectedGroupPermissions; let i = index; trackBy: trackByFn"
[ngStyle]="permission.style"
class="custom-checkbox custom-control mb-2"
>
<input
#permissionCheckbox
type="checkbox"
[checked]="getChecked(permission.name)"
[value]="getChecked(permission.name)"
[attr.id]="permission.name"
class="custom-control-input"
[disabled]="isGrantedByOtherProviderName(permission.grantedProviders)"
/>
<label
class="custom-control-label"
[attr.for]="permission.name"
(click)="onClickCheckbox(permission, permissionCheckbox.value)"
>{%{{{ permission.displayName }}}%}
<ng-container *ngIf="!hideBadges">
<span
*ngFor="let provider of permission.grantedProviders"
class="badge badge-light"
>{%{{{ provider.providerName }}}%}: {%{{{ provider.providerKey }}}%}</span
>
</ng-container>
</label>
</div>
@for (permission of selectedGroupPermissions; track permission.name; let i = $index) {
<div
[ngStyle]="permission.style"
class="custom-checkbox custom-control mb-2"
>
<input
#permissionCheckbox
type="checkbox"
[checked]="getChecked(permission.name)"
[value]="getChecked(permission.name)"
[attr.id]="permission.name"
class="custom-control-input"
[disabled]="isGrantedByOtherProviderName(permission.grantedProviders)"
/>
<label
class="custom-control-label"
[attr.for]="permission.name"
(click)="onClickCheckbox(permission, permissionCheckbox.value)"
>
{%{{{ permission.displayName }}}%}
@if (!hideBadges) {
@for (provider of permission.grantedProviders; track provider.providerKey) {
<span class="badge badge-light">
{%{{{ provider.providerName }}}%}: {%{{{ provider.providerKey }}}%}
</span>
}
}
</label>
</div>
}
</div>
</div>
</div>
@ -433,7 +438,7 @@ Open the generated `permission-management.component.html` in `src/app/permission
'AbpIdentity::Save' | abpLocalization
}}}%}</abp-button>
</ng-template>
</ng-container>
}
</abp-modal>
```

8
docs/en/framework/ui/angular/pwa-configuration.md

@ -37,7 +37,7 @@ Here is the output of the command:
So, Angular CLI updates some files and add a few others:
- **ngsw-config.json** is where the [service worker configuration](https://angular.io/guide/service-worker-config) is placed. Not all PWAs have this file. It is specific to Angular.
- **ngsw-config.json** is where the [service worker configuration](https://angular.dev/ecosystem/service-workers/config) is placed. Not all PWAs have this file. It is specific to Angular.
- **manifest.webmanifest** is a [web app manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) and provides information about your app in JSON format.
- **icons** are placeholder icons that are referred to in your web app manifest. We will replace these in a minute.
- **angular.json** has following modifications:
@ -45,7 +45,7 @@ So, Angular CLI updates some files and add a few others:
- `serviceWorker` is `true` in production build.
- `ngswConfigPath` refers to _ngsw-config.json_.
- **package.json** has _@angular/service-worker_ as a new dependency.
- **app.config.ts** imports `ServiceWorkerModule` and registers a service worker filename.
- **app.config.ts** The `provideServiceWorker` provider is imported to register the service worker script.
- **index.html** has following modifications:
- A `<link>` element that refers to _manifest.webmanifest_.
- A `<meta>` tag that sets a theme color.
@ -342,8 +342,8 @@ Open _ngsw-config.json_ file and replace its content with this:
}
```
In case you want to cache other static files, please refer to the [service worker configuration document](https://angular.io/guide/service-worker-config#assetgroups) on Angular.io.
In case you want to cache other static files, please refer to the [service worker configuration document](https://angular.dev/ecosystem/service-workers/config) on Angular.dev.
### 3.2 Set Data Groups
This part is unique to your project. We recommend being very careful about which endpoints to cache. Please refer to [service worker configuration document](https://angular.io/guide/service-worker-config#datagroups) on Angular.io for details.
This part is unique to your project. We recommend being very careful about which endpoints to cache. Please refer to [service worker configuration document](https://angular.dev/ecosystem/service-workers/config) on Angular.dev for details.

22
docs/en/framework/ui/angular/quick-start.md

@ -84,10 +84,10 @@ Now let us take a look at the contents of the source folder.
- **app.config.ts** is the [root configuration](https://angular.dev/api/platform-browser/bootstrapApplication) that includes information about how parts of your application are related and what to run at the initiation of your application.
- **route.provider.ts** is used for [modifying the menu](../angular/modifying-the-menu.md).
- **assets** is for static files. A file (e.g. an image) placed in this folder will be available as is when the application is served.
- **environments** includes one file per environment configuration. There are two configurations by default, but you may always introduce another one. These files are directly referred to in _angular.json_ and help you have different builds and application variables. Please refer to [configuring Angular application environments](https://angular.io/guide/build#configuring-application-environments) for details.
- **environments** includes one file per environment configuration. There are two configurations by default, but you may always introduce another one. These files are directly referred to in _angular.json_ and help you have different builds and application variables. Please refer to [configuring Angular application environments](https://angular.dev/tools/cli/environments) for details.
- **index.html** is the HTML page served to visitors and will contain everything required to run your application. Servers should be configured to redirect every request to this page so that the Angular router can take over. Do not worry about how to add JavaScript and CSS files to it, because Angular CLI will do it automatically.
- **main.ts** bootstraps and configures Angular application to run in the browser. It is production-ready, so forget about it.
- **polyfill.ts** is where you can add polyfills if you want to [support legacy browsers](https://angular.io/guide/browser-support).
- **polyfill.ts** is where you can add polyfills if you want to [support legacy browsers](https://angular.dev/reference/versions).
- **style.scss** is the default entry point for application styles. You can change this or add new entry points in _angular.json_.
- **test.ts** helps the unit test runner discover and bootstrap spec files.
@ -106,11 +106,11 @@ Now that you know about the files and folders, we can get the application up and
<img alt="New ABP Angular project home page" src="./images/quick-start---new-project-home-page.png" width="744px" style="max-width:100%">
You may modify the behavior of the **start script** (in the package.json file) by changing the parameters passed to the `ng serve` command. For instance, if you do not want a browser window to open next time you run the script, remove `--open` from the end of it. Please check [ng serve documentation](https://angular.io/cli/serve) for all available options.
You may modify the behavior of the **start script** (in the package.json file) by changing the parameters passed to the `ng serve` command. For instance, if you do not want a browser window to open next time you run the script, remove `--open` from the end of it. Please check [ng serve documentation](https://angular.dev/cli/serve) for all available options.
### Angular Live Development Server
The development server of Angular is based on [Webpack DevServer](https://webpack.js.org/configuration/dev-server/). It tracks changes to source files and syncs the browser window after an incremental re-compilation every time <sup id="a-dev-server">[2](#f-dev-server)</sup> you make one. Your experience will be like this:
The development server runs via Angular's Application Builder and uses a fast, modern dev server under the hood. It tracks changes to source files and refreshes the browser after an incremental compilation every time <sup id="a-dev-server">[2](#f-dev-server)</sup> you make one. Your experience will be like this:
<img alt="Angular Live Development Server compiles again on template change and removes a button from the page displayed by the browser." src="./images/quick-start---angular-live-development-server.gif" width="818px" style="max-width:100%">
@ -122,13 +122,13 @@ Please keep in mind that you should not use this server in production. To provid
<sup id="f-certificate-error"><b>1</b></sup> _If you see the error above when you run the Angular app, your browser might be blocking access to the API because of the self-signed certificate. Visit that address and allow access to it (once). When you see the Swagger interface, you are good to go._ <sup>[↩](#a-certificate-error)</sup>
<sup id="f-dev-server"><b>2</b></sup> _Sometimes, depending on the file changed, Webpack may miss the change and cannot reflect it in the browser. For example, tsconfig files are not being tracked. In such a case, please restart the development server._ <sup>[↩](#a-dev-server)</sup>
<sup id="f-dev-server"><b>2</b></sup> _Sometimes, depending on the file changed, the development server may not pick up the change (for example, certain configuration files like tsconfig are not watched). In such a case, please restart the development server._ <sup>[↩](#a-dev-server)</sup>
---
## How to Build the Angular Application
An Angular application can have multiple [build targets](https://angular.io/guide/glossary#target), i.e. **configurations in angular.json** which define how [Architect](https://angular.io/guide/glossary#architect) will build applications and libraries. Usually, each build configuration has a separate environment variable file. Currently, the project has two: One for development and one for production.
An Angular application can have multiple build targets, i.e. **configurations in angular.json** which define how [Architect](https://angular.dev/reference/configs/workspace-config) will build applications and libraries. Usually, each build configuration has a separate environment variable file. Currently, the project has two: One for development and one for production.
```js
// this is what environment variables look like
@ -161,7 +161,7 @@ export const environment = {
} as Config.Environment;
```
When you run the development server, variables defined in _environment.ts_ take effect. Similarly, in production mode, the default environment is replaced by _environment.prod.ts_ and completely different variables become effective. You may even [create a new build configuration](https://angular.dev/reference/configs/workspace-config#alternate-build-configurations) and set [file replacements](https://angular.io/guide/build#configure-target-specific-file-replacements) to use a completely new environment. For now, we will start a production build:
When you run the development server, variables defined in _environment.ts_ take effect. Similarly, in production mode, the default environment is replaced by _environment.prod.ts_ and completely different variables become effective. You may even [create a new build configuration](https://angular.dev/reference/configs/workspace-config#alternate-build-configurations) and set [file replacements](https://angular.dev/tools/cli/environments) to use a completely new environment. For now, we will start a production build:
1. Open your terminal and navigate to the root Angular folder.
2. Run `yarn` or `npm install` if you have not installed dependencies already.
@ -180,18 +180,18 @@ Angular web applications run on the browser and require no server except for a [
```shell
# please replace MyProjectName with your project name
npx servor dist/MyProjectName index.html 4200 --browse
npx servor dist/MyProjectName/browser index.html 4200 --browse
```
This command will download and start a simple static server, a browser window at `http://localhost:4200` will open, and the compiled output of your project will be served.
Of course, you need your application to run on an optimized web server and become available to everyone. This is quite straight-forward:
1. Create a new static web server instance. You can use a service like [Azure App Service](https://azure.microsoft.com/en-us/services/app-service/web/), [Firebase](https://firebase.google.com/docs/hosting), [Netlify](https://www.netlify.com/), [Vercel](https://vercel.com/), or even [GitHub Pages](https://angular.io/guide/deployment#deploy-to-github-pages). Another option is maintaining own web server with [NGINX](https://www.nginx.com/), [IIS](https://www.iis.net/), [Apache HTTP Server](https://httpd.apache.org/), or equivalent.
1. Create a new static web server instance. You can use a service like [Azure App Service](https://azure.microsoft.com/en-us/services/app-service/web/), [Firebase](https://firebase.google.com/docs/hosting), [Netlify](https://www.netlify.com/), [Vercel](https://vercel.com/), or even [GitHub Pages](https://angular.dev/tools/cli/deployment). Another option is maintaining own web server with [NGINX](https://www.nginx.com/), [IIS](https://www.iis.net/), [Apache HTTP Server](https://httpd.apache.org/), or equivalent.
2. Copy the files from `dist/MyProjectName` <sup id="a-dist-folder-name">[1](#f-dist-folder-name)</sup> to a publicly served destination on the server via CLI of the service provider, SSH, or FTP (whichever is available). This step would be defined as a job if you have a CI/CD flow.
3. [Configure the server](https://angular.io/guide/deployment#server-configuration) to redirect all requests to the _index.html_ file. Some services do that automatically. Others require you [to add a file to the bundle via assets](https://angular.io/guide/workspace-config#assets-configuration) which describes the server how to do the redirections. Occasionally, you may need to do manual configuration.
3. [Configure the server](https://angular.dev/tools/cli/deployment#server-configuration) to redirect all requests to the _index.html_ file. Some services do that automatically. Others require you [to add a file to the bundle via assets](https://angular.dev/reference/configs/workspace-config) which describes the server how to do the redirections. Occasionally, you may need to do manual configuration.
In addition, you can [deploy your application to certain targets using the Angular CLI](https://angular.io/guide/deployment#automatic-deployment-with-the-cli). Here are some deploy targets:
In addition, you can [deploy your application to certain targets using the Angular CLI](https://angular.dev/tools/cli/deployment#automatic-deployment-with-the-cli). Here are some deploy targets:
- [Azure](https://github.com/Azure/ng-deploy-azure#readme)
- [Firebase](https://github.com/angular/angularfire#readme)

2
docs/en/framework/ui/angular/router-events.md

@ -7,7 +7,7 @@
# Router Events Simplified
`RouterEvents` is a utility service for filtering specific router events and reacting to them. Please see [this page in Angular docs](https://angular.io/api/router/Event) for available router events.
`RouterEvents` is a utility service for filtering specific router events and reacting to them. Please see [this page in Angular docs](https://angular.dev/api/router/Event) for available router events.
## Benefit

10
docs/en/framework/ui/angular/service-proxies.md

@ -114,7 +114,7 @@ export class BookComponent implements OnInit {
}
```
The Angular compiler removes the services that have not been injected anywhere from the final output. See the [tree-shakable providers documentation](https://angular.io/guide/dependency-injection-providers#tree-shakable-providers).
The Angular compiler removes the services that have not been injected anywhere from the final output. See the [tree-shakable providers documentation](https://angular.dev/guide/di/defining-dependency-providers).
### Models
@ -152,9 +152,11 @@ export class BookComponent implements OnInit {
<!-- simplified for sake of clarity -->
<select formControlName="genre">
<option [ngValue]="null">Select a genre</option>
<option *ngFor="let genre of genres" [ngValue]="genre.value">
{%{{{ genre.key }}}%}
</option>
@for (genre of genres; track genre.value) {
<option [ngValue]="genre.value">
{%{{{ genre.key }}}%}
</option>
}
</select>
```

280
docs/en/framework/ui/angular/ssr-configuration.md

@ -0,0 +1,280 @@
```json
//[doc-seo]
{
"Description": "Learn how to configure Server-Side Rendering (SSR) for your Angular application in the ABP Framework to improve performance and SEO."
}
```
# SSR Configuration
[Server-Side Rendering (SSR)](https://angular.io/guide/ssr) is a process that involves rendering pages on the server, resulting in initial HTML content that contains the page state. This allows the browser to show the page to the user immediately, before the JavaScript bundles are downloaded and executed.
SSR improves the **performance** (First Contentful Paint) and **SEO** (Search Engine Optimization) of your application.
## 1. Install ABP Angular SSR
The ABP Framework provides a schematic to easily add SSR support to your Angular application.
Run the following command in the root folder of your Angular application:
```shell
yarn ng generate @abp/ng.schematics:ssr-add
```
Alternatively, you can specify the project name if you have a multi-project workspace:
```shell
yarn ng generate @abp/ng.schematics:ssr-add --project MyProjectName
```
This command automates the setup process by installing necessary dependencies, creating server-side entry points, and updating your configuration files.
## 2. What Changes?
When you run the schematic, it performs the following actions:
### 2.1. Dependencies
It adds the following packages to your `package.json`:
- **express**: A minimal and flexible Node.js web application framework.
- **@types/express**: Type definitions for Express.
- **openid-client**: A library for OpenID Connect (OIDC) relying party (RP) implementation, used for authentication on the server.
```json
{
"dependencies": {
"express": "^4.18.2",
"openid-client": "^5.6.4"
},
"devDependencies": {
"@types/express": "^4.17.17"
}
}
```
**For Webpack projects only:**
- **browser-sync** (Dev dependency): Used for live reloading during development.
### 2.2. Scripts & Configuration
The changes depend on the builder used in your project (Application Builder or Webpack).
#### Application Builder (esbuild)
If your project uses the **Application Builder** (`@angular/build:application`), the schematic:
- **Scripts**: Adds `serve:ssr:project-name` to serve the SSR application.
- **angular.json**: Updates the `build` target to enable SSR (`outputMode: 'server'`) and sets the SSR entry point.
```json
{
"projects": {
"MyProjectName": {
"architect": {
"build": {
"options": {
"outputPath": "dist/MyProjectName",
"outputMode": "server",
"ssr": {
"entry": "src/server.ts"
}
}
}
}
}
}
}
```
- **tsconfig**: Updates the application's `tsconfig` to include `server.ts`.
#### Webpack Builder
If your project uses the **Webpack Builder** (`@angular-devkit/build-angular:browser`), the schematic:
- **Scripts**: Adds `dev:ssr`, `serve:ssr`, `build:ssr`, and `prerender` scripts.
- **angular.json**: Adds new targets: `server`, `serve-ssr`, and `prerender`.
- **tsconfig**: Updates the server's `tsconfig` to include `server.ts`.
### 2.3. Files
- **server.ts**: This file is the main entry point for the server-side application.
- **Standalone Projects**: Generates a server entry point compatible with `bootstrapApplication`.
- **NgModule Projects**: Generates a server entry point compatible with `platformBrowserDynamic`.
```typescript
import {
AngularNodeAppEngine,
createNodeRequestHandler,
isMainModule,
writeResponseToNodeResponse,
} from '@angular/ssr/node';
import express from 'express';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { environment } from './environments/environment';
import { ServerCookieParser } from '@abp/ng.core';
import * as oidc from 'openid-client';
// ... (OIDC configuration and setup)
const app = express();
const angularApp = new AngularNodeAppEngine();
// ... (OIDC routes: /authorize, /logout, /)
/**
* Serve static files from /browser
*/
app.use(
express.static(browserDistFolder, {
maxAge: '1y',
index: false,
redirect: false,
}),
);
/**
* Handle all other requests by rendering the Angular application.
*/
app.use((req, res, next) => {
angularApp
.handle(req)
.then(response => {
if (response) {
res.cookie('ssr-init', 'true', {...secureCookie, httpOnly: false});
return writeResponseToNodeResponse(response, res);
} else {
return next()
}
})
.catch(next);
});
// ... (Start server logic)
export const reqHandler = createNodeRequestHandler(app);
```
- **app.routes.server.ts**: Defines server-side routes and render modes (e.g., Prerender, Server, Client). This allows fine-grained control over how each route is rendered.
```typescript
import { RenderMode, ServerRoute } from '@angular/ssr';
export const serverRoutes: ServerRoute[] = [
{
path: '**',
renderMode: RenderMode.Server
}
];
```
- **app.config.server.ts**: Merges the application configuration with server-specific providers.
```typescript
import { mergeApplicationConfig, ApplicationConfig, provideAppInitializer, inject, PLATFORM_ID, TransferState } from '@angular/core';
import { isPlatformServer } from '@angular/common';
import { provideServerRendering, withRoutes } from '@angular/ssr';
import { appConfig } from './app.config';
import { serverRoutes } from './app.routes.server';
import { SSR_FLAG } from '@abp/ng.core';
const serverConfig: ApplicationConfig = {
providers: [
provideAppInitializer(() => {
const platformId = inject(PLATFORM_ID);
const transferState = inject<TransferState>(TransferState);
if (isPlatformServer(platformId)) {
transferState.set(SSR_FLAG, true);
}
}),
provideServerRendering(withRoutes(serverRoutes)),
],
};
export const config = mergeApplicationConfig(appConfig, serverConfig);
```
- **index.html**: Removes the loading spinner (`<div id="lp-page-loader"></div>`) to prevent hydration mismatches.
## 3. Running the Application
After the installation is complete, you can run your application with SSR support.
### Application Builder
To serve the application with SSR in development:
```shell
yarn start
# or
yarn ng serve
```
To serve the built application (production):
```shell
yarn run serve:ssr:project-name
```
### Webpack Builder
**Development:**
```shell
yarn run dev:ssr
```
**Production:**
```shell
yarn run build:ssr
yarn run serve:ssr
```
## 4. Authentication & SSR
The schematic installs `openid-client` to handle authentication on the server side. This ensures that when a user accesses a protected route, the server can validate their session or redirect them to the login page before rendering the content.
> Ensure your OpenID Connect configuration (in `environment.ts` or `app.config.ts`) is compatible with the server environment.
## 5. Deployment
To deploy your Angular SSR application to a production server, follow these steps:
### 5.1. Build the Application
Run the build command to generate the production artifacts:
```shell
yarn build
# or if using Webpack builder
yarn run build:ssr
```
### 5.2. Prepare Artifacts
After the build is complete, you will find the output in the `dist` folder.
For the **Application Builder**, the output structure typically looks like this:
```
dist/MyProjectName/
├── browser/ # Client-side bundles
└── server/ # Server-side bundles and entry point (server.mjs)
```
You need to copy the entire `dist/MyProjectName` folder to your server.
### 5.3. Run the Server
On your server, navigate to the folder where you copied the artifacts and run the server using Node.js:
```shell
node server/server.mjs
```
> [!TIP]
> It is recommended to use a process manager like [PM2](https://pm2.keymetrics.io/) to keep your application alive and handle restarts.
```shell
pm2 start server/server.mjs --name "my-app"
```

2
docs/en/framework/ui/angular/subscription-service.md

@ -7,7 +7,7 @@
# Managing RxJS Subscriptions
`SubscriptionService` is a utility service to provide an easy unsubscription from RxJS observables in Angular components and directives. Please see [why you should unsubscribe from observables on instance destruction](https://angular.io/guide/lifecycle-hooks#cleaning-up-on-instance-destruction).
`SubscriptionService` is a utility service to provide an easy unsubscription from RxJS observables in Angular components and directives. Please see [why you should unsubscribe from observables on instance destruction](https://angular.dev/guide/components/lifecycle).
## Getting Started

2
docs/en/framework/ui/angular/testing.md

@ -7,7 +7,7 @@
# Unit Testing Angular UI
ABP Angular UI is tested like any other Angular application. So, [the guide here](https://angular.io/guide/testing) applies to ABP too. That said, we would like to point out some **unit testing topics specific to ABP Angular applications**.
ABP Angular UI is tested like any other Angular application. So, [the guide here](https://angular.dev/guide/testing) applies to ABP too. That said, we would like to point out some **unit testing topics specific to ABP Angular applications**.
## Setup

8
docs/en/framework/ui/angular/theming.md

@ -81,8 +81,8 @@ You can run the following command in **Angular** project directory to copy the s
### Global/Component Styles
Angular can bundle global style files and component styles with components.
See the [component styles](https://angular.io/guide/component-styles) guide on Angular documentation for more information.
Angular can bundle global style files and component styles with components.
See the [component styles](https://angular.dev/guide/components/styling) guide on Angular documentation for more information.
### Layout Parts
@ -238,8 +238,10 @@ import { Router } from '@angular/router';
selector: 'abp-current-user-test',
template: `
<a class="dropdown-item pointer" (click)="data.action()">
<i *ngIf="data.textTemplate.icon" [class]="data.textTemplate.icon"></i>
@if (data.textTemplate.icon){
<i [class]="data.textTemplate.icon"></i>
{%{{{ data.textTemplate.text | abpLocalization }}}%}
}
</a>
`,
})

38
docs/en/framework/ui/angular/track-by-service.md

@ -5,9 +5,9 @@
}
```
# Easy *ngFor trackBy
# Easy @for() track
`TrackByService` is a utility service to provide an easy implementation for one of the most frequent needs in Angular templates: `TrackByFunction`. Please see [this page in Angular docs](https://angular.io/guide/template-syntax#ngfor-with-trackby) for its purpose.
`TrackByService` is a utility service to provide an easy implementation for one of the most frequent needs in Angular templates: `TrackByFunction`. Please see [this page in Angular docs](https://angular.dev/guide/templates/control-flow) for its purpose.
@ -54,8 +54,9 @@ You can use `by` to get a `TrackByFunction` that tracks the iterated object base
```html
<!-- template of DemoComponent -->
<div *ngFor="let item of list; trackBy: track.by('id')">{%{{{ item.name }}}%}</div>
@for (item of list; track: track.by('id')) {
<div>{%{{{ item.name }}}%}</div>
}
```
@ -67,11 +68,11 @@ import { trackBy } from "@abp/ng.core";
@Component({
template: `
<div
*ngFor="let item of list; trackBy: trackById"
>
{%{{{ item.name }}}%}
</div>
@for (item of list; track: trackById) {
<div>
{%{{{ item.name }}}%}
</div>
}
`,
})
class DemoComponent {
@ -89,12 +90,11 @@ You can use `byDeep` to get a `TrackByFunction` that tracks the iterated object
```html
<!-- template of DemoComponent -->
<div
*ngFor="let item of list; trackBy: track.byDeep('tenant', 'account', 'id')"
>
{%{{{ item.tenant.name }}}%}
</div>
@for (item of list; track: track.byDeep('tenant', 'account', 'id')) {
<div >
{%{{{ item.tenant.name }}}%}
</div>
}
```
@ -106,11 +106,11 @@ import { trackByDeep } from "@abp/ng.core";
@Component({
template: `
<div
*ngFor="let item of list; trackBy: trackByTenantAccountId"
>
{%{{{ item.name }}}%}
@for (item of list; track: trackByTenantAccountId) {
<div>
{%{{{ item.name }}}%}
</div>
}
`,
})
class DemoComponent {

2
docs/en/get-started/empty-aspnet-core-application.md

@ -11,7 +11,7 @@ This tutorial explains how to start ABP from scratch with minimal dependencies.
## Create a New Project
1. Create a new AspNet Core Web Application with Visual Studio 2022 (17.0.0+):
1. Create a new AspNet Core Web Application with Visual Studio 2026 (18.0.0+):
![](../images/create-new-aspnet-core-application-v2.png)

11
docs/en/get-started/layered-web-application.md

@ -22,8 +22,8 @@ In this quick start guide, you will learn how to create and run a layered (and p
First things first! Let's setup your development environment before creating the first project. The following tools should be installed on your development machine:
* [Visual Studio 2022](https://visualstudio.microsoft.com/) or another IDE that supports [.NET 9.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet){{ if UI != "Blazor" }}
* [Visual Studio 2026](https://visualstudio.microsoft.com/) or another IDE that supports [.NET 10.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [.NET 10.0+](https://dotnet.microsoft.com/en-us/download/dotnet){{ if UI != "Blazor" }}
* [Node v22.11+](https://nodejs.org/){{ end }}{{ if UI == "NG" }}
* [Yarn v1.22+ (not v2+)](https://classic.yarnpkg.com/en/docs/install) or npm v10+ (already installed with Node){{ end }}
* [Docker Desktop](https://www.docker.com/products/docker-desktop/)
@ -276,4 +276,9 @@ You can start the following application(s):
> For example in non-tiered MVC with public website application:
![solution-runner-public-website](images/solution-runner-public-website.png)
![solution-runner-public-website](images/solution-runner-public-website.png)
## What's next?
- [TODO Application Tutorial with Layered Solution](../tutorials/todo/layered/index.md)
- [Web Application Development Tutorial](../tutorials/book-store/index.md)

4
docs/en/get-started/microservice.md

@ -15,8 +15,8 @@ In this quick start guide, you will learn how to create and run a microservice s
First things first! Let's setup your development environment before creating the first project. The following tools should be installed on your development machine:
* [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) or another IDE that supports .NET development
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
* [Visual Studio 2026](https://visualstudio.microsoft.com/vs/) or another IDE that supports .NET development
* [.NET 10.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
* [Node v22.11+](https://nodejs.org/)
* [Yarn v1.22+ (not v2+)](https://classic.yarnpkg.com/en/docs/install) or npm v10+ (already installed with Node), **This is required for the Angular applications.**
* [Docker Desktop (with Kubernetes enabled)](https://www.docker.com/products/docker-desktop/)

8
docs/en/get-started/single-layer-web-application.md

@ -21,8 +21,8 @@ In this quick start guide, you will learn how to create and run a single layer w
First things first! Let's setup your development environment before creating the first project. The following tools should be installed on your development machine:
* [Visual Studio 2022](https://visualstudio.microsoft.com/) or another IDE that supports [.NET 9.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet){{ if UI != "Blazor" }}
* [Visual Studio 2026](https://visualstudio.microsoft.com/) or another IDE that supports [.NET 10.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [.NET 10.0+](https://dotnet.microsoft.com/en-us/download/dotnet){{ if UI != "Blazor" }}
* [Node v22.11+](https://nodejs.org/){{ end }}{{ if UI == "NG" }}
* [Yarn v1.22+ (not v2+)](https://classic.yarnpkg.com/en/docs/install) or npm v10+ (already installed with Node){{ end }}
@ -185,3 +185,7 @@ You can then hit *F5* or *Ctrl + F5* to run the web application. It will run and
![bookstore-browser-users-page](images/no-layers-bookstore-browser-users-page_dark.png)
You can use `admin` as username and `1q2w3E*` as default password to login to the application.
## What's next?
- [TODO Application Tutorial with Single-Layer Solution](../tutorials/todo/single-layer/index.md)

BIN
docs/en/images/elsa-studio-wasm.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

98
docs/en/modules/ai-management/index.md

@ -9,8 +9,10 @@
> You must have an ABP Team or a higher license to use this module.
This module implements AI (Artificial Intelligence) management capabilities on top of the [Artificial Intelligence Workspaces](../../framework/infrastructure/artificial-intelligence/index.md) feature of the ABP Framework and allows to manage workspaces dynamically from the application including UI components and API endpoints.
> **⚠️ Important Notice**
> The **AI Management Module** is currently in **preview**. The documentation and implementation are subject to change.
This module implements AI (Artificial Intelligence) management capabilities on top of the [Artificial Intelligence Workspaces](../../framework/infrastructure/artificial-intelligence/index.md) feature of the ABP Framework and allows to manage workspaces dynamically from the application including UI components and API endpoints.
## How to Install
@ -134,7 +136,7 @@ PreConfigure<AbpAIWorkspaceOptions>(options =>
#### Dynamic Workspaces
* **Created through the UI** or programmatically via `IWorkspaceRepository`
* **Created through the UI** or programmatically via `ApplicationWorkspaceManager` and `IWorkspaceRepository`
* **Fully manageable** - can be created, updated, activated/deactivated, and deleted
* **Stored in database** with all configuration
* **Ideal for** user-customizable AI features
@ -142,15 +144,30 @@ PreConfigure<AbpAIWorkspaceOptions>(options =>
Example (data seeding):
```csharp
var workspace = new Workspace(
name: "CustomerSupportWorkspace",
provider: "OpenAI",
modelName: "gpt-4",
apiKey: "your-api-key"
);
workspace.ApplicationName = ApplicationInfoAccessor.ApplicationName;
workspace.SystemPrompt = "You are a helpful customer support assistant.";
await _workspaceRepository.InsertAsync(workspace);
public class WorkspaceDataSeederContributor : IDataSeedContributor, ITransientDependency
{
private readonly IWorkspaceRepository _workspaceRepository;
private readonly ApplicationWorkspaceManager _applicationWorkspaceManager;
public WorkspaceDataSeederContributor(
IWorkspaceRepository workspaceRepository,
ApplicationWorkspaceManager applicationWorkspaceManager)
{
_workspaceRepository = workspaceRepository;
_applicationWorkspaceManager = applicationWorkspaceManager;
}
public async Task SeedAsync(DataSeedContext context)
{
var workspace = await _applicationWorkspaceManager.CreateAsync(
name: "CustomerSupportWorkspace",
provider: "OpenAI",
modelName: "gpt-4");
workspace.ApiKey = "your-api-key";
workspace.SystemPrompt = "You are a helpful customer support assistant.";
await _workspaceRepository.InsertAsync(workspace);
}
```
### Workspace Naming Rules
@ -176,12 +193,13 @@ The AI Management module defines the following permissions:
In addition to module-level permissions, you can restrict access to individual workspaces by setting the `RequiredPermissionName` property:
```csharp
var workspace = new Workspace(
var workspace = await _applicationWorkspaceManager.CreateAsync(
name: "PremiumWorkspace",
provider: "OpenAI",
modelName: "gpt-4",
requiredPermissionName: "MyApp.PremiumFeatures"
modelName: "gpt-4"
);
// Set a specific permission for the workspace
workspace.RequiredPermissionName = MyAppPermissions.AccessPremiumWorkspaces;
```
When a workspace has a required permission:
@ -434,6 +452,37 @@ Your application acts as a proxy, forwarding these requests to the AI Management
| **3. Client Remote** | No | Remote Service | Remote Service | No | Microservices consuming AI centrally |
| **4. Client Proxy** | No | Remote Service | Remote Service | Yes | API Gateway pattern, proxy services |
## Using Dynamic Workspace Configurations for custom requirements
The AI Management module allows you to access only configuration of a workspace without resolving pre-constructed chat client. This is useful when you want to use a workspace for your own purposes and you don't need to use the chat client.
The `IWorkspaceConfigurationStore` service is used to access the configuration of a workspace. It has multiple implementaations according to the usage scenario.
```csharp
public class MyService
{
private readonly IWorkspaceConfigurationStore _workspaceConfigurationStore;
public MyService(IWorkspaceConfigurationStore workspaceConfigurationStore)
{
_workspaceConfigurationStore = workspaceConfigurationStore;
}
public async Task DoSomethingAsync()
{
// Get the configuration of the workspace that can be managed dynamically.
var configuration = await _workspaceConfigurationStore.GetAsync("MyWorkspace");
// Do something with the configuration
var kernel = Kernel.CreateBuilder()
.AddAzureOpenAIChatClient(
config.ModelName!,
new Uri(config.ApiBaseUrl),
config.ApiKey
)
.Build();
}
}
```
## Implementing Custom AI Provider Factories
While the AI Management module provides built-in support for OpenAI through the `Volo.AIManagement.OpenAI` package, you can easily add support for other AI providers by implementing a custom `IChatClientFactory`.
@ -562,14 +611,14 @@ After implementing and registering your factory:
2. **Through Code** (data seeding):
```csharp
await _workspaceRepository.InsertAsync(new Workspace(
GuidGenerator.Create(),
"MyOllamaWorkspace",
provider: "Ollama",
modelName: "mistral",
apiBaseUrl: "http://localhost:11434",
description: "Local Ollama workspace"
));
var workspace = await _applicationWorkspaceManager.CreateAsync(
name: "MyOllamaWorkspace",
provider: "Ollama",
modelName: "mistral"
);
workspace.ApiBaseUrl = "http://localhost:11434";
workspace.Description = "Local Ollama workspace";
await _workspaceRepository.InsertAsync(workspace);
```
> **Tip**: The provider name you use in `AddFactory<TFactory>("ProviderName")` must match the provider name stored in the workspace configuration in the database.
@ -593,7 +642,7 @@ The following custom repositories are defined:
#### Domain Services
- `ApplicationWorkspaceManager`: Manages workspace operations and validations.
- `WorkspaceConfigurationStore`: Retrieves workspace configuration with caching.
- `WorkspaceConfigurationStore`: Retrieves workspace configuration with caching. Implements `IWorkspaceConfigurationStore` interface.
- `ChatClientResolver`: Resolves the appropriate `IChatClient` implementation for a workspace.
#### Integration Services
@ -622,6 +671,9 @@ Workspace configurations are cached for performance. The cache key format:
WorkspaceConfiguration:{ApplicationName}:{WorkspaceName}
```
### HttpApi Client Layer
- `IntegrationWorkspaceConfigurationStore`: Integration service for remote workspace configuration retrieval. Implements `IWorkspaceConfigurationStore` interface.
The cache is automatically invalidated when workspaces are created, updated, or deleted.
## See Also

85
docs/en/modules/elsa-pro.md

@ -1,10 +1,17 @@
```json
//[doc-seo]
{
"Description": "Integrate Elsa Workflows into your ABP applications with this Pro module. Learn installation and setup for seamless workflow management."
}
```
# Elsa Module (Pro)
> You must have an ABP Team or a higher license to use this module.
This module integrates [Elsa Workflows](https://docs.elsaworkflows.io/) into ABP Framework applications and is designed to make it easy for developers to use Elsa's capabilities within their ABP-based projects. For creating, managing, and customizing workflows themselves, please refer to [the official Elsa documentation](https://docs.elsaworkflows.io/).
## How to install
## How to Install
The Elsa module is not installed in [the startup templates](../solution-templates/layered-web-application) by default and must be installed manually. There are two ways of installing a module into your application and each one of these approaches is explained in the next sections.
@ -37,6 +44,23 @@ After adding the package references, open the module class of the project (e.g.:
> If you are using Blazor Web App, you need to add the `Volo.Elsa.Admin.Blazor.WebAssembly` package to the **{ProjectName}.Blazor.Client.csproj** project and add the `Volo.Elsa.Admin.Blazor.Server` package to the **{ProjectName}.Blazor.csproj** project.
### `AbpElsaAspNetCoreModule` and `AbpElsaIdentityModule`
These two modules generally will be added to your authentication project. Please add `Volo.Elsa.Abp.AspNetCore` and `Volo.Elsa.Abp.Identity` packages to your project and add the `AbpElsaAspNetCoreModule` and `AbpElsaIdentityModule` to the `DependsOn` attribute of your module class based on your project structure:
```xml
<PackageReference Include="Volo.Abp.Elsa.AspNetCore" Version="x.x.x" />
<PackageReference Include="Volo.Abp.Elsa.Identity" Version="x.x.x" />
```
```csharp
[DependsOn(
//...
typeof(AbpElsaAspNetCoreModule),
typeof(AbpElsaIdentityModule)
)]
```
## The Elsa Module
The Elsa Workflows has its own database provider, and also has a Tenant/Role/User system. They are under active development, so the ABP Elsa module is not yet fully integrated. Below is the current status of each module in the ABP's Elsa Module:
@ -56,6 +80,49 @@ The rest of the projects/modules are basically empty and will be implemented in
- `AbpElsaBlazorWebAssemblyModule(Volo.Elsa.Abp.Blazor.WebAssembly)`
- `AbpElsaWebModule(Volo.Elsa.Abp.Web)`
## Configure the Elsa Server
You need to configure Elsa in your ABP application to use its features. You can do that in the `ConfigureServices` method of your `YourElsaAppModule` class as shown below:
> For more information about configuring Elsa, please refer to [the official Elsa documentation](https://docs.elsaworkflows.io/).
```cs
private void ConfigureElsa(ServiceConfigurationContext context, IConfiguration configuration)
{
var connectionString = configuration.GetConnectionString("Default")!;
context.Services
.AddElsa(elsa => elsa
.UseAbpIdentity(identity => // Use UseAbpIdentity instead of UseIdentity to integrate with ABP Identity module
{
identity.TokenOptions = options => options.SigningKey = "large-signing-key-for-signing-JWT-tokens";
})
.UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseSqlServer(connectionString)))
.UseWorkflowRuntime(runtime => runtime.UseEntityFrameworkCore(ef => ef.UseSqlServer(connectionString)))
.UseScheduling()
.UseJavaScript()
.UseLiquid()
.UseCSharp()
.UseHttp(http => http.ConfigureHttpOptions = options => configuration.GetSection("Http").Bind(options))
.UseWorkflowsApi()
.AddActivitiesFrom<YourElsaAppModule>()
.AddWorkflowsFrom<YourElsaAppModule>()
);
}
```
## Elsa Database Migration
Elsa module uses its own database context and migration system, ABP Elsa module doesn't contain any `aggregate root/entity` at the moment. So, **you don't need to create any initial migration for Elsa module**. You just need to configure the Elsa Services as follows:
```cs
.UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseSqlServer(connectionString)))
.UseWorkflowRuntime(runtime => runtime.UseEntityFrameworkCore(ef => ef.UseSqlServer(connectionString)))
```
When you run your application, Elsa will create its own database tables if they do not exist.
> See [how to configure Elsa Workflows to use different database providers for persistence, including SQL Server, PostgreSQL, and MongoDB](https://docs.elsaworkflows.io/getting-started/database-configuration) for more information.
### Elsa Module Permissions
The Elsa Workflow API endpoints check permissions. Also, it has a `*` wildcard permission to allow all permissions.
@ -72,14 +139,24 @@ You can also grant parts of the permissions to a role or user. It will add the `
### Elsa Studio
Elsa Studio is an **independent** web application that allows you to design, manage, and execute workflows. It is built using **Blazor Server/WebAssembly**.
[Elsa Studio](https://docs.elsaworkflows.io/application-types/elsa-studio) is a **standalone** web application that allows you to design, manage, and execute workflows. It is built using **Blazor Server/WebAssembly**.
`ElsaDemoApp.Studio.WASM` is a sample Blazor WebAssembly project that demonstrates how to use Elsa Studio with ELSA Server with ABP Framework.
> Elsa Studio has its own layout and theme, and you can't integrate it into an ABP Blazor project for now.
![Elsa Studio](../images/elsa-studio-wasm.png)
Please check the [Elsa Workflows - Sample Workflow Demo](../samples/elsa-workflows-demo.md) document to download its source code for review.
#### Elsa Studio Authentication
Elsa Studio requires authentication and there are two ways to authenticate Elsa Studio:
* Password Flow Authentication
* Code Flow Authentication
#### Elsa Studio - Password Flow Authentication
##### Elsa Studio - Password Flow Authentication
The `AbpElsaIdentityModule(Volo.Elsa.Abp.Identity)` module is used to integrate with [ABP Identity module](./identity-pro.md) to check Elsa Studio *username* and *password* against ABP Identity.
@ -109,7 +186,7 @@ Once, you logged in to the application, you can start defining workflows, manage
![elsa-main](../images/elsa-main-page.png)
#### Elsa Studio - Code Flow Authentication
##### Elsa Studio - Code Flow Authentication
ABP applications use [OpenIddict](./openiddict-pro.md) for authentication. So, you can use the [Authorization Code Flow](https://oauth.net/2/grant-types/authorization-code/) to authenticate Elsa Studio.

3
docs/en/modules/identity-pro.md

@ -434,9 +434,10 @@ This module doesn't define any additional distributed event. See the [standard d
## See Also
* [Import External Users](./identity/import-external-users.md)
* [LDAP Login](./identity/idap.md)
* [LDAP Login](./identity/ldap.md)
* [OAuth Login](./identity/oauth-login.md)
* [Periodic Password Change (Password Aging)](./identity/periodic-password-change.md)
* [Two Factor Authentication](./identity/two-factor-authentication.md)
* [Session Management](./identity/session-management.md)
* [Password History](./identity/password-history.md)

0
docs/en/modules/identity/idap.md → docs/en/modules/identity/ldap.md

2
docs/en/release-info/migration-guides/abp-5-0-angular.md

@ -104,7 +104,7 @@ If you don't want to use the NGXS, you should remove all NGXS related imports, i
## @angular/localize package
[`@angular/localize`](https://angular.io/api/localize) dependency has been removed from `@abp/ng.core` package. The package must be installed in your app. Run the following command to install:
[`@angular/localize`](https://angular.dev/guide/i18n/add-package) dependency has been removed from `@abp/ng.core` package. The package must be installed in your app. Run the following command to install:
```bash
npm install @angular/localize@12

2
docs/en/samples/easy-crm.md

@ -30,7 +30,7 @@ When you download and open the zip file, you will see two folders:
### Server Side / MVC (Razor Pages) Application
* Open the solution (inside the aspnet-core folder) in **Visual Studio 2019** or later (or with another IDE that supports ASP.NET Core).
* Open the solution (inside the aspnet-core folder) in **Visual Studio 2026** or later (or with another IDE that supports ASP.NET Core).
* This project use `Sqlite`, the default database folder is located at appsettings (`"SqliteDbFolder": "sqliteDbs"`, this folder is located in the MVC project).
* Open the `appsettings.json` file in the `Volo.EasyCrm.Web` application and set `"UseDynamicDatabase": "false"`.
> The MVC project is creating new database for each unique visitor. And the visitor id is stored at cookies. When you set `UseDynamicDatabase` as a `true`, you cannot run Blazor & Angular projects because they have no cookie implementation. Be aware it is set as `false` for running Blazor & Angular applications.

2
docs/en/samples/microservice-demo.md

@ -60,7 +60,7 @@ To be able to run the solution from source code, following tools should be insta
### Open & Build the Visual Studio Solution
* Open the `samples\MicroserviceDemo\MicroserviceDemo.sln` in Visual Studio 2017 (15.9.0+).
* Open the `samples\MicroserviceDemo\MicroserviceDemo.sln` in Visual Studio 2026 (18.0.0+).
* Run `dotnet restore` from the command line inside the `samples\MicroserviceDemo` folder.
* Build the solution in Visual Studio.

2
docs/en/solution-templates/layered-web-application/web-applications.md

@ -120,7 +120,7 @@ The required style files are added to the `styles` array in `angular.json`. `App
You should create your tests in the same folder as the file you want to test.
See the [testing document](https://angular.io/guide/testing).
See the [testing document](https://angular.dev/guide/testing).
### Depended Packages

2
docs/en/suite/editing-templates.md

@ -27,7 +27,7 @@ There's a search box on the templates page. To find the related template, pick a
There's a naming convention for the template files.
* If the template name has `Server` prefix, it's used for backend code like repositories, application services, localizations, controllers, permissions, mappings, unit tests.
* If the template name has `Frontend.Angular` prefix, it's used for Angular code generation. The Angular code is being generated via [Angular Schematics](https://angular.io/guide/schematics).
* If the template name has `Frontend.Angular` prefix, it's used for Angular code generation. The Angular code is being generated via [Angular Schematics](https://angular.dev/tools/cli/schematics).
* If the template name has `Frontend.Mvc` prefix, it's used for razor pages, menus, JavaScript, CSS files.
* If the template name has `Frontend.Blazor` prefix, it's used for razor components.

2
docs/en/suite/generating-crud-page.md

@ -294,7 +294,7 @@ There are some adjustments you may need to make before generating CRUD pages for
- Check if your environment variables have `rootNamespace` defined as explained [here](../framework/ui/angular/service-proxies.md#angular-project-configuration).
- Check if your [workspace configuration](https://angular.io/guide/workspace-config) satisfies one of the following. Examples assume your solution namespace is `BookStore`, `Acme.BookStore`, or `Acme.Retail.BookStore`.
- Check if your [workspace configuration](https://angular.dev/reference/configs/workspace-config) satisfies one of the following. Examples assume your solution namespace is `BookStore`, `Acme.BookStore`, or `Acme.Retail.BookStore`.
- Project key is in pascal case. E.g. `BookStore`.
- Project key is in camel case. E.g. `bookStore`.
- Project key is in kebab case. E.g. `book-store`.

2
docs/en/suite/solution-structure.md

@ -303,7 +303,7 @@ Lepton theme uses two logos for each style. You can change these logos with your
You should create your tests in the same folder as the file file you want to test.
See the [testing document](https://angular.io/guide/testing).
See the [testing document](https://angular.dev/guide/testing).
### Depended Packages

4
docs/en/tutorials/book-store/part-03.md

@ -670,7 +670,7 @@ You can open your browser and click the **New book** button to see the new modal
### Create a Reactive Form
[Reactive forms](https://angular.io/guide/reactive-forms) provide a model-driven approach to handling form inputs whose values change over time.
[Reactive forms](https://angular.dev/guide/forms/reactive-forms) provide a model-driven approach to handling form inputs whose values change over time.
Open `/src/app/book/book.component.ts` and replace the content as below:
@ -742,7 +742,7 @@ export class BookComponent implements OnInit {
* Imported `FormGroup`, `FormBuilder` and `Validators` from `@angular/forms`.
* Added a `form: FormGroup` property.
* Added a `bookTypes` property as a list of `BookType` enum members. That will be used in form options.
* Injected the `FormBuilder` with the inject function. [FormBuilder](https://angular.io/api/forms/FormBuilder) provides convenient methods for generating form controls. It reduces the amount of boilerplate that is needed to build complex forms.
* Injected the `FormBuilder` with the inject function. [FormBuilder](https://angular.dev/api/forms/FormBuilder) provides convenient methods for generating form controls. It reduces the amount of boilerplate that is needed to build complex forms.
* Added a `buildForm` method at the end of the file and executed the `buildForm()` in the `createBook` method.
* Added a `save` method.

2
docs/en/tutorials/todo/layered/index.md

@ -59,7 +59,7 @@ This documentation has a video tutorial on **YouTube**!! You can watch it here:
## Pre-Requirements
* An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 9.0+](https://dotnet.microsoft.com/download/dotnet) development.
* An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 10.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [Node v20.11+](https://nodejs.org/)
{{if DB=="EF"}}
* [SQL Server Express LocalDB](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb)

2
docs/en/tutorials/todo/single-layer/index.md

@ -55,7 +55,7 @@ This documentation has a video tutorial on **YouTube**!! You can watch it here:
## Pre-Requirements
* An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 9.0+](https://dotnet.microsoft.com/download/dotnet) development.
* An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 10.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [Node v20.11+](https://nodejs.org/)
{{if DB=="EF"}}
* [SQL Server Express LocalDB](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb)

2
framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo/Abp/AspNetCore/Mvc/NewtonsoftJson/AbpAspNetCoreMvcNewtonsoftModule.cs

@ -13,7 +13,7 @@ public class AbpAspNetCoreMvcNewtonsoftModule : AbpModule
{
context.Services.AddMvcCore().AddNewtonsoftJson();
context.Services.AddOptions<MvcNewtonsoftJsonOptions>()
context.Services.AddAbpOptions<MvcNewtonsoftJsonOptions>()
.Configure<IServiceProvider>((options, rootServiceProvider) =>
{
options.SerializerSettings.ContractResolver =

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
@ -14,6 +15,8 @@ public class AbpSelectTagHelper : AbpTagHelper<AbpSelectTagHelper, AbpSelectTagH
public bool SuppressLabel { get; set; }
public Type? EnumType { get; set; }
public IEnumerable<SelectListItem>? AspItems { get; set; }
public AbpFormControlSize Size { get; set; } = AbpFormControlSize.Default;

16
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs

@ -12,6 +12,7 @@ using Microsoft.Extensions.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Extensions;
using Volo.Abp.Localization;
using Volo.Abp.Reflection;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;
@ -169,7 +170,9 @@ public class AbpSelectTagHelperService : AbpTagHelperService<AbpSelectTagHelper>
private bool IsEnum()
{
var value = TagHelper.AspFor.Model;
return (value != null && value.GetType().IsEnum) || TagHelper.AspFor.ModelExplorer.Metadata.IsEnum;
return (value != null && value.GetType().IsEnum) ||
TagHelper.AspFor.ModelExplorer.Metadata.IsEnum ||
(TagHelper.EnumType != null && TypeHelper.IsNullableEnum(TagHelper.EnumType));
}
protected virtual async Task<string> GetLabelAsHtmlAsync(TagHelperContext context, TagHelperOutput output, TagHelperOutput selectTag)
@ -258,19 +261,20 @@ public class AbpSelectTagHelperService : AbpTagHelperService<AbpSelectTagHelper>
protected virtual List<SelectListItem> GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer)
{
var enumType = TagHelper.EnumType ?? explorer.ModelType;
var selectItems = new List<SelectListItem>();
var isNullableType = Nullable.GetUnderlyingType(explorer.ModelType) != null;
var enumType = explorer.ModelType;
var isNullableType = Nullable.GetUnderlyingType(enumType!) != null;
if (isNullableType)
{
enumType = Nullable.GetUnderlyingType(explorer.ModelType)!;
enumType = Nullable.GetUnderlyingType(enumType!)!;
selectItems.Add(new SelectListItem());
}
var containerLocalizer = _tagHelperLocalizer.GetLocalizerOrNull(explorer.Container.ModelType.Assembly);
foreach (var enumValue in enumType.GetEnumValuesAsUnderlyingType())
foreach (var enumValue in enumType!.GetEnumValuesAsUnderlyingType())
{
var localizedMemberName = _abpEnumLocalizer.GetString(enumType, enumValue,
new[]
@ -306,7 +310,7 @@ public class AbpSelectTagHelperService : AbpTagHelperService<AbpSelectTagHelper>
};
var innerOutput = await labelTagHelper.ProcessAndGetOutputAsync(new TagHelperAttributeList { { "class", "form-label" } }, context, "label", TagMode.StartTagAndEndTag);
innerOutput.Content.AppendHtml(GetRequiredSymbol(context, output));
return innerOutput.Render(_encoder);

10
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/ObjectExtending/MvcUiObjectExtensionPropertyInfoExtensions.cs

@ -88,6 +88,16 @@ public static class MvcUiObjectExtensionPropertyInfoExtensions
?? "text"; //default
}
public static bool IsEnum(this ObjectExtensionPropertyInfo propertyInfo)
{
return propertyInfo.Type.IsEnum || TypeHelper.IsNullableEnum(propertyInfo.Type);
}
public static bool IsNullableEnum(this ObjectExtensionPropertyInfo propertyInfo)
{
return TypeHelper.IsNullableEnum(propertyInfo.Type);
}
private static string? GetInputTypeFromAttributeOrNull(Attribute attribute)
{
if (attribute is EmailAddressAttribute)

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs

@ -165,7 +165,7 @@ public class AbpAspNetCoreMvcModule : AbpModule
context.Services.AddSingleton<ValidationAttributeAdapterProvider>();
context.Services.TryAddEnumerable(ServiceDescriptor.Transient<IActionDescriptorProvider, AbpMvcActionDescriptorProvider>());
context.Services.AddOptions<MvcOptions>()
context.Services.AddAbpOptions<MvcOptions>()
.Configure<IServiceProvider>((mvcOptions, serviceProvider) =>
{
mvcOptions.AddAbp(context.Services);

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs

@ -13,7 +13,7 @@ public static class MvcCoreBuilderExtensions
{
public static IMvcCoreBuilder AddAbpJson(this IMvcCoreBuilder builder)
{
builder.Services.AddOptions<JsonOptions>()
builder.Services.AddAbpOptions<JsonOptions>()
.Configure<IServiceProvider>((options, rootServiceProvider) =>
{
options.JsonSerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip;

5
framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs

@ -218,6 +218,11 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions
?? typeof(TextExtensionProperty<,>); //default
}
public static bool IsEnum(this ObjectExtensionPropertyInfo propertyInfo)
{
return propertyInfo.Type.IsEnum || TypeHelper.IsNullableEnum(propertyInfo.Type);
}
private static Type? GetInputTypeFromAttributeOrNull(Attribute attribute)
{
var hasTextEditSupport = TextEditSupportedAttributeTypes.Any(t => t == attribute.GetType());

2
framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor

@ -9,7 +9,7 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
<SelectExtensionProperty PropertyInfo="@propertyInfo" Entity="@Entity" TEntity="TEntityType" TResourceType="TResourceType" LH="@LH" />
}

10
framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
@ -29,8 +30,13 @@ public partial class ExtensionProperties<TEntityType, TResourceType> : Component
public ImmutableList<ObjectExtensionPropertyInfo> Properties { get; set; } = ImmutableList<ObjectExtensionPropertyInfo>.Empty;
protected async override Task OnInitializedAsync()
protected override async Task OnInitializedAsync()
{
Properties = await ObjectExtensionManager.Instance.GetPropertiesAndCheckPolicyAsync<TEntityType>(ServiceProvider);
Properties =
(await ObjectExtensionManager.Instance.GetPropertiesAndCheckPolicyAsync<TEntityType>(ServiceProvider))
.Where(p => ModalType == ExtensionPropertyModalType.CreateModal
? p.UI.CreateModal.IsVisible
: p.UI.EditModal.IsVisible)
.ToImmutableList();
}
}

40
framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/SelectExtensionProperty.razor.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.Localization;
using System;
using Microsoft.Extensions.Localization;
using System.Collections.Generic;
using Volo.Abp.Data;
@ -7,23 +8,35 @@ namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending;
public partial class SelectExtensionProperty<TEntity, TResourceType>
where TEntity : IHasExtraProperties
{
protected List<SelectItem<int>> SelectItems = new();
protected List<SelectItem<int?>> SelectItems = new();
public int SelectedValue {
get { return Entity.GetProperty<int>(PropertyInfo.Name); }
public int? SelectedValue {
get
{
return Entity.GetProperty<int?>(PropertyInfo.Name, Nullable.GetUnderlyingType(PropertyInfo.Type!) != null ? null : 0);
}
set { Entity.SetProperty(PropertyInfo.Name, value, false); }
}
protected virtual List<SelectItem<int>> GetSelectItemsFromEnum()
protected virtual List<SelectItem<int?>> GetSelectItemsFromEnum()
{
var selectItems = new List<SelectItem<int>>();
var selectItems = new List<SelectItem<int?>>();
var isNullableType = Nullable.GetUnderlyingType(PropertyInfo.Type!) != null;
var enumType = isNullableType
? Nullable.GetUnderlyingType(PropertyInfo.Type)!
: PropertyInfo.Type;
foreach (var enumValue in PropertyInfo.Type.GetEnumValues())
if (isNullableType)
{
selectItems.Add(new SelectItem<int>
selectItems.Add(new SelectItem<int?>());
}
foreach (var enumValue in enumType.GetEnumValues())
{
selectItems.Add(new SelectItem<int?>
{
Value = (int)enumValue,
Text = AbpEnumLocalizer.GetString(PropertyInfo.Type, enumValue, new []{ StringLocalizerFactory.CreateDefaultOrNull() })
Text = AbpEnumLocalizer.GetString(enumType, enumValue, new []{ StringLocalizerFactory.CreateDefaultOrNull() })
});
}
@ -37,7 +50,14 @@ public partial class SelectExtensionProperty<TEntity, TResourceType>
if (!Entity.HasProperty(PropertyInfo.Name))
{
SelectedValue = (int)PropertyInfo.Type.GetEnumValues().GetValue(0)!;
var isNullableType = Nullable.GetUnderlyingType(PropertyInfo.Type!) != null;
if (!isNullableType)
{
var enumType = isNullableType
? Nullable.GetUnderlyingType(PropertyInfo.Type)!
: PropertyInfo.Type;
SelectedValue = (int)enumType.GetEnumValues().GetValue(0)!;
}
}
}
}

22
framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionOptionsExtensions.cs

@ -0,0 +1,22 @@
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using Volo.Abp.Options;
namespace Microsoft.Extensions.DependencyInjection;
public static class ServiceCollectionOptionsExtensions
{
/// <summary>
/// You should only use this method to register options if you need to continue using the ServiceProvider to get other options in your Options configuration method.
/// Otherwise, please use the default AddOptions method for better performance.
/// </summary>
/// <param name="services"></param>
/// <typeparam name="TOptions"></typeparam>
/// <returns></returns>
public static OptionsBuilder<TOptions> AddAbpOptions<TOptions>(this IServiceCollection services)
where TOptions : class
{
services.TryAddSingleton<IOptions<TOptions>, AbpUnnamedOptionsManager<TOptions>>();
return services.AddOptions<TOptions>();
}
}

34
framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpUnnamedOptionsManager.cs

@ -0,0 +1,34 @@
using Microsoft.Extensions.Options;
namespace Volo.Abp.Options;
/// <summary>
/// This Options manager is similar to Microsoft UnnamedOptionsManager but without the locking mechanism.
/// Prevent deadlocks when accessing options in multiple threads.
/// </summary>
/// <typeparam name="TOptions"></typeparam>
public class AbpUnnamedOptionsManager<TOptions> : IOptions<TOptions>
where TOptions : class
{
private readonly IOptionsFactory<TOptions> _factory;
private TOptions? _value;
public AbpUnnamedOptionsManager(IOptionsFactory<TOptions> factory)
{
_factory = factory;
}
public TOptions Value
{
get
{
if (_value is { } value)
{
return value;
}
_value = _factory.Create(Microsoft.Extensions.Options.Options.DefaultName);
return _value;
}
}
}

6
framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpSqliteOptions.cs

@ -0,0 +1,6 @@
namespace Volo.Abp.EntityFrameworkCore;
public class AbpSqliteOptions
{
public int? BusyTimeout { get; set; }
}

39
framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/Interceptors/SqliteBusyTimeoutSaveChangesInterceptor.cs

@ -0,0 +1,39 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
namespace Volo.Abp.EntityFrameworkCore.Interceptors;
/// <summary>
/// https://github.com/dotnet/efcore/issues/29514
/// </summary>
public class SqliteBusyTimeoutSaveChangesInterceptor : SaveChangesInterceptor
{
private readonly string _pragmaCommand;
public SqliteBusyTimeoutSaveChangesInterceptor(int timeoutMilliseconds)
{
_pragmaCommand = $"PRAGMA busy_timeout={timeoutMilliseconds};";
}
public override InterceptionResult<int> SavingChanges(DbContextEventData eventData, InterceptionResult<int> result)
{
if (eventData.Context != null)
{
eventData.Context.Database.ExecuteSqlRaw(_pragmaCommand);
}
return result;
}
public override async ValueTask<InterceptionResult<int>> SavingChangesAsync(DbContextEventData eventData, InterceptionResult<int> result, CancellationToken cancellationToken = default)
{
if (eventData.Context != null)
{
await eventData.Context.Database.ExecuteSqlRawAsync(_pragmaCommand, cancellationToken: cancellationToken);
}
return await base.SavingChangesAsync(eventData, result, cancellationToken);
}
}

22
framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/Sqlite/AbpEntityFrameworkCoreSqliteModule.cs

@ -1,4 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore.GlobalFilters;
using Volo.Abp.EntityFrameworkCore.Interceptors;
using Volo.Abp.Modularity;
namespace Volo.Abp.EntityFrameworkCore.Sqlite;
@ -8,11 +10,31 @@ namespace Volo.Abp.EntityFrameworkCore.Sqlite;
)]
public class AbpEntityFrameworkCoreSqliteModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<AbpSqliteOptions>(options =>
{
options.BusyTimeout = 5000;
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpEfCoreGlobalFilterOptions>(options =>
{
options.UseDbFunction = true;
});
var sqliteOptions = context.Services.ExecutePreConfiguredActions<AbpSqliteOptions>();
if (sqliteOptions.BusyTimeout.HasValue)
{
Configure<AbpDbContextOptions>(options =>
{
options.ConfigureDefaultOnConfiguring((dbContext, dbContextOptionsBuilder) =>
{
dbContextOptionsBuilder.AddInterceptors(new SqliteBusyTimeoutSaveChangesInterceptor(sqliteOptions.BusyTimeout.Value));
}, overrideExisting: false);
});
}
}
}

51
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContextOptions.cs

@ -26,11 +26,11 @@ public class AbpDbContextOptions
internal Dictionary<Type, List<object>> ConventionActions { get; }
internal Action<DbContext, ModelBuilder>? DefaultOnModelCreatingAction { get; set; }
internal Action<DbContext, DbContextOptionsBuilder>? DefaultOnConfiguringAction { get; set; }
internal Dictionary<Type, List<object>> OnModelCreatingActions { get; }
internal Action<DbContext, DbContextOptionsBuilder>? DefaultOnConfiguringAction { get; set; }
internal Dictionary<Type, List<object>> OnConfiguringActions { get; }
public AbpDbContextOptions()
@ -58,11 +58,18 @@ public class AbpDbContextOptions
DefaultConfigureAction = action;
}
public void ConfigureDefaultConvention([NotNull] Action<DbContext, ModelConfigurationBuilder> action)
public void ConfigureDefaultConvention([NotNull] Action<DbContext, ModelConfigurationBuilder> action, bool overrideExisting = false)
{
Check.NotNull(action, nameof(action));
DefaultConventionAction = action;
if (overrideExisting)
{
DefaultConventionAction = action;
}
else
{
DefaultConventionAction += action;
}
}
public void ConfigureConventions<TDbContext>([NotNull] Action<TDbContext, ModelConfigurationBuilder> action)
@ -83,18 +90,18 @@ public class AbpDbContextOptions
actions.Add(action);
}
public void ConfigureDefaultOnModelCreating([NotNull] Action<DbContext, ModelBuilder> action)
{
Check.NotNull(action, nameof(action));
DefaultOnModelCreatingAction = action;
}
public void ConfigureDefaultOnConfiguring([NotNull] Action<DbContext, DbContextOptionsBuilder> action)
public void ConfigureDefaultOnModelCreating([NotNull] Action<DbContext, ModelBuilder> action, bool overrideExisting = false)
{
Check.NotNull(action, nameof(action));
DefaultOnConfiguringAction = action;
if (overrideExisting)
{
DefaultOnModelCreatingAction = action;
}
else
{
DefaultOnModelCreatingAction += action;
}
}
public void ConfigureOnModelCreating<TDbContext>([NotNull] Action<TDbContext, ModelBuilder> action)
@ -114,7 +121,21 @@ public class AbpDbContextOptions
actions.Add(action);
}
public void ConfigureDefaultOnConfiguring([NotNull] Action<DbContext, DbContextOptionsBuilder> action, bool overrideExisting = false)
{
Check.NotNull(action, nameof(action));
if (overrideExisting)
{
DefaultOnConfiguringAction = action;
}
else
{
DefaultOnConfiguringAction += action;
}
}
public void ConfigureOnConfiguring<TDbContext>([NotNull] Action<TDbContext, DbContextOptionsBuilder> action)
where TDbContext : AbpDbContext<TDbContext>
{

30
framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs

@ -168,7 +168,7 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen
GetOrCreateHandlerFactories(eventType).Locking(factories => factories.Clear());
}
protected async override Task PublishToEventBusAsync(Type eventType, object eventData)
protected override async Task PublishToEventBusAsync(Type eventType, object eventData)
{
var headers = new Headers
{
@ -193,7 +193,7 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen
unitOfWork.AddOrReplaceDistributedEvent(eventRecord);
}
public async override Task PublishFromOutboxAsync(
public override async Task PublishFromOutboxAsync(
OutgoingEventInfo outgoingEvent,
OutboxConfig outboxConfig)
{
@ -206,13 +206,18 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen
headers.Add(EventBusConsts.CorrelationIdHeaderName, System.Text.Encoding.UTF8.GetBytes(outgoingEvent.GetCorrelationId()!));
}
await PublishAsync(
var result = await PublishAsync(
AbpKafkaEventBusOptions.TopicName,
outgoingEvent.EventName,
outgoingEvent.EventData,
headers
);
if (result.Status != PersistenceStatus.Persisted)
{
throw new AbpException($"Failed to publish event '{outgoingEvent.EventName}' to topic '{AbpKafkaEventBusOptions.TopicName}'. Status: {result.Status}");
}
using (CorrelationIdProvider.Change(outgoingEvent.GetCorrelationId()))
{
await TriggerDistributedEventSentAsync(new DistributedEventSent()
@ -224,7 +229,7 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen
}
}
public async override Task PublishManyFromOutboxAsync(IEnumerable<OutgoingEventInfo> outgoingEvents, OutboxConfig outboxConfig)
public override async Task PublishManyFromOutboxAsync(IEnumerable<OutgoingEventInfo> outgoingEvents, OutboxConfig outboxConfig)
{
var producer = ProducerPool.Get(AbpKafkaEventBusOptions.ConnectionName);
var outgoingEventArray = outgoingEvents.ToArray();
@ -242,7 +247,7 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen
headers.Add(EventBusConsts.CorrelationIdHeaderName, System.Text.Encoding.UTF8.GetBytes(outgoingEvent.GetCorrelationId()!));
}
producer.Produce(
var result = await producer.ProduceAsync(
AbpKafkaEventBusOptions.TopicName,
new Message<string, byte[]>
{
@ -251,6 +256,11 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen
Headers = headers
});
if (result.Status != PersistenceStatus.Persisted)
{
throw new AbpException($"Failed to publish event '{outgoingEvent.EventName}' to topic '{AbpKafkaEventBusOptions.TopicName}'. Status: {result.Status}");
}
using (CorrelationIdProvider.Change(outgoingEvent.GetCorrelationId()))
{
await TriggerDistributedEventSentAsync(new DistributedEventSent()
@ -263,7 +273,7 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen
}
}
public async override Task ProcessFromInboxAsync(
public override async Task ProcessFromInboxAsync(
IncomingEventInfo incomingEvent,
InboxConfig inboxConfig)
{
@ -290,12 +300,16 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen
return Serializer.Serialize(eventData);
}
private Task PublishAsync(string topicName, Type eventType, object eventData, Headers headers)
private async Task PublishAsync(string topicName, Type eventType, object eventData, Headers headers)
{
var eventName = EventNameAttribute.GetNameOrDefault(eventType);
var body = Serializer.Serialize(eventData);
return PublishAsync(topicName, eventName, body, headers);
var result = await PublishAsync(topicName, eventName, body, headers);
if (result.Status != PersistenceStatus.Persisted)
{
throw new AbpException($"Failed to publish event '{eventName}' to topic '{topicName}'. Status: {result.Status}");
}
}
private Task<DeliveryResult<string, byte[]>> PublishAsync(

2
framework/src/Volo.Abp.Json.Newtonsoft/Volo/Abp/Json/Newtonsoft/AbpJsonNewtonsoftModule.cs

@ -10,7 +10,7 @@ public class AbpJsonNewtonsoftModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddOptions<AbpNewtonsoftJsonSerializerOptions>()
context.Services.AddAbpOptions<AbpNewtonsoftJsonSerializerOptions>()
.Configure<IServiceProvider>((options, rootServiceProvider) =>
{
options.JsonSerializerSettings.ContractResolver = new AbpCamelCasePropertyNamesContractResolver(

2
framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpJsonSystemTextJsonModule.cs

@ -15,7 +15,7 @@ public class AbpJsonSystemTextJsonModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddOptions<AbpSystemTextJsonSerializerOptions>()
context.Services.AddAbpOptions<AbpSystemTextJsonSerializerOptions>()
.Configure<IServiceProvider>((options, rootServiceProvider) =>
{
// If the user hasn't explicitly configured the encoder, use the less strict encoder that does not encode all non-ASCII characters.

18
framework/src/Volo.Abp.Kafka/Volo/Abp/Kafka/ProducerPool.cs

@ -17,7 +17,7 @@ public class ProducerPool : IProducerPool, ISingletonDependency
protected ConcurrentDictionary<string, Lazy<IProducer<string, byte[]>>> Producers { get; }
protected TimeSpan TotalDisposeWaitDuration { get; set; } = TimeSpan.FromSeconds(10);
protected TimeSpan DefaultTransactionsWaitDuration { get; set; } = TimeSpan.FromSeconds(30);
public ILogger<ProducerPool> Logger { get; set; }
@ -41,8 +41,10 @@ public class ProducerPool : IProducerPool, ISingletonDependency
{
var producerConfig = new ProducerConfig(Options.Connections.GetOrDefault(connection).ToDictionary(k => k.Key, v => v.Value));
Options.ConfigureProducer?.Invoke(producerConfig);
producerConfig.Acks ??= Acks.All;
producerConfig.EnableIdempotence ??= true;
return new ProducerBuilder<string, byte[]>(producerConfig).Build();
})).Value;
}
@ -70,7 +72,7 @@ public class ProducerPool : IProducerPool, ISingletonDependency
foreach (var producer in Producers.Values)
{
var poolItemDisposeStopwatch = Stopwatch.StartNew();
try
{
producer.Value.Dispose();
@ -78,19 +80,19 @@ public class ProducerPool : IProducerPool, ISingletonDependency
catch
{
}
poolItemDisposeStopwatch.Stop();
remainingWaitDuration = remainingWaitDuration > poolItemDisposeStopwatch.Elapsed
? remainingWaitDuration.Subtract(poolItemDisposeStopwatch.Elapsed)
: TimeSpan.Zero;
}
poolDisposeStopwatch.Stop();
Logger.LogInformation(
$"Disposed Kafka Producer Pool ({Producers.Count} producers in {poolDisposeStopwatch.Elapsed.TotalMilliseconds:0.00} ms).");
if (poolDisposeStopwatch.Elapsed.TotalSeconds > 5.0)
{
Logger.LogWarning(

5
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ExtensionPropertyUiFormConfiguration.cs

@ -6,4 +6,9 @@ public class ExtensionPropertyUiFormConfiguration
/// Default: true.
/// </summary>
public bool IsVisible { get; set; } = true;
/// <summary>
/// Default: false.
/// </summary>
public bool IsReadOnly { get; set; } = false;
}

4
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs

@ -175,6 +175,10 @@ public static class ModuleExtensionConfigurationHelper
property.DefaultValueFactory = propertyConfig.DefaultValueFactory;
property.Lookup = propertyConfig.UI.Lookup;
property.UI.Order = propertyConfig.UI.Order;
property.UI.CreateModal.IsVisible = propertyConfig.UI.OnCreateForm.IsVisible;
property.UI.CreateModal.IsReadOnly = propertyConfig.UI.OnCreateForm.IsReadOnly;
property.UI.EditModal.IsVisible = propertyConfig.UI.OnEditForm.IsVisible;
property.UI.EditModal.IsReadOnly = propertyConfig.UI.OnEditForm.IsReadOnly;
property.Policy = propertyConfig.Policy;
foreach (var configuration in propertyConfig.Configuration)
{

18
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ObjectExtensionPropertyInfo.cs

@ -90,16 +90,34 @@ public class ObjectExtensionPropertyInfo : IHasNameWithLocalizableDisplayName, I
{
public int Order { get; set; }
public ExtensionPropertyUICreateModal CreateModal { get; set; }
public ExtensionPropertyUIEditModal EditModal { get; set; }
public ExtensionPropertyUI()
{
CreateModal = new ExtensionPropertyUICreateModal();
EditModal = new ExtensionPropertyUIEditModal();
}
}
public class ExtensionPropertyUICreateModal
{
/// <summary>
/// Default: true.
/// </summary>
public bool IsVisible { get; set; } = true;
public bool IsReadOnly { get; set; }
}
public class ExtensionPropertyUIEditModal
{
/// <summary>
/// Default: true.
/// </summary>
public bool IsVisible { get; set; } = true;
public bool IsReadOnly { get; set; }
}
}

39
framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;
using Swashbuckle.AspNetCore.SwaggerUI;
using Volo.Abp.Content;
@ -21,7 +21,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions
{
Func<OpenApiSchema> remoteStreamContentSchemaFactory = () => new OpenApiSchema()
{
Type = "string",
Type = JsonSchemaType.String,
Format = "binary"
};
@ -42,7 +42,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions
{
var authorizationUrl = new Uri($"{authority.TrimEnd('/')}{authorizationEndpoint.EnsureStartsWith('/')}");
var tokenUrl = new Uri($"{authority.TrimEnd('/')}{tokenEndpoint.EnsureStartsWith('/')}");
return services
.AddAbpSwaggerGen()
.AddSwaggerGen(
@ -62,19 +62,9 @@ public static class AbpSwaggerGenServiceCollectionExtensions
}
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
options.AddSecurityRequirement(document => new OpenApiSecurityRequirement()
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "oauth2"
}
},
Array.Empty<string>()
}
[new OpenApiSecuritySchemeReference("oauth2", document)] = []
});
setupAction?.Invoke(options);
@ -100,7 +90,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions
swaggerUiOptions.ConfigObject.AdditionalItems["oidcSupportedScopes"] = scopes;
swaggerUiOptions.ConfigObject.AdditionalItems["oidcDiscoveryEndpoint"] = discoveryUrl;
});
return services
.AddAbpSwaggerGen()
.AddSwaggerGen(
@ -112,24 +102,15 @@ public static class AbpSwaggerGenServiceCollectionExtensions
OpenIdConnectUrl = new Uri(RemoveTenantPlaceholders(discoveryUrl))
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
options.AddSecurityRequirement(document => new OpenApiSecurityRequirement()
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "oidc"
}
},
Array.Empty<string>()
}
[new OpenApiSecuritySchemeReference("oauth2", document)] = []
});
setupAction?.Invoke(options);
});
}
private static string RemoveTenantPlaceholders(string url)
{
return url

20
framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;
namespace Volo.Abp.Swashbuckle;
@ -13,7 +13,7 @@ public class AbpSwashbuckleDocumentFilter : IDocumentFilter
protected virtual string[] ActionUrlPrefixes { get; set; } = new[] { "Volo." };
protected virtual string RegexConstraintPattern => @":regex\(([^()]*)\)";
public virtual void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
{
var actionUrls = context.ApiDescriptions
@ -28,6 +28,20 @@ public class AbpSwashbuckleDocumentFilter : IDocumentFilter
swaggerDoc
.Paths
.RemoveAll(path => !actionUrls.Contains(path.Key));
var tags = new List<string>();
foreach (var path in swaggerDoc.Paths)
{
if (path.Value.Operations != null)
{
tags.AddRange(path.Value.Operations.SelectMany(x =>
{
return x.Value.Tags?.Select(t => t.Name ?? string.Empty) ?? Array.Empty<string>();
}));
}
}
tags = tags.Distinct().ToList();
swaggerDoc.Tags?.RemoveAll(tag => tag.Name == null || !tags.Contains(tag.Name));
}
protected virtual string? RemoveRouteParameterConstraints(ActionDescriptor actionDescriptor)
@ -49,7 +63,7 @@ public class AbpSwashbuckleDocumentFilter : IDocumentFilter
{
break;
}
route = route.Remove(startIndex, (endIndex - startIndex));
}

18
framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleEnumSchemaFilter.cs

@ -1,22 +1,22 @@
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using System;
using System.Text.Json.Nodes;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
namespace Volo.Abp.Swashbuckle;
public class AbpSwashbuckleEnumSchemaFilter : ISchemaFilter
{
public void Apply(OpenApiSchema schema, SchemaFilterContext context)
public void Apply(IOpenApiSchema schema, SchemaFilterContext context)
{
if (context.Type.IsEnum)
if (schema is OpenApiSchema openApiScheme && context.Type.IsEnum)
{
schema.Enum.Clear();
schema.Type = "string";
schema.Format = null;
openApiScheme.Enum?.Clear();
openApiScheme.Type = JsonSchemaType.String;
openApiScheme.Format = null;
foreach (var name in Enum.GetNames(context.Type))
{
schema.Enum.Add(new OpenApiString($"{name}"));
openApiScheme.Enum?.Add(JsonNode.Parse($"\"{name}\"")!);
}
}
}

1
framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreTestModule.cs

@ -30,6 +30,7 @@ public class AbpEntityFrameworkCoreTestModule : AbpModule
public override void PreConfigureServices(ServiceConfigurationContext context)
{
TestEntityExtensionConfigurator.Configure();
PreConfigure<AbpSqliteOptions>(x => x.BusyTimeout = null);
}
public override void ConfigureServices(ServiceConfigurationContext context)

4
framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestModule.cs

@ -19,7 +19,7 @@ public class AbpJsonSystemTextJsonTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddOptions<AbpSystemTextJsonSerializerOptions>()
context.Services.AddAbpOptions<AbpSystemTextJsonSerializerOptions>()
.Configure<IServiceProvider>((options, rootServiceProvider) =>
{
if (options.JsonSerializerOptions.TypeInfoResolver != null)
@ -43,7 +43,7 @@ public class AbpJsonNewtonsoftTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddOptions<AbpNewtonsoftJsonSerializerOptions>()
context.Services.AddAbpOptions<AbpNewtonsoftJsonSerializerOptions>()
.Configure<IServiceProvider>((options, rootServiceProvider) =>
{
options.JsonSerializerSettings.ContractResolver = new AbpCamelCasePropertyNamesContractResolver(

2
framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/AbpMemoryDbTestModule.cs

@ -34,7 +34,7 @@ public class AbpMemoryDbTestModule : AbpModule
options.AddRepository<City, CityRepository>();
});
context.Services.AddOptions<Utf8JsonMemoryDbSerializerOptions>()
context.Services.AddAbpOptions<Utf8JsonMemoryDbSerializerOptions>()
.Configure<IServiceProvider>((options, rootServiceProvider) =>
{
options.JsonSerializerOptions.Converters.Add(new EntityJsonConverter<EntityWithIntPk, int>());

18
latest-versions.json

@ -1,4 +1,22 @@
[
{
"version": "9.3.7",
"releaseDate": "",
"type": "stable",
"message": "",
"leptonx": {
"version": "4.3.7"
}
},
{
"version": "10.0.1",
"releaseDate": "",
"type": "stable",
"message": "",
"leptonx": {
"version": "5.0.1"
}
},
{
"version": "10.0.0",
"releaseDate": "",

5
modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.abppkg.analyze.json

@ -24,6 +24,11 @@
"declaringAssemblyName": "Volo.Abp.Emailing",
"namespace": "Volo.Abp.Emailing",
"name": "AbpEmailingModule"
},
{
"declaringAssemblyName": "Volo.Abp.Mapperly",
"namespace": "Volo.Abp.Mapperly",
"name": "AbpMapperlyModule"
}
],
"implementingInterfaces": [

2
modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor

@ -78,7 +78,7 @@
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
<SelectExtensionProperty PropertyInfo="@propertyInfo" Entity="@PersonalInfoModel" TEntity="PersonalInfoModel" TResourceType="AccountResource" LH="@LH" />
}

6
modules/account/src/Volo.Abp.Account.Blazor/Volo.Abp.Account.Blazor.abppkg.analyze.json

@ -11,9 +11,9 @@
"name": "AbpAspNetCoreComponentsWebThemingModule"
},
{
"declaringAssemblyName": "Volo.Abp.AutoMapper",
"namespace": "Volo.Abp.AutoMapper",
"name": "AbpAutoMapperModule"
"declaringAssemblyName": "Volo.Abp.Mapperly",
"namespace": "Volo.Abp.Mapperly",
"name": "AbpMapperlyModule"
},
{
"declaringAssemblyName": "Volo.Abp.Account.Application.Contracts",

5
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml

@ -60,13 +60,14 @@
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
name="ExtraProperties.@propertyInfo.Name"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"

6
modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.abppkg.analyze.json

@ -16,9 +16,9 @@
"name": "AbpIdentityAspNetCoreModule"
},
{
"declaringAssemblyName": "Volo.Abp.AutoMapper",
"namespace": "Volo.Abp.AutoMapper",
"name": "AbpAutoMapperModule"
"declaringAssemblyName": "Volo.Abp.Mapperly",
"namespace": "Volo.Abp.Mapperly",
"name": "AbpMapperlyModule"
},
{
"declaringAssemblyName": "Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared",

5
modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingEntityFrameworkCoreTestModule.cs

@ -16,6 +16,11 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore;
)]
public class AbpAuditLoggingEntityFrameworkCoreTestModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<AbpSqliteOptions>(x => x.BusyTimeout = null);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var sqliteConnection = CreateDatabaseAndGetConnection();

2
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs

@ -1,9 +1,11 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.BackgroundJobs.DemoApp.Shared.Jobs;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.BackgroundJobs.DemoApp.Shared
{
[DependsOn(typeof(AbpMultiTenancyModule))]
public class DemoAppSharedModule : AbpModule
{
public override void OnPostApplicationInitialization(ApplicationInitializationContext context)

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save