SolTechnology.Core.Api
0.5.0
See the version list below for details.
dotnet add package SolTechnology.Core.Api --version 0.5.0
NuGet\Install-Package SolTechnology.Core.Api -Version 0.5.0
<PackageReference Include="SolTechnology.Core.Api" Version="0.5.0" />
<PackageVersion Include="SolTechnology.Core.Api" Version="0.5.0" />
<PackageReference Include="SolTechnology.Core.Api" />
paket add SolTechnology.Core.Api --version 0.5.0
#r "nuget: SolTechnology.Core.Api, 0.5.0"
#:package SolTechnology.Core.Api@0.5.0
#addin nuget:?package=SolTechnology.Core.Api&version=0.5.0
#tool nuget:?package=SolTechnology.Core.Api&version=0.5.0
Overview
The SolTechnology.Core.Api library provides API utilities and filters for ASP.NET Core applications. It includes exception handling middleware, response envelope filters, and testing utilities for API integration tests.
Registration
For installing the library, reference SolTechnology.Core.Api nuget package.
Configuration
No configuration is needed.
Usage
- Exception Handling Middleware
Add the exception handler middleware to automatically handle exceptions in your API:
app.UseMiddleware<ExceptionHandlerMiddleware>();
- Response Envelope Filter
Add the response envelope filter to wrap your API responses in a consistent format:
builder.Services.AddControllers(options =>
{
options.Filters.Add<ResponseEnvelopeFilter>();
});
- API Testing
Use the ApiFixture class for integration testing your API:
public class MyApiTests
{
private readonly ApiFixture _fixture;
public MyApiTests()
{
_fixture = new ApiFixture();
}
[Test]
public async Task TestMyEndpoint()
{
var client = _fixture.CreateClient();
var response = await client.GetAsync("/api/myendpoint");
Assert.That(response.IsSuccessStatusCode, Is.True);
}
}
| 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
- Microsoft.AspNetCore.Mvc.Testing (>= 8.0.11)
- Microsoft.AspNetCore.TestHost (>= 8.0.11)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- SolTechnology.Core.CQRS (>= 0.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.