Nutzen.Common
0.0.7
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Nutzen.Common --version 0.0.7
NuGet\Install-Package Nutzen.Common -Version 0.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="Nutzen.Common" Version="0.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nutzen.Common" Version="0.0.7" />
<PackageReference Include="Nutzen.Common" />
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 Nutzen.Common --version 0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Nutzen.Common, 0.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 Nutzen.Common@0.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=Nutzen.Common&version=0.0.7
#tool nuget:?package=Nutzen.Common&version=0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Nutzen
A lightweight .NET library for implementing the Unit of Work pattern with request/response handling, including Roslyn analyzers for compile-time validation.
Installation
dotnet add package Nutzen
Features
- Unit of Work Pattern: Structured approach to organizing business logic
- Request/Handler Pattern: Clean separation of concerns with
IRequestandIRequestHandler - Interceptable Handlers: Built-in support for request interceptors (middleware pattern)
- Dispatcher: Central dispatching mechanism for requests
- Roslyn Analyzers: Compile-time validation to ensure correct implementation
Quick Start
Define a Unit of Work
using Nutzen;
[UnitOfWork]
public static class CreateUser
{
[Request]
public record Request : Nutzen.Request
{
public string Name { get; init; }
public string Email { get; init; }
}
[Handler]
public class Handler : InterceptableRequestHandler<Request>
{
protected override Task<Result<Empty>> Operation(Request request)
{
// Your business logic here
return Task.FromResult(Result<Empty>.Success(default));
}
}
}
With a Response Type
using Nutzen;
[UnitOfWork]
public static class GetUser
{
public record UserResponse(int Id, string Name, string Email);
[Request]
public record Request : Nutzen.Request<UserResponse>
{
public int UserId { get; init; }
}
[Handler]
public class Handler : InterceptableRequestHandler<Request, UserResponse>
{
protected override Task<Result<UserResponse>> Operation(Request request)
{
var user = new UserResponse(request.UserId, "John", "john@example.com");
return Task.FromResult(Result<UserResponse>.Success(user));
}
}
}
Dispatch Requests
// Register in DI container
services.AddScoped<IDispatcher, Dispatcher>();
services.AddScoped<IRequestHandler<CreateUser.Request, Empty>, CreateUser.Handler>();
// Use the dispatcher
var dispatcher = serviceProvider.GetRequiredService<IDispatcher>();
var result = await dispatcher.DispatchAsync<CreateUser.Request>(new CreateUser.Request
{
Name = "John",
Email = "john@example.com"
});
Analyzers
The package includes Roslyn analyzers that enforce the Unit of Work pattern at compile time:
| Code | Description |
|---|---|
| UOW001 | Class with [UnitOfWork] must be static |
| UOW002 | Class with [UnitOfWork] must have an inner record with [Request] inheriting from Request |
| UOW003 | Class with [UnitOfWork] must have an inner class with [Handler] implementing IRequestHandler |
All rules include automatic code fixes to help you quickly resolve issues.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.Extensions.Caching.Memory (>= 6.0.3)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.4)
- Nutzen (>= 0.0.7)
-
net6.0
- Microsoft.Extensions.Caching.Memory (>= 6.0.3)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.4)
- Nutzen (>= 0.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|