Tech Stack and Dependencies
Files Referenced in this Document
- CMS.Plugin.MyPluginName.csproj
- CMS.Plugin.MyPluginName.EntityFrameworkCore.csproj
- CMS.Plugin.MyPluginName.Application.csproj
- CMS.Plugin.MyPluginName.Domain.csproj
- CMS.Plugin.MyPluginName.Abstractions.csproj
- CMSPluginModule.cs
- CMSPluginEntityFrameworkCoreModule.cs
- common.props
Table of Contents
- Introduction
- Project Structure Overview
- Core Tech Stack Analysis
- Role of ABP Framework in Modularity and DI
- Entity Framework Core Data Access Implementation
- Integration Mechanism with Autofac and IOC Container
- WebApiClient External HTTP Call Capability
- MiniExcelLibs Support for Excel Import/Export
- Dependency Graph Between Modules
- Technical Collaboration and DDD Layered Architecture Support
- Version Information and Responsibility of Main Dependency Libraries
- Conclusion
Introduction
This project is a CMS plugin template based on the C# .NET platform, adopting Domain-Driven Design (DDD) layered architecture. The system utilizes the ABP Framework to implement modular organization, dependency injection, and background job scheduling, combines Entity Framework Core for data persistence operations, and uses WebApiClientCore to implement external service calls. Simultaneously, the project supports Excel file import and export functions via MiniExcelLibs. This document aims to detailedly explain the core technology stack and its collaborative mechanism relied upon by the project, helping developers understand the overall technical ecosystem.
Project Structure Overview
The project adopts a typical layered architecture design, containing multiple independent project modules, each assuming different responsibilities:
- CMS.Plugin.MyPluginName.Abstractions: Defines plugin public interfaces and abstract types
- CMS.Plugin.MyPluginName.Domain: Implements domain models and business logic
- CMS.Plugin.MyPluginName.Application: Application service layer, coordinating domain objects to complete use cases
- CMS.Plugin.MyPluginName.EntityFrameworkCore: EF Core data access implementation
- CMS.Plugin.MyPluginName: Main plugin project, integrating all modules and providing runtime entry
- Database Adapter Layer: Supports MySQL, PostgreSQL, and SQL Server respectively
This structure clearly reflects the layering principles of DDD, with loose coupling communication between layers through interfaces and dependency injection.
Diagram sources
- CMS.Plugin.MyPluginName.csproj
- CMS.Plugin.MyPluginName.Application.csproj
- CMS.Plugin.MyPluginName.Domain.csproj
- CMS.Plugin.MyPluginName.EntityFrameworkCore.csproj
- CMS.Plugin.MyPluginName.Abstractions.csproj
Core Tech Stack Analysis
This project is built based on .NET 6, using the ABP Framework as the core development framework to implement enterprise-level functions such as modularity, dependency injection, background jobs, caching, and settings management. It achieves separation of concerns through a multi-project structure, conforming to the DDD layered architecture concept.
The project uses net6.0 as the target framework, ensuring support for modern C# language features and a high-performance runtime environment. Each project manages versioning and build configuration uniformly through .props files, ensuring dependency consistency.
Section sources
Role of ABP Framework in Modularity and DI
The ABP Framework is the core infrastructure framework of this project, providing modular architecture support. By declaring module dependencies via the [DependsOn] attribute, automated module loading and configuration are achieved.
In CMSPluginModule, dependencies on the following modules are declared by inheriting AbpStartupModule and using the [DependsOn] attribute:
CMSPluginAbpModule: Basic ABP functionsCMSPluginAbpAspNetCoreModule: ASP.NET Core integrationCMSPluginApplicationModule: Application layer moduleCMSPluginEntityFrameworkCoreModule: EF Core module
ABP's dependency injection system is based on Microsoft.Extensions.DependencyInjection but enhanced to support module-level service registration and configuration. By overriding the ConfigureServices method, services can be registered or configurations modified during module initialization.
Additionally, ABP provides a background job system. This project configures the MyPluginNameJob background job task in CMSPluginModule via AbpBackgroundJobOptions, implementing timed or delayed execution of business logic processing capabilities.
Diagram sources
Entity Framework Core Data Access Implementation
Entity Framework Core serves as the main ORM framework of this project, responsible for mapping between domain models and databases and data persistence operations. The project implements EF Core integration via the CMS.Plugin.MyPluginName.EntityFrameworkCore project.
The CMSPluginEntityFrameworkCoreModule module depends on CMSPluginDomainModule and AbpEntityFrameworkCoreModule, realizing the connection between the domain layer and data access layer. By overriding the PreConfigureServices method and calling CMSPluginEfCoreEntityExtensionMappings.Configure(), entity mapping configuration is performed, supporting flexible entity extension mechanisms.
The project adopts the Code First mode. Domain entities are defined in the CMS.Plugin.MyPluginName.Domain project, and the data context contract is defined via the ICMSPluginDbContext interface. Concrete implementation is provided by database adapter projects (such as MySQL, PostgreSQL, SQL Server).
Section sources
Integration Mechanism with Autofac and IOC Container
Although the project primarily uses the ABP framework's built-in dependency injection mechanism (based on Microsoft.Extensions.DependencyInjection), the ABP framework itself supports integration with Autofac. ABP automatically detects the existence of an Autofac container at startup and uses Autofac as the underlying IOC container if present.
Although this project does not explicitly reference the Autofac package, through the extensible design of the ABP framework, the possibility of future integration with Autofac is retained. ABP's modular system allows service registration in modules via PreConfigureServices and ConfigureServices methods, and these registrations will ultimately be mapped to the actual IOC container.
This design provides flexibility: using lightweight native DI in most scenarios, while seamlessly switching to Autofac when advanced functions (such as property injection, sub-containers, dynamic proxies, etc.) are needed.
WebApiClient External HTTP Call Capability
The project implements calls to external HTTP services via the WebApiClientCore package (version 2.0.4). WebApiClient is a declarative HTTP client library based on .NET Standard, allowing RESTful APIs to be described by defining interfaces without writing specific HTTP call code.
The IMyPluginNameExternalApi interface is defined in the CMS.Plugin.MyPluginName.Abstractions project, describing the contract of the external API. At runtime, WebApiClient automatically generates implementation classes to handle details such as HTTP request serialization, deserialization, and error handling.
This approach greatly simplifies the development work of external service calls, improving code testability and maintainability, conforming to the Dependency Inversion Principle.
Section sources
MiniExcelLibs Support for Excel Import/Export
The project includes the Excel template file MyEntityName导出模板.xlsx via embedded resources, indicating the existence of Excel import/export requirements. Although the MiniExcelLibs package is not directly referenced in the project file, based on naming conventions and industry practices, such functions are usually implemented by MiniExcel or similar libraries.
MiniExcel is a lightweight .NET Excel operation library supporting read/write operations of Excel files without installing Office. It is particularly suitable for processing large data imports and exports on the server side, featuring low memory usage and high performance.
Typical usage scenarios include:
- Exporting data from Excel templates
- Batch importing Excel data into the system
- Generating report files
Section sources
Dependency Graph Between Modules
A clear dependency graph is formed between project modules, reflecting the design principles of layered architecture:
Diagram sources
- CMS.Plugin.MyPluginName.csproj
- CMS.Plugin.MyPluginName.Application.csproj
- CMS.Plugin.MyPluginName.Domain.csproj
- CMS.Plugin.MyPluginName.EntityFrameworkCore.csproj
- CMS.Plugin.MyPluginName.Abstractions.csproj
Technical Collaboration and DDD Layered Architecture Support
The technology stack of this project works collaboratively to support the implementation of DDD layered architecture:
- Presentation Layer (CMS.Plugin.MyPluginName): Provides Web API interfaces via ABP's ASP.NET Core integration
- Application Layer (Application): Uses ABP's Application module to coordinate domain objects to complete use cases
- Domain Layer (Domain): Implements domain models and business rules via ABP's Domain module
- Infrastructure Layer (EntityFrameworkCore): Implements data persistence using EF Core
ABP Framework acts as a glue, connecting layers through dependency injection. WebApiClient implements calls to external systems by domain services, and MiniExcelLibs supports batch import/export of value objects. The entire technology stack revolves around the domain model, ensuring the core status of business logic.
Version Information and Responsibility of Main Dependency Libraries
| Library | Version | Responsibility |
|---|---|---|
| Volo.Abp.* | $(ABPPackageVersion) | ABP Framework core modules, providing modularity, DI, background jobs, caching, etc. |
| CMS.Framework.AspNetCore | 2.16.1 | CMS Framework ASP.NET Core integration |
| CMS.Extensions.Abp | 1.4.0 | CMS extensions for ABP functions |
| WebApiClientCore | 2.0.4 | Declarative HTTP client for external API calls |
| .NET SDK | net6.0 | Basic runtime environment |
Section sources
- CMS.Plugin.MyPluginName.csproj
- CMS.Plugin.MyPluginName.EntityFrameworkCore.csproj
- CMS.Plugin.MyPluginName.Application.csproj
- CMS.Plugin.MyPluginName.Domain.csproj
Conclusion
This project builds a modern plugin architecture based on the C# .NET platform, using the ABP Framework as the core framework to implement enterprise-level functions such as modularity, dependency injection, and background jobs. Through layered design and clear dependency relationships, it supports the implementation of DDD architecture. The components of the technology stack work together, ensuring system maintainability and extensibility while providing rich functional support. Developers can quickly build CMS plugin applications conforming to enterprise standards based on this template.