IBeam.Api
2.0.64
dotnet add package IBeam.Api --version 2.0.64
NuGet\Install-Package IBeam.Api -Version 2.0.64
<PackageReference Include="IBeam.Api" Version="2.0.64" />
<PackageVersion Include="IBeam.Api" Version="2.0.64" />
<PackageReference Include="IBeam.Api" />
paket add IBeam.Api --version 2.0.64
#r "nuget: IBeam.Api, 2.0.64"
#:package IBeam.Api@2.0.64
#addin nuget:?package=IBeam.Api&version=2.0.64
#tool nuget:?package=IBeam.Api&version=2.0.64
IBeam.Api
IBeam.Api provides reusable API primitives for consistent ASP.NET Core endpoints:
- Standardized success/error response envelopes (
ApiResponse,ApiPagedResponse) - Global exception middleware (
UseApiExceptionHandling) - API configuration/DI helpers (
AddIBeamApi) - Reusable base controllers (
ApiControllerBase,CrudControllerBase)
Quick Start
Register API services:
builder.Services.AddIBeamApi(builder.Configuration);
Use middleware:
app.UseApiExceptionHandling();
Service Boundary and Errors
Controllers should stay thin. They adapt HTTP requests to service calls and shape responses; they should not own business rules, persistence rules, or duplicate service policy checks.
Services own business rules, validation decisions, logging/auditing decisions, and expected error classification. Expected failures should use typed, user-safe exceptions or service results that controllers can return as friendly messages.
Unexpected exceptions and system-level failures should bubble to ApiExceptionMiddleware. The middleware returns a generic error response unless detailed errors are enabled, and persists operational details through IApiErrorSink when configured. In the Azure Table identity provider, that sink writes to the SystemErrors table.
CrudControllerBase
CrudControllerBase<TService, TEntity, TKey> is an opt-in baseline controller with route defaults and operation flags.
- Base route:
api/[controller] GetByIdenabled by default- Other operations disabled by default (
GetAll,GetByIds,Post,Put,Delete) - Strongly-typed async service contracts (no
dynamic)
Service Contracts
Implement the contracts you need in your service:
IGetAllService<TEntity>IGetAllWithArchivedService<TEntity>IGetByIdService<TEntity, TKey>IGetByIdsService<TEntity, TKey>ICreateService<TEntity>IUpdateService<TEntity>IDeleteService<TKey>
Example
using IBeam.Api.Abstractions;
using IBeam.Api.Controllers;
using Microsoft.AspNetCore.Mvc;
public sealed record Patient(Guid Id, string Name);
public interface IPatientService :
IGetByIdService<Patient, Guid>,
IGetAllService<Patient>,
ICreateService<Patient>,
IUpdateService<Patient>,
IDeleteService<Guid>;
[ApiController]
[Route("api/[controller]")]
public sealed class PatientsController : CrudControllerBase<IPatientService, Patient, Guid>
{
public PatientsController(IPatientService service) : base(service) { }
protected override bool AllowGetAll => true;
protected override bool AllowPost => true;
protected override bool AllowPut => true;
protected override bool AllowDelete => true;
}
Created (201) Behavior
For POST, default response is 200 OK with envelope.
If you want 201 Created, override:
ReturnCreatedOnPost⇒trueBuildCreatedRouteValues(TEntity createdEntity)with route values forGetById
Notes
- Unexpected exceptions should bubble to
ApiExceptionMiddlewarefor centralized handling. - If an enabled action is missing the required service contract, an
InvalidOperationExceptionis thrown to fail fast with clear diagnostics.
| 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
- IBeam.Utilities (>= 2.0.64)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on IBeam.Api:
| Package | Downloads |
|---|---|
|
IBeam.Identity.Repositories.AzureTable
IBeam modular framework components for .NET APIs and services. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.64 | 60 | 6/17/2026 |
| 2.0.63 | 67 | 6/16/2026 |
| 2.0.62 | 67 | 6/16/2026 |
| 2.0.57 | 153 | 6/8/2026 |
| 2.0.56 | 125 | 6/7/2026 |
| 2.0.54 | 166 | 5/27/2026 |
| 2.0.52 | 114 | 5/27/2026 |
| 2.0.35 | 97 | 5/15/2026 |
| 2.0.32 | 110 | 3/25/2026 |
| 2.0.30 | 100 | 3/25/2026 |
| 2.0.29 | 98 | 3/25/2026 |
| 2.0.28 | 95 | 3/25/2026 |
| 2.0.26 | 106 | 3/25/2026 |
| 2.0.22 | 102 | 3/25/2026 |