CommonNetFuncs.Web.Api
4.0.36
See the version list below for details.
dotnet add package CommonNetFuncs.Web.Api --version 4.0.36
NuGet\Install-Package CommonNetFuncs.Web.Api -Version 4.0.36
<PackageReference Include="CommonNetFuncs.Web.Api" Version="4.0.36" />
<PackageVersion Include="CommonNetFuncs.Web.Api" Version="4.0.36" />
<PackageReference Include="CommonNetFuncs.Web.Api" />
paket add CommonNetFuncs.Web.Api --version 4.0.36
#r "nuget: CommonNetFuncs.Web.Api, 4.0.36"
#:package CommonNetFuncs.Web.Api@4.0.36
#addin nuget:?package=CommonNetFuncs.Web.Api&version=4.0.36
#tool nuget:?package=CommonNetFuncs.Web.Api&version=4.0.36
CommonNetFuncs.Web.Api
This project contains helper methods for several common functions required by API applications that interact with databases using Entity Framework Core. Works in combination with the BaseDbContextActions class in CommonNetFuncs.EFCore package.
Contents
- CommonNetFuncs.Web.Api
GenericEndpoints
[Description here]
[Class Name] Usage Examples
<details> <summary><h3>Usage Examples</h3></summary>
[MethodNameHere]
[Method Description here]
//Code here
</details>
GenericMinimalEndpoints
Provides static methods for common CRUD and patch operations designed for use in ASP.NET Core minimal API endpoints. Each method accepts an IBaseDbContextActions instance and returns strongly-typed Microsoft.AspNetCore.Http.HttpResults results (Results<Ok<T>, NoContent> or Results<Ok<T>, NoContent, ValidationProblem>), making them directly usable as minimal API route handlers.
GenericMinimalEndpoints Usage Examples
<details> <summary><h3>Usage Examples</h3></summary>
CreateMany
Creates multiple entities and saves them to the database. Returns Ok with the created entities on success, or NoContent on failure.
app.MapPost("/entities", (IEnumerable<MyEntity> models, IBaseDbContextActions<MyEntity, MyDbContext> db) =>
GenericMinimalEndpoints.CreateMany(models, db));
Patch
Applies a JSON Patch document to an existing entity located by primary key. Validates the patched model and returns Ok with the updated entity, ValidationProblem if validation fails, or NoContent if the entity is not found.
app.MapPatch("/entities/{id}", (int id, JsonPatchDocument<MyEntity> patch, IBaseDbContextActions<MyEntity, MyDbContext> db) =>
GenericMinimalEndpoints.Patch<MyEntity, MyDbContext>(id, patch, db));
</details>
GenericMinimalDtoEndpoints
Provides static methods for common CRUD, patch, and update operations for minimal API endpoints that use separate input and output DTO types. Input DTOs are mapped to the entity model before database operations and the result is mapped to the output DTO before returning. Returns Results<Ok<TOutDto>, NoContent> or Results<Ok<TOutDto>, NoContent, ValidationProblem>.
GenericMinimalDtoEndpoints Usage Examples
<details> <summary><h3>Usage Examples</h3></summary>
CreateMany
Creates multiple entities from input DTOs, saves them, and returns the created records mapped to the output DTO type.
app.MapPost("/entities", (IEnumerable<MyInDto> models, IBaseDbContextActions<MyEntity, MyDbContext> db) =>
GenericMinimalDtoEndpoints.CreateMany<MyEntity, MyDbContext, MyInDto, MyOutDto>(models, db));
Update
Retrieves an existing entity by primary key, overwrites its properties from the input DTO, validates the result, and saves. Returns Ok with the updated record mapped to the output DTO, ValidationProblem if validation fails, or NoContent if the entity is not found.
app.MapPut("/entities/{id}", (int id, MyInDto dto, IBaseDbContextActions<MyEntity, MyDbContext> db) =>
GenericMinimalDtoEndpoints.Update<MyEntity, MyDbContext, MyInDto, MyOutDto>(id, dto, db));
</details>
MinimalMsgPackMiddleware
Middleware that adds transparent MessagePack content negotiation to minimal API endpoints. When a request carries Content-Type: application/x-msgpack, the body is converted to JSON before the endpoint handler runs so that standard [FromBody] binding works unchanged. When a request carries Accept: application/x-msgpack, the JSON response body is converted to MessagePack before it reaches the client.
Register once on a route group or the whole application using the UseContentNegotiationMiddleware extension method.
MinimalMsgPackMiddleware Usage Examples
<details> <summary><h3>Usage Examples</h3></summary>
UseContentNegotiationMiddleware
Registers the middleware globally so every endpoint in the application supports MessagePack request and response bodies.
// Program.cs
app.UseContentNegotiationMiddleware();
app.MapPost("/entities", (MyEntity entity) => Results.Ok(entity));
</details>
Installation
Install via NuGet:
dotnet add package CommonNetFuncs.Web.Api
License
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- CommonNetFuncs.Core (>= 4.0.36)
- CommonNetFuncs.DeepClone (>= 4.0.36)
- CommonNetFuncs.EFCore (>= 4.0.36)
- CommonNetFuncs.FastMap (>= 4.0.36)
- MessagePack (>= 3.1.4)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.7)
- Microsoft.AspNetCore.OpenApi (>= 10.0.7)
- Microsoft.EntityFrameworkCore (>= 10.0.7)
- Scalar.AspNetCore (>= 2.14.9)
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 |
|---|---|---|
| 4.1.8 | 0 | 7/7/2026 |
| 4.1.7 | 119 | 6/23/2026 |
| 4.1.6 | 105 | 6/15/2026 |
| 4.1.4 | 110 | 6/10/2026 |
| 4.1.3 | 116 | 6/9/2026 |
| 4.1.2 | 123 | 6/6/2026 |
| 4.1.1 | 108 | 6/5/2026 |
| 4.1.0 | 116 | 6/5/2026 |
| 4.0.56 | 126 | 6/2/2026 |
| 4.0.53 | 126 | 5/28/2026 |
| 4.0.52 | 108 | 5/27/2026 |
| 4.0.48 | 116 | 5/19/2026 |
| 4.0.43 | 151 | 5/14/2026 |
| 4.0.40 | 115 | 5/10/2026 |
| 4.0.39 | 108 | 5/10/2026 |
| 4.0.37 | 107 | 5/9/2026 |
| 4.0.36 | 106 | 5/8/2026 |
| 4.0.34 | 119 | 4/28/2026 |
| 4.0.33 | 125 | 4/23/2026 |