Lewee.Infrastructure.AspNet.WebApi 0.5.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Lewee.Infrastructure.AspNet.WebApi --version 0.5.3
NuGet\Install-Package Lewee.Infrastructure.AspNet.WebApi -Version 0.5.3
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="Lewee.Infrastructure.AspNet.WebApi" Version="0.5.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lewee.Infrastructure.AspNet.WebApi --version 0.5.3
#r "nuget: Lewee.Infrastructure.AspNet.WebApi, 0.5.3"
#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.
// Install Lewee.Infrastructure.AspNet.WebApi as a Cake Addin
#addin nuget:?package=Lewee.Infrastructure.AspNet.WebApi&version=0.5.3

// Install Lewee.Infrastructure.AspNet.WebApi as a Cake Tool
#tool nuget:?package=Lewee.Infrastructure.AspNet.WebApi&version=0.5.3

Lewee.Infrastructure.AspNet.WebApi

This package assists with configuring and developing for ASP.Net Web API projects.

Dependencies

Features

  • CORS configuration
  • Controller configuration
  • ApiControllerBase
  • Extension methods to convert Result to IActionResult with appropriate HTTP status codes

services in the code examples below are Microsoft.Extensions.DependencyInjection.ServicesCollection.

CORS Configuration

services.ConfigureCorsDefaultPolicy("https://allowed-orgin1.com;https://allowed-origin2.com");

Controller Configuration

services.ConfigureControllers();

This configures the following:

  • Controller names to use kebab-case when using the [Controller] attribute for routing naming
  • Camel-casing for JSON serialization.
  • Adds the problem details service

ApiControllerBase

Lewee.Infrastructure.AspNet.WebApi.ApiControllerBase is an abstract class that has public two read-only properties

  • Mediator (constructor dependency for using Mediatr)
  • CorrelationId (tries to parse a GUID from a correlation ID header or returns a new GUID if one does not exist)
Result Extension Methods

TODO

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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
0.21.0 142 9/24/2023
0.20.0-alpha.1 50 9/24/2023
0.17.0-alpha.1 60 9/23/2023
0.16.0-alpha.1 61 9/23/2023
0.10.0 110 9/19/2023
0.9.0 113 9/17/2023
0.8.0 117 9/3/2023
0.7.0 107 9/3/2023
0.6.0 106 9/1/2023
0.5.3 128 8/25/2023
0.1.0 169 3/28/2023