Sparkdo.BackgroundJobs.Abstractions 1.0.2

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Sparkdo.BackgroundJobs.Abstractions --version 1.0.2
                    
NuGet\Install-Package Sparkdo.BackgroundJobs.Abstractions -Version 1.0.2
                    
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="Sparkdo.BackgroundJobs.Abstractions" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sparkdo.BackgroundJobs.Abstractions" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Sparkdo.BackgroundJobs.Abstractions" />
                    
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 Sparkdo.BackgroundJobs.Abstractions --version 1.0.2
                    
#r "nuget: Sparkdo.BackgroundJobs.Abstractions, 1.0.2"
                    
#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 Sparkdo.BackgroundJobs.Abstractions@1.0.2
                    
#: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=Sparkdo.BackgroundJobs.Abstractions&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Sparkdo.BackgroundJobs.Abstractions&version=1.0.2
                    
Install as a Cake Tool

Sparkdo.BackgroundJobs.Abstractions

Sparkdo 后台作业抽象库,定义后台任务调度和执行的核心接口和基础类型。

功能特性

  • 定义后台作业核心接口(同步和异步)
  • 提供后台作业配置和管理基础类型
  • 支持作业优先级设置
  • 支持作业执行上下文管理
  • 与 Sparkdo 框架无缝集成

安装

<PackageReference Include="Sparkdo.BackgroundJobs.Abstractions" Version="x.x.x" />

核心接口

IBackgroundJob<TArgs>

同步后台作业接口,定义了同步执行的后台作业:

public interface IBackgroundJob<in TArgs>
{
    void Execute(TArgs args);
}

IAsyncBackgroundJob<TArgs>

异步后台作业接口,定义了异步执行的后台作业:

public interface IAsyncBackgroundJob<in TArgs>
{
    Task ExecuteAsync(TArgs args);
}

核心组件

IBackgroundJobManager

后台作业管理器接口,负责将作业添加到执行队列:

  • EnqueueAsync(): 将指定参数的作业加入执行队列

IBackgroundJobExecuter

后台作业执行器接口,负责执行具体的作业:

  • ExecuteAsync(): 执行指定的作业上下文

基础类型

  • BackgroundJob<TArgs>: 同步后台作业基类
  • AsyncBackgroundJob<TArgs>: 异步后台作业基类
  • BackgroundJobPriority: 作业优先级枚举
  • JobExecutionContext: 作业执行上下文
  • SparkdoBackgroundJobOptions: 后台作业配置选项

扩展性

该库提供了后台作业的核心抽象,可以通过以下方式扩展:

  1. 实现 IBackgroundJobManager 来提供作业管理功能
  2. 实现 IBackgroundJobExecuter 来提供作业执行功能
  3. 继承 BackgroundJob<TArgs>AsyncBackgroundJob<TArgs> 来实现具体作业
  4. 通过 SparkdoBackgroundJobOptions 配置作业行为

代码结构说明

本项目包含以下主要组件:

后台作业接口

  • IBackgroundJob<TArgs>: 同步后台作业接口
  • IAsyncBackgroundJob<TArgs>: 异步后台作业接口

后台作业管理

  • IBackgroundJobManager: 后台作业管理器接口
  • IBackgroundJobExecuter: 后台作业执行器接口

基础类型

  • BackgroundJob<TArgs>: 同步后台作业基类
  • AsyncBackgroundJob<TArgs>: 异步后台作业基类
  • BackgroundJobPriority: 作业优先级枚举
  • JobExecutionContext: 作业执行上下文
  • JobExecutionResult: 作业执行结果枚举
  • BackgroundJobConfiguration: 后台作业配置信息
  • SparkdoBackgroundJobOptions: 后台作业配置选项
  • SparkdoBackgroundJobsAbstractionsModule: 后台作业抽象模块

所有公共接口和类都添加了详细的 XML 文档注释,便于开发者理解和使用。

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (3)

Showing the top 3 NuGet packages that depend on Sparkdo.BackgroundJobs.Abstractions:

Package Downloads
Sparkdo.Emailing

Sparkdo 邮件发送库,提供基于 SMTP 的邮件发送功能,支持同步/异步发送、后台队列发送和模板邮件

Sparkdo.BackgroundJobs

Sparkdo 后台作业库,提供后台任务调度和执行功能实现

Sparkdo.BackgroundJobs.Hangfire

Sparkdo Hangfire 后台作业库,提供基于 Hangfire 的后台作业功能集成实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3-preview.1 38 5/17/2026
1.0.2 163 4/27/2026
1.0.2-preview.5 61 4/15/2026
1.0.2-preview.4 80 2/8/2026
1.0.2-preview.3 82 2/1/2026
1.0.2-preview.2 83 1/31/2026
1.0.2-preview.1 192 12/4/2025
1.0.1 486 11/27/2025
1.0.0 481 11/25/2025
1.0.0-preview.5 144 10/24/2025