REslava.Result.AspNetCore
1.54.0
Prefix Reserved
dotnet add package REslava.Result.AspNetCore --version 1.54.0
NuGet\Install-Package REslava.Result.AspNetCore -Version 1.54.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="REslava.Result.AspNetCore" Version="1.54.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="REslava.Result.AspNetCore" Version="1.54.0" />
<PackageReference Include="REslava.Result.AspNetCore"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
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 REslava.Result.AspNetCore --version 1.54.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: REslava.Result.AspNetCore, 1.54.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 REslava.Result.AspNetCore@1.54.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=REslava.Result.AspNetCore&version=1.54.0
#tool nuget:?package=REslava.Result.AspNetCore&version=1.54.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
REslava.Result.AspNetCore
Zero-boilerplate ASP.NET endpoint generation — write business logic, Minimal API + MVC endpoints generate themselves.
What It Does
This package contains 13 Roslyn source generators that eliminate ASP.NET boilerplate:
Minimal API
- SmartEndpoints — auto-generates complete endpoint registration from your service classes; includes CancellationToken threading, auto-validation, filters, caching, and rate limiting
- ResultToIResult — converts
Result<T>toIResultwith domain error-aware HTTP status codes - OneOfToIResult — converts
OneOf<T1,...,T6>toIResultwith tag-based + heuristic error mapping (arities 2–6)
MVC Controllers
- ResultToActionResult — converts
Result<T>toIActionResultwith convention-based HTTP mapping - OneOfToActionResult — converts
OneOf<T1,...,T6>toIActionResultwith domain error auto-mapping (arities 2–6)
Cross-cutting
- OpenAPI metadata — auto-generates
.Produces<T>(),.WithSummary(),.WithTags()with accurate error status codes - Authorization — generates
.RequireAuthorization(),.AllowAnonymous()from attributes - [Validate] — generates
.Validate()extension methods fromDataAnnotations; auto-injected by SmartEndpoints - [FluentValidate] — (from
REslava.Result.FluentValidation) SmartEndpoints detects[FluentValidate]on body params and auto-injectsIValidator<T>as a lambda parameter
Before / After
// Before: Manual endpoint registration (30+ lines per controller)
app.MapGet("/api/products", async (IProductService svc) => {
var result = await svc.GetProducts();
return result.Match(
products => Results.Ok(products),
errors => Results.BadRequest(errors));
}).WithName("GetProducts").WithTags("Products").Produces<List<Product>>(200).Produces(400);
app.MapGet("/api/products/{id}", async (int id, IProductService svc) => { /* ... */ });
app.MapPost("/api/products", async (CreateProductRequest req, IProductService svc) => { /* ... */ });
// ... repeat for every endpoint
// After: SmartEndpoints (just your business logic)
[AutoGenerateEndpoints(RoutePrefix = "/api/products")]
public class ProductService(AppDbContext db)
{
public async Task<Result<List<Product>>> GetProducts()
=> Result.Ok(await db.Products.ToListAsync());
public async Task<Result<Product>> GetProductById(int id)
=> await db.Products.FindAsync(id) is { } p
? Result.Ok(p)
: Result.Fail<Product>("Not found");
public async Task<Result<Product>> CreateProduct(CreateProductRequest request)
=> Result.Ok(db.Products.Add(new Product(request)).Entity);
}
// In Program.cs — one line:
app.MapProductServiceEndpoints();
Quick Start
dotnet add package REslava.Result
dotnet add package REslava.Result.AspNetCore
using REslava.Result;
[AutoGenerateEndpoints(RoutePrefix = "/api/users")]
public class UserService(UserRepository repo)
{
public async Task<Result<User>> GetUserById(int id)
=> await repo.FindAsync(id) is { } user
? user // implicit conversion to Result<User>
: new NotFoundError($"User {id} not found");
}
// Program.cs
app.MapUserServiceEndpoints(); // auto-generated extension method
The generator infers:
- HTTP method from name:
Get*→ GET,Create*/Add*→ POST,Update*→ PUT,Delete*→ DELETE - Routes with
{id}parameters when methods have anidparameter - DI via ASP.NET parameter binding (services injected as lambda parameters)
- CancellationToken — automatically threaded through when service method declares
CancellationToken cancellationToken = default - Validation — auto-injects
.Validate()when request type carries[Validate]
Requires
- REslava.Result (core library)
Links
- GitHub Repository — Full documentation, architecture guide
- Minimal API Demo
- MVC Demo
- Changelog
MIT License | Works with any .NET project (netstandard2.0)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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
- REslava.Result (>= 1.54.0)
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.54.0 | 110 | 4/6/2026 |
| 1.53.0 | 112 | 4/5/2026 |
| 1.52.0 | 102 | 3/30/2026 |
| 1.51.0 | 124 | 3/28/2026 |
| 1.50.1 | 102 | 3/25/2026 |
| 1.50.0 | 99 | 3/25/2026 |
| 1.49.0 | 98 | 3/24/2026 |
| 1.48.0 | 98 | 3/22/2026 |
| 1.47.5 | 99 | 3/22/2026 |
| 1.47.4 | 96 | 3/21/2026 |
| 1.47.3 | 93 | 3/20/2026 |
| 1.47.2 | 99 | 3/20/2026 |
| 1.47.1 | 101 | 3/18/2026 |
| 1.47.0 | 97 | 3/18/2026 |
| 1.46.3 | 97 | 3/18/2026 |
| 1.46.2 | 96 | 3/18/2026 |
| 1.46.1 | 98 | 3/17/2026 |
| 1.46.0 | 96 | 3/17/2026 |
| 1.45.0 | 98 | 3/17/2026 |
| 1.44.1 | 115 | 3/16/2026 |
Loading failed