CoreEx.AspNetCore
4.0.0-preview-1
dotnet add package CoreEx.AspNetCore --version 4.0.0-preview-1
NuGet\Install-Package CoreEx.AspNetCore -Version 4.0.0-preview-1
<PackageReference Include="CoreEx.AspNetCore" Version="4.0.0-preview-1" />
<PackageVersion Include="CoreEx.AspNetCore" Version="4.0.0-preview-1" />
<PackageReference Include="CoreEx.AspNetCore" />
paket add CoreEx.AspNetCore --version 4.0.0-preview-1
#r "nuget: CoreEx.AspNetCore, 4.0.0-preview-1"
#:package CoreEx.AspNetCore@4.0.0-preview-1
#addin nuget:?package=CoreEx.AspNetCore&version=4.0.0-preview-1&prerelease
#tool nuget:?package=CoreEx.AspNetCore&version=4.0.0-preview-1&prerelease
CoreEx.AspNetCore
Provides the ASP.NET Core integration layer for CoreEx: the
WebApiexecution helper (MVC and Minimal API variants), middleware forExecutionContextscoping and exception-to-ProblemDetails translation, idempotency key handling, health check configuration, and OpenAPI/NSwag extensions.
Overview
CoreEx.AspNetCore is the server-side HTTP integration package. It bridges CoreEx domain logic — semantic exceptions, Result<T> pipelines, paging, entity contracts — into ASP.NET Core HTTP responses, following RFC 7807 ProblemDetails conventions throughout.
The centrepiece is WebApi, which controllers and Minimal API handlers inject and call (GetAsync, PostAsync, PutAsync, PatchAsync, DeleteAsync). WebApi handles request body deserialization, ETag/If-Match concurrency checking, Result<T> unwrapping, paging header stamping, info/warning message header propagation, and exception-to-ProblemDetails translation — all in a single invocation boundary so individual action methods stay focused on business logic.
Two concrete WebApi implementations ship: Mvc.WebApi returning IActionResult for MVC controllers, and Http.WebApi returning IResult for Minimal API endpoints. Both share the same abstract base (WebApi<TResult>) and invoker infrastructure.
Key capabilities
- 🌐 WebApi execution helper:
WebApiencapsulates GET/HEAD, POST (with idempotency), PUT, PATCH (JSON Merge Patch), and DELETE patterns with standardized request validation, deserialization, ETag checks, and response serialization. - 📄 RFC 7807 ProblemDetails: All
IExtendedExceptiontypes (ValidationException,NotFoundException,ConcurrencyException, etc.) are translated to typedProblemDetailsresponses with appropriate HTTP status codes and optional field-levelerrorsextension. - 🔁 JSON Merge Patch (PATCH):
WebApi.PatchAsyncreads the request body as a merge-patch document, deserializes the current entity via a provided function, applies the patch, and re-validates before saving. - ⚙️ ExecutionContext middleware:
ExecutionContextMiddlewareresolves the DI-scopedExecutionContextper request, wiresServiceProvider, and propagates info/warning messages to response headers on completion. - 🛡️ Idempotency key middleware:
IdempotencyKeyMiddleware+[IdempotencyKey]attribute interceptsPOSToperations, checks a pluggableIIdempotencyProviderfor a prior response, and either replays the cached result or executes and caches the new one. - ♥ Health check endpoints:
HealthCheckOptionsconfigures/health/live,/health/startup,/health/ready, and/health/detailendpoints with tag-based filtering, JSON detail output, and per-endpoint enable/disable. - 🏷️ MVC attributes:
[PagingAttribute],[QueryAttribute],[AcceptsAttribute],[ProducesNotFoundProblem], and[IdempotencyKey]enrich OpenAPI/NSwag output without cluttering action signatures. - 🔍 OpenAPI extensions:
OpenApiOptionsandAspNetCoreExtensionswire NSwag operation processors that read CoreEx MVC attributes and add paging/query parameters, idempotency-key headers, and standard error response types to the generated spec. - 📡 OpenTelemetry:
CoreExAspNetCoreExtensions.AddCoreExAspNetCoreOpenTelemetrywires CoreExWebApiInvokeractivity sources into the OTEL tracer provider.
Key types
| Type | Description |
|---|---|
Mvc.WebApi |
MVC IActionResult-returning Web API helper; injected into controllers for typed GET/POST/PUT/PATCH/DELETE handling. |
Http.WebApi |
Minimal API IResult-returning Web API helper; used in MapGet/MapPost etc. endpoint delegates. |
ExecutionContextMiddleware |
Per-request ExecutionContext scoping, optional custom configuration, and info/warning message response header propagation. |
ExceptionHandlingMiddleware |
UseExceptionHandler callback that converts unhandled exceptions to ProblemDetails using the ambient WebApi instance. |
IdempotencyKeyMiddleware |
Middleware that checks [IdempotencyKey]-marked endpoints and delegates to IIdempotencyProvider for replay/cache. |
HybridCacheIdempotencyProvider |
IIdempotencyProvider backed by IHybridCache; stores serialized responses keyed by x-idempotency-key with configurable expiry. |
HealthCheckOptions |
Configures live/startup/ready/detail health check endpoint paths, tag filters, and JSON detail writer; registered via MapCoreExHealthChecks(). |
WebApiOptions |
Per-request options controlling response status code, ETag, location header, paging, and alternate status code behavior. |
OpenApiOptions |
NSwag/OpenAPI document-processor and operation-processor registration for CoreEx paging, query, accepts, and idempotency attributes. |
WebApiBase |
Abstract base for both WebApi<TResult> variants: holds JsonSerializerOptions, Logger, ExecutionContext, and ConvertUnhandledExceptionsToProblemDetails flag. |
Namespaces
| Namespace | Description |
|---|---|
Abstractions |
Abstract WebApi<TResult> base, WebApiInvoker<TResult>, WebApiResult<TResult>, WebApiPagingResult, and request/response option interfaces. |
HealthChecks |
HealthCheckOptions and endpoint registration extensions for live/startup/ready/detail health probes. |
Http |
Minimal API WebApi (IResult-returning) and its WebApiInvoker. |
Idempotency |
IIdempotencyProvider, IdempotencyKeyMiddleware, HybridCacheIdempotencyProvider, and IdempotencyStatus. |
Mvc |
MVC WebApi (IActionResult-returning), MVC attributes ([PagingAttribute], [QueryAttribute], [IdempotencyKey], [Accepts], [ProducesNotFoundProblem]), and WebApiInvoker. |
Related Namespaces
CoreEx- Semantic exceptions,ExecutionContext,Result<T>, andPagingArgsare the domain primitives translated by this package into HTTP responses.CoreEx.Http- Client-sideTypedHttpClientBase<TSelf>consumesProblemDetailsresponses produced by this package;HttpNamesdefines the shared header/query-string constants.CoreEx.Validation-ValidationExceptionraised by validators is translated to400 Bad Requestwith a field-levelerrorsextension inProblemDetails.
Additional Resources
- RFC 7807 — Problem Details for HTTP APIs - The specification implemented by
WebApiexception handling. - ASP.NET Core Health Checks - The underlying infrastructure extended by
HealthCheckOptions.
AI Usage Guide
An AGENTS.md file is included with this package. AI coding assistants (GitHub Copilot, Claude, Cursor, etc.) that support workspace-injected package documentation will automatically surface concise usage guidance, code examples, and Do Not rules for this package without requiring a local CoreEx checkout.
| Product | Versions 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. |
-
net10.0
- CoreEx (>= 4.0.0-preview-1)
- Microsoft.AspNetCore.OpenApi (>= 10.0.3)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.15.2)
-
net8.0
- CoreEx (>= 4.0.0-preview-1)
- Microsoft.AspNetCore.OpenApi (>= 8.0.24)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.15.2)
-
net9.0
- CoreEx (>= 4.0.0-preview-1)
- Microsoft.AspNetCore.OpenApi (>= 9.0.13)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.15.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CoreEx.AspNetCore:
| Package | Downloads |
|---|---|
|
CoreEx.AspNetCore.NSwag
Core .NET extensions and abstractions for the development of backend web-api services. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on CoreEx.AspNetCore:
| Repository | Stars |
|---|---|
|
Avanade/Beef
The Business Entity Execution Framework (Beef) framework, and the underlying code generation, has been primarily created to support the industrialization of API development.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0-preview-1 | 50 | 6/20/2026 |
| 3.31.0 | 8,918 | 2/1/2025 |
| 3.30.2 | 359 | 12/11/2024 |
| 3.30.1 | 351 | 12/9/2024 |
| 3.30.0 | 6,088 | 11/21/2024 |
| 3.29.0 | 1,621 | 11/19/2024 |
| 3.28.0 | 346 | 11/9/2024 |
| 3.27.3 | 575 | 10/23/2024 |
| 3.27.2 | 313 | 10/17/2024 |
| 3.27.1 | 396 | 10/15/2024 |
| 3.27.0 | 368 | 10/11/2024 |
| 3.26.0 | 321 | 10/3/2024 |
| 3.25.6 | 387 | 10/2/2024 |
| 3.25.5 | 366 | 9/25/2024 |
| 3.25.4 | 374 | 9/24/2024 |
| 3.25.3 | 341 | 9/18/2024 |
| 3.25.2 | 292 | 9/17/2024 |
| 3.25.1 | 362 | 9/16/2024 |
| 3.25.0 | 329 | 9/10/2024 |
| 3.24.1 | 425 | 8/7/2024 |