IBeam.Api 2.0.32

dotnet add package IBeam.Api --version 2.0.32
                    
NuGet\Install-Package IBeam.Api -Version 2.0.32
                    
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="IBeam.Api" Version="2.0.32" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IBeam.Api" Version="2.0.32" />
                    
Directory.Packages.props
<PackageReference Include="IBeam.Api" />
                    
Project file
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 IBeam.Api --version 2.0.32
                    
#r "nuget: IBeam.Api, 2.0.32"
                    
#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 IBeam.Api@2.0.32
                    
#: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=IBeam.Api&version=2.0.32
                    
Install as a Cake Addin
#tool nuget:?package=IBeam.Api&version=2.0.32
                    
Install as a Cake Tool

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();

CrudControllerBase

CrudControllerBase<TService, TEntity, TKey> is an opt-in baseline controller with route defaults and operation flags.

  • Base route: api/[controller]
  • GetById enabled 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:

  • ReturnCreatedOnPosttrue
  • BuildCreatedRouteValues(TEntity createdEntity) with route values for GetById

Notes

  • Exceptions should bubble to ApiExceptionMiddleware for centralized handling.
  • If an enabled action is missing the required service contract, an InvalidOperationException is thrown to fail fast with clear diagnostics.
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.0.32 87 3/25/2026
2.0.30 80 3/25/2026
2.0.29 77 3/25/2026
2.0.28 76 3/25/2026
2.0.26 84 3/25/2026
2.0.22 81 3/25/2026