AspNetConventios 1.0.2
Deprecated
dotnet add package AspNetConventios --version 1.0.2
NuGet\Install-Package AspNetConventios -Version 1.0.2
<PackageReference Include="AspNetConventios" Version="1.0.2" />
<PackageVersion Include="AspNetConventios" Version="1.0.2" />
<PackageReference Include="AspNetConventios" />
paket add AspNetConventios --version 1.0.2
#r "nuget: AspNetConventios, 1.0.2"
#:package AspNetConventios@1.0.2
#addin nuget:?package=AspNetConventios&version=1.0.2
#tool nuget:?package=AspNetConventios&version=1.0.2
AspNetConventions
<br /> <div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./assets/asp_net_conventions_dark.svg" width="250"> <img alt="AspNetConventions" src="./assets/asp_net_conventions.svg" width="250"> </picture> </div> <br />
Automatic naming conventions for ASP.NET Core - Transform your routes, parameters, and responses to kebab-case, snake_case, camelCase, or PascalCase with zero boilerplate.
<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./assets/banner_dark.png" width="100%"> <img alt="AspNetConventions" src="./assets/banner.png" width="100%"> </picture> </div>
Features
- Automatic Route Transformation -
/GetUserById→/get-user-by-id - Parameter Binding -
{UserId}→{user-id}with automatic binding - Response Formatting - Standardized JSON responses
- Multiple Endpoint/Routes Types - MVC Controllers, Minimal APIs, Razor Pages
- Flexible Casing - kebab-case, snake_case, camelCase, PascalCase
- Zero Overhead - Conventions applied at startup
Quick Start
Installation
dotnet add package AspNetConventions
Basic Usage
// ./Program.cs
var builder = WebApplication.CreateBuilder(args);
// Add conventions to MVC/Razor Pages (IMvcBuilder)
builder.Services.AddControllersWithViews()
.AddAspNetConventions();
var app = builder.Build();
app.MapGet("/GetUser/{UserId}", (int UserId) => new { userId = UserId });
// Apply conventions to Minimal APIs (WebApplication)
app.UseAspNetConventions();
app.Run();
Examples
MVC Controllers
[ApiController]
[Route("api/[controller]")]
public class UserProfileController : ControllerBase
{
[HttpGet("GetById/{UserId}")]
public IActionResult GetById(int UserId) => Ok();
}
//Result: GET /api/user-profile/get-by-id/{user-id}
Minimal APIs
app.MapGet("/WeatherForecast/{CityName}", (string CityName) =>
Results.Ok(new { city = CityName }));
// Result: GET /weather-forecast/{city-name}
Razor Pages
// ./Pages/UserProfile/Edit.cshtml.cs
public class EditModel : PageModel
{
public void OnGet(int UserId) { }
}
// Result: /user-profile/edit/{user-id}
License
This project is licensed under the MIT License - see LICENSE file for details.
Acknowledgments
- Built on ASP.NET Core's extensibility
- Thanks to all contributors
Support
Made with ❤️ for the ASP.NET Core community
| 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 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. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
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 |
|---|