Sparkdo.UnitOfWork 2.0.0-preview.2

This is a prerelease version of Sparkdo.UnitOfWork.
dotnet add package Sparkdo.UnitOfWork --version 2.0.0-preview.2
                    
NuGet\Install-Package Sparkdo.UnitOfWork -Version 2.0.0-preview.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.UnitOfWork" Version="2.0.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sparkdo.UnitOfWork" Version="2.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Sparkdo.UnitOfWork" />
                    
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.UnitOfWork --version 2.0.0-preview.2
                    
#r "nuget: Sparkdo.UnitOfWork, 2.0.0-preview.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.UnitOfWork@2.0.0-preview.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.UnitOfWork&version=2.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Sparkdo.UnitOfWork&version=2.0.0-preview.2&prerelease
                    
Install as a Cake Tool

Sparkdo.UnitOfWork

Sparkdo.UnitOfWork 提供工作单元运行时、中间件和 Polaris Manifest 自动接线。

应用通常直接依赖 IUnitOfWorkManager;Manifest 默认注册 DefaultUnitOfWorkManager。需要手动创建时,UnitOfWorkManager 是同一运行时的简明委托入口。

[UnitOfWork] 放在服务类型或方法上即可为匹配的 invocation 建立工作单元作用域。[DisableUnitOfWork] 可在方法或类型上禁用继承的工作单元配置。工作单元核心保持独立,不绑定 Entity Framework Core 或其他持久化技术;持久化适配器通过 Sparkdo.UnitOfWork.Integration 登记完成处理器。

持久化适配器在当前作用域中登记处理器:

if (manager.Current is IUnitOfWorkEnlistment enlistment)
{
    enlistment.Enlist(handler);
}

一个活动根工作单元只允许登记一个完成处理器;同一处理器可以在前一个根工作单元进入终态后顺序复用,但不能同时登记到多个活动根工作单元。

工作单元中间件只拦截可生成的异步接口方法;标记到同步方法或无法生成装饰器的服务契约时,Manifest 会在编译期闭锁而不是静默跳过。

每个根工作单元只能登记一个完成处理器;同一处理器在前一个根工作单元终态发布后可以顺序复用,但不能并发登记到多个根。处理器返回未知结果、抛出异常或在完成调用开始后发生取消/超时时,运行时将状态设为 CompletionUnknown,不会自动回滚或重试。

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 (1)

Showing the top 1 NuGet packages that depend on Sparkdo.UnitOfWork:

Package Downloads
Sparkdo.EntityFrameworkCore

Sparkdo Entity Framework Core 的多租户 DbContext 生命周期和工作单元集成。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0-preview.2 59 7/20/2026
2.0.0-preview.1 46 7/18/2026