ZWebAPI 1.16.0

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

ZWebAPI

ZWebAPI is a library that brings additional functionalities for web API projects.

Supported frameworks

ZWebAPI ships assets for .NET 8, .NET 9 and .NET 10.

Target framework Notes
net10.0 LTS, supported until November 2028
net9.0 STS, out of support since May 2026
net8.0 LTS, out of support after November 2026

ZWebAPI depends on ZDatabase and ZSecurity, which ship the same three targets. ZDatabase carries the EF Core dependency for each of them.

The net9.0 and net8.0 targets exist for compatibility with applications that have not yet moved to .NET 10. Both of those runtimes are at or near end of support, so new projects should target net10.0.

Global exception handling

AddGlobalExceptionHandling turns any exception that leaves a controller into an RFC 7807 response, so actions no longer need a try/catch each. It needs ASP.NET Core, which ZWebAPI references through the Microsoft.AspNetCore.App shared framework.

builder.Services.AddGlobalExceptionHandling(options =>
{
    // Application-specific mappings. They run after the defaults, so they can override them.
    options.Map<ValidationFailureException>((exception, _) =>
        ExceptionResponse.Content(StatusCodes.Status400BadRequest, exception.Message));
});

WebApplication app = builder.Build();
app.UseGlobalExceptionHandling(); // first in the pipeline

Default mappings:

Exception Response
EntityNotFoundException<T> 404 problem
EntityValidationFailureException<TKey> 400 validation problem, with the entity key in entityKey
MissingUserPermissionException 403 problem
anything else 500 problem

A mapping matches the exact type first, then an open generic, then each base type.

Every problem carries traceId. When the response is a fault (500 and above, or a mapping that calls Capture()), the exception goes to the IExceptionReporter registered by the application, and the identifier it returns is written as errorId. Register the reporter as scoped. Without one, nothing is reported.

The exception detail (message, inner message, stack trace, type) is written only when the host runs in Development and IsExceptionDetailIncludedInDevelopment is true. It is off by default.

ActionArgumentsBreadcrumbFilter is registered with the handler. When an action throws, it adds the action's arguments as a breadcrumb, so the reported error still says what the action received.

Health checks

builder.Services.AddDefaultHealthChecks();
// ...
app.MapDefaultHealthChecks(); // "/health" and "/health/ready"
  • /health is the liveness probe. It runs no check, so a database outage does not restart the process.
  • /health/ready is the readiness probe. It runs the checks tagged ready, which by default is the database check: CanConnectAsync on the registered IDbContext.
Product Compatible and additional computed target framework versions.
.NET 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 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

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
1.17.0 50 10/31/2026
1.16.0 99 10/26/2026
1.15.0 135 9/26/2026
1.14.0 134 9/19/2026
1.13.3 104 9/16/2026
1.13.2 238 6/12/2026
1.13.1 127 6/11/2026
1.13.0 206 6/2/2026
1.12.0 253 1/21/2026
1.11.2 497 3/20/2025
1.11.1 191 12/26/2024
1.10.0 213 11/24/2024
1.9.1 223 6/25/2024
1.9.0 206 6/12/2024
1.8.1 204 5/30/2024
1.8.0 204 5/14/2024
1.7.0 172 5/13/2024
1.6.0 221 4/23/2024
1.5.1 232 3/8/2024
1.5.0 203 3/8/2024
Loading failed