VOOZH about

URL: https://www.nuget.org/packages/Waystone.Common.Api/

⇱ NuGet Gallery | Waystone.Common.Api 2.3.0




Waystone.Common.Api 2.3.0

dotnet add package Waystone.Common.Api --version 2.3.0
 
 
NuGet\Install-Package Waystone.Common.Api -Version 2.3.0
 
 
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="Waystone.Common.Api" Version="2.3.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Waystone.Common.Api" Version="2.3.0" />
 
Directory.Packages.props
<PackageReference Include="Waystone.Common.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 Waystone.Common.Api --version 2.3.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Waystone.Common.Api, 2.3.0"
 
 
#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 Waystone.Common.Api@2.3.0
 
 
#: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=Waystone.Common.Api&version=2.3.0
 
Install as a Cake Addin
#tool nuget:?package=Waystone.Common.Api&version=2.3.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Waystone.Common.Api

The foundational code required to create .NET 6 Clean Architecture API layer projects for Draekien Industries. It is intended to be used alongside:

Recommended Usage

The below sample code is the recommended usage for this library. If you wish to configure your own problem details mapping (i.e. you have your own exceptions that must be mapped to specific status codes), then see the Advanced Usage section and do not use AcceptDefaults().

// program.cs
using Waystone.Common.Api;

// after creating the web application builder
// configures serilog using appsettings and enrichers:
// - Correlation ID Header Enricher
// - Http Request Context Enricher
builder.Host
 .UseWaystoneApiHostBuilder()
 .AcceptDefaults();

// Accept the default configuration provided by Waystone.Common.Api.
// Currently adds:
// - controllers
// - route naming conventions
// - problem details
// - swagger (nswag)
// - newtonsoft configuration
// - correlation id header options
// - http request context action filter
builder.Services
 .AddWaystoneApiServiceBuilder(
 builder.Environment,
 builder.Configuration,
 typeof(Program))
 .AcceptDefault(
 apiName: "ACME",
 apiVersion: "v1",
 apiDescription: "An api for ACME");

// After creating the web application with `builder.Build()`
// Currently adds:
// - correlation id header middleware
// - https redirection
// - problem details
// - authorization
// - map controllers
// - serilog request logging
// - http request context logging middleware
app.UseWaystoneApiApplicationBuilder()
 .AcceptDefaults();

Advanced Usage

// program.cs
using Waystone.Common.Api;

// after creating the web application builder
builder.Host.UseSerilog(
 (context, provider, configuration) => 
 configuration.ReadFrom.Configuration(context.Configuration)
 .Enrich.WithCorrelationIdHeader(builder.Configuration, provider)
 .Enrich.WithHttpContext(provider);
);

// Manually configure Waystone.Common.Api
builder.Services
 .AddWaystoneApiServiceBuilder(
 builder.Environment,
 builder.Configuration,
 typeof(Program))
 .AddControllers()
 .AddRoutingConventions()
 .AddProblemDetails(options => { /* configure problem details */ })
 .AddSwaggerDocumentation(
 apiName: "ACME",
 apiVersion: "v1",
 apiDescription: "An api for ACME")
 .BindCorrelationIdHeaderOptions();
 
// After creating the web application with `builder.Build()`
app.UseWaystoneApiApplicationBuilder()
 .UseCorrelationIdHeaderMiddleware()
 .UseHttpContextDtoMiddleware();

app.UseHttpsRedirection();
app.UseProblemDetails();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.UseSerilogRequestLogging();
Product Versions Compatible and additional computed target framework versions.
.NET net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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.3.0 456 3/19/2023
2.3.0-alpha.12 232 3/19/2023
2.3.0-alpha.3 225 3/17/2023
2.3.0-alpha.1 216 3/17/2023
2.1.0 417 2/7/2023
2.1.0-alpha.19 228 2/7/2023
2.1.0-alpha.13 236 11/29/2022
2.1.0-alpha.8 227 11/28/2022
2.1.0-alpha.4 216 11/4/2022
2.1.0-alpha.1 268 6/27/2022
2.0.1 662 6/23/2022
2.0.1-alpha.3 261 6/23/2022
2.0.0 638 6/23/2022
2.0.0-alpha.9 277 6/23/2022
1.5.1-alpha.7 268 6/22/2022
1.5.1-alpha.3 249 6/22/2022
1.5.1-alpha.1 257 6/22/2022
1.5.0 637 6/22/2022
1.5.0-alpha.12 263 6/22/2022
1.5.0-alpha.7 271 6/22/2022
Loading failed