ScheduleTaskHelper.Plugins 1.0.7

dotnet add package ScheduleTaskHelper.Plugins --version 1.0.7
                    
NuGet\Install-Package ScheduleTaskHelper.Plugins -Version 1.0.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ScheduleTaskHelper.Plugins" Version="1.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ScheduleTaskHelper.Plugins" Version="1.0.7" />
                    
Directory.Packages.props
<PackageReference Include="ScheduleTaskHelper.Plugins" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ScheduleTaskHelper.Plugins --version 1.0.7
                    
#r "nuget: ScheduleTaskHelper.Plugins, 1.0.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ScheduleTaskHelper.Plugins@1.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ScheduleTaskHelper.Plugins&version=1.0.7
                    
Install as a Cake Addin
#tool nuget:?package=ScheduleTaskHelper.Plugins&version=1.0.7
                    
Install as a Cake Tool

ScheduleTaskHelper.Plugins

?? Overview

ScheduleTaskHelper.Plugins is a plugin-based architecture framework designed for .NET applications. It provides dynamic loading and management of external plugins, enabling developers to extend functionality without modifying the core application. This framework supports plugin initialization, service registration, task management, and graceful unloading, making it ideal for applications requiring high modularity and extensibility.

??? Key Features

  • Dynamic Plugin Loading: Load and manage plugins dynamically at runtime.
  • Task Scheduling: Support for scheduled and cron-based tasks.
  • Dependency Injection: Seamless integration with .NET's DI container.
  • Extensibility: Easily extend the application by adding new plugins.
  • Task Metadata: Define and manage task metadata, including descriptions, parameters, and execution settings.
  • Graceful Shutdown: Ensure proper resource cleanup when unloading plugins.

??? Architecture

Core Components

1. Plugin Interface (IPlugin)

Defines the contract for all plugins, including methods for initialization, service registration, task retrieval, and shutdown.

public interface IPlugin
{
    IPluginMetadata Metadata { get; }
    Task<bool> InitializeAsync(IServiceCollection services);
    void RegisterServices(IServiceCollection services);
    IEnumerable<PluginTaskInfo> GetAvailableTasks();
    Task ShutdownAsync();
}
2. Base Plugin (BasePlugin)

Provides a default implementation of the IPlugin interface, simplifying plugin development.

3. Plugin Metadata (IPluginMetadata)

Stores metadata about a plugin, such as its ID, name, version, author, and description.

4. Plugin Task Info (PluginTaskInfo)

Encapsulates information about tasks provided by a plugin, including task type, ID, description, and default parameters.

5. Plugin Configuration (PluginConfiguration)

Manages plugin and task configurations, including enabling/disabling plugins and defining task parameters.

6. Plugin Loader (PluginLoader)

Handles the discovery, loading, and management of plugins.

?? Configuration

Plugin Configuration File (pluginconfig.json)

Defines the enabled plugins and their task configurations.

{
  "EnabledPlugins": [
    "SamplePlugin"
  ],
  "TaskConfigurations": {
    "SampleTask": {
      "Enabled": true,
      "Group": "SampleTasks",
      "Priority": 1,
      "InitialDelay": "00:00:10",
      "Period": "00:05:00"
    },
    "SampleCronTask": {
      "Enabled": true,
      "Group": "SampleTasks",
      "CronExpression": "0 */5 * * * *",
      "ExecuteImmediately": true
    }
  }
}

Key Configuration Fields

  • EnabledPlugins: List of plugin IDs to load.
  • TaskConfigurations: Defines task-specific settings, such as schedule, priority, and parameters.

?? Getting Started

1. Create a Plugin

Implement the IPlugin interface or extend the BasePlugin class to create a new plugin.

public class SamplePlugin : BasePlugin
{
    public override IPluginMetadata Metadata => new PluginMetadata(
        id: "SamplePlugin",
        name: "Sample Plugin",
        version: "1.0.0",
        author: "Your Name",
        description: "A sample plugin demonstrating the plugin architecture."
    );

    public override IEnumerable<PluginTaskInfo> GetAvailableTasks()
    {
        yield return new PluginTaskInfo
        {
            TaskType = typeof(SampleTask),
            TaskId = "SampleTask",
            DisplayName = "Sample Task",
            Description = "A sample task provided by the Sample Plugin.",
            EnabledByDefault = true
        };
    }
}

2. Register Plugin Services

Override the RegisterServices method to register services required by the plugin.

public override void RegisterServices(IServiceCollection services)
{
    services.AddSingleton<ISampleService, SampleService>();
}

3. Load Plugins

Use the PluginLoader to discover and load plugins dynamically.

var pluginLoader = new PluginLoader();
await pluginLoader.LoadPluginsAsync();

?? API Documentation

Plugin Metadata (IPluginMetadata)

  • Id: Unique identifier for the plugin.
  • Name: Display name of the plugin.
  • Version: Plugin version.
  • Author: Plugin author.
  • Description: Description of the plugin.

Plugin Task Info (PluginTaskInfo)

  • TaskType: Type of the task (must implement IScheduledTask or ICronScheduledTask).
  • TaskId: Unique identifier for the task.
  • DisplayName: Display name of the task.
  • Description: Description of the task.
  • DefaultParameters: Default parameters for the task.
  • EnabledByDefault: Indicates if the task is enabled by default.

?? License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ScheduleTaskHelper.Plugins:

Package Downloads
ScheduleTaskHelper.Core

ScheduleTaskHelper 是一個功能強大的任務排程與執行框架,專為 .NET 應用程式設計。它支援多種任務排程模式(包括定時與 Cron 表達式),並整合了分散式鎖機制、任務重試佇列與事件驅動架構,確保任務執行的可靠性與高效性。此外,該框架支援插件式架構,允許動態載入外部插件,適合用於分散式系統或需要高效任務管理的應用場景。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.7 130 8/20/2025
1.0.6 124 8/20/2025
1.0.5 133 8/20/2025
1.0.4 125 8/20/2025
1.0.3 125 8/20/2025
1.0.2 122 8/20/2025
1.0.1 125 8/20/2025
1.0.0 137 8/20/2025