Skip to main content
Version: Next

Plugin Mechanism and Extensions

1. Overview​

The plugin mechanism of the system allows developers to extend system functionality in a loosely coupled manner. Through standard interfaces and dynamic loading technologies, the system can identify and activate external components at runtime.

2. Architecture Design​

  • Host: The main application responsible for initializing the environment, loading plugins, and providing core services.
  • Plugin Interface (Contract): Shared libraries defining the interaction standards between plugins and the host.
  • Plugin Implementation: Separate assemblies containing concrete business logic or functional extensions.

3. Plugin Lifecycle​

  1. Discovery: The host scans the specified path.
  2. Loading: Loads the assembly into memory.
  3. Registration: Registers services in the IoC container and executes the Module ConfigureServices method.
  4. Initialization: Executes the Module OnApplicationInitialization method.
  5. Running: The plugin services interact with the host.
  6. Unloading: (Optional) Release resources when the application stops.

4. Extension Points​

4.1 API Extensions​

Plugins can contain independent Controllers, and the system automatically discovers and registers routes.

4.2 UI Extensions​

If the frontend also supports modularity, backend plugins can serve static resources or provide UI configuration data.

4.3 Background Task Extensions​

Plugins can register their own background worker threads (BackgroundWorker).

4.4 Event Handling​

Plugins can subscribe to events published by the host (EventBus) to perform decoupled business logic.

5. Development Guidelines​

  1. Create Plugin Project: Create a new Class Library project.
  2. Add Dependencies: Reference Lmes.Core or related Contract projects.
  3. Define Module: Create a class inheriting from AbpModule.
  4. Implement Features: Write Services, Controllers, etc.
  5. Build and Deploy: Compile the generated DLL and place it in the host's Plugin directory.

6. Security Isolation​

  • Plugins operate within the same process as the host.
  • Be cautious of malicious plugins affecting system stability.
  • It is recommended to strictly review plugin sources in production environments.