Atc.Rest
4.1.0
dotnet add package Atc.Rest --version 4.1.0
NuGet\Install-Package Atc.Rest -Version 4.1.0
<PackageReference Include="Atc.Rest" Version="4.1.0" />
<PackageVersion Include="Atc.Rest" Version="4.1.0" />
<PackageReference Include="Atc.Rest" />
paket add Atc.Rest --version 4.1.0
#r "nuget: Atc.Rest, 4.1.0"
#:package Atc.Rest@4.1.0
#addin nuget:?package=Atc.Rest&version=4.1.0
#tool nuget:?package=Atc.Rest&version=4.1.0
Atc.Rest
Target Framework: net10.0
Foundation library for building ASP.NET Core Web APIs with standardized configuration, middleware, and error handling. Provides a streamlined setup for REST APIs with built-in support for common scenarios like JSON serialization, exception handling, and service registration.
Why Use This Library?
Atc.Rest eliminates repetitive Web API configuration boilerplate and provides consistent, production-ready defaults for REST APIs. Instead of configuring the same middleware and services in every project, Atc.Rest provides:
- Simplified Configuration: Single-line setup with
RestApiOptions - Standardized Error Handling: ProblemDetails support with customizable exception filters
- Automatic Service Registration: Convention-based service discovery and registration
- JSON Serialization Defaults: Configurable casing styles, null handling, and enum serialization
- Application Insights Integration: Built-in telemetry support
- Development Tools: Anonymous access for debugging and detailed error messages
Perfect for:
- Building REST APIs with consistent patterns
- Microservices that need standardized configuration
- APIs requiring ProblemDetails RFC compliance
- Projects using Application Insights for monitoring
Installation
dotnet add package Atc.Rest
Target Framework
- .NET 10.0
Key Features
- Allow anonymous access in debug-mode
- Enable ApplicationInsights telemetry
- Auto service registration using reflection
- Validation service registration
- Enum-as-string serialization
- Ignore null values in JSON responses
- Configurable JSON casing styles (camelCase, PascalCase, etc.)
- HttpContextAccessor registration
- Exception handling with middleware
- ProblemDetails RFC 7807 support
- Detailed exception messages for debugging
- HTTPS enforcement
Requirements
Key Dependencies
- Microsoft.AspNetCore.App (framework reference)
- Microsoft.ApplicationInsights.AspNetCore
- Atc (foundation library)
Code documentation
services.AddRestApi and app.ConfigureRestApi examples
Using - minimal setup
Example with a minimal setup in the Startup.cs
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
restApiOptions = new RestApiOptions
restApiOptions.AddAssemblyPairs(
Assembly.GetAssembly(typeof(ApiRegistration)),
Assembly.GetAssembly(typeof(DomainRegistration)));
}
public IConfiguration Configuration { get; }
private readonly RestApiOptions restApiOptions;
public void ConfigureServices(IServiceCollection services)
{
services.AddRestApi<Startup>(restApiOptions);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.ConfigureRestApi(env, restApiOptions);
}
}
Using - specified features setup
Example with specified features in the Startup.cs
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
restApiOptions = new RestApiOptions
{
// Base
AllowAnonymousAccessForDevelopment = true,
UseApplicationInsights = true,
UseAutoRegistrateServices = true,
UseValidateServiceRegistrations = true,
UseHttpContextAccessor = true,
ErrorHandlingExceptionFilter = new RestApiOptionsErrorHandlingExceptionFilter
{
Enable = true,
UseProblemDetailsAsResponseBody = true,
IncludeExceptionDetails = true,
},
UseRequireHttpsPermanent = true,
UseEnumAsStringInSerialization = true,
UseJsonSerializerOptionsIgnoreNullValues = true,
JsonSerializerCasingStyle = CasingStyle.CamelCase,
};
restApiOptions.AddAssemblyPairs(
Assembly.GetAssembly(typeof(ApiRegistration)),
Assembly.GetAssembly(typeof(DomainRegistration)));
}
public IConfiguration Configuration { get; }
private readonly RestApiOptions restApiOptions;
public void ConfigureServices(IServiceCollection services)
{
if (!restApiOptions.UseAutoRegistrateServices)
{
// Manual ConfigureServices
services.ConfigureServices();
}
services.AddRestApi<Startup>(restApiOptions);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.ConfigureRestApi(env, restApiOptions);
}
}
Using - your own JSON serializer options
ConfigureJsonSerializerOptions runs after the JSON flags (JsonSerializerCasingStyle,
UseJsonSerializerOptionsIgnoreNullValues, UseEnumAsStringInSerialization), so it can change any setting.
To make the API serialize exactly like the rest of the application, copy shared options onto it;
CopyTo replaces every setting and converter.
var restApiOptions = new RestApiOptions
{
ConfigureJsonSerializerOptions = o => JsonSerializerOptionsFactory.Create().CopyTo(o),
};
Contributing
Contributions are welcome! Please see the main repository README for contribution guidelines.
| 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
- Atc (>= 4.1.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.23.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Atc.Rest:
| Package | Downloads |
|---|---|
|
Atc.Rest.Extended
Atc.Rest.Extended is a collection of classes and extension methods for Atc.Rest, that contains SwaggerUI, FluentValidation Versioning etc. |
|
|
Atc.Rest.FluentAssertions
Atc.Rest.FluentAssertions is a collection of assertion helpers for writing tests of Atc types. |
|
|
Atc.Rest.AwesomeAssertions
Atc.Rest.AwesomeAssertions is a collection of assertion helpers for writing tests of Atc types. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.1.0 | 281 | 11/9/2026 |
| 4.0.0 | 1,243 | 10/19/2026 |
| 3.0.186 | 2,369 | 8/25/2026 |
| 3.0.185 | 191 | 8/25/2026 |
| 3.0.181 | 975 | 7/29/2026 |
| 3.0.174 | 1,112 | 6/24/2026 |
| 3.0.173 | 226 | 6/24/2026 |
| 3.0.172 | 207 | 6/24/2026 |
| 3.0.67 | 2,919 | 4/25/2026 |
| 3.0.46 | 1,197 | 4/15/2026 |
| 3.0.45 | 601 | 4/10/2026 |
| 3.0.44 | 2,043 | 4/9/2026 |
| 3.0.43 | 191 | 4/9/2026 |
| 3.0.41 | 224 | 4/9/2026 |
| 3.0.40 | 216 | 4/9/2026 |
| 3.0.18 | 1,510 | 2/9/2026 |
| 3.0.16 | 5,945 | 12/15/2025 |
| 3.0.12 | 363 | 11/28/2025 |
| 3.0.9 | 758 | 11/21/2025 |
| 3.0.8 | 723 | 11/14/2025 |