Lewee.Infrastructure.AspNet.WebApi 0.8.0

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.8.0                
NuGet\Install-Package Lewee.Infrastructure.AspNet.WebApi -Version 0.8.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="Lewee.Infrastructure.AspNet.WebApi" Version="0.8.0" />                
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.8.0                
#r "nuget: Lewee.Infrastructure.AspNet.WebApi, 0.8.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.
// Install Lewee.Infrastructure.AspNet.WebApi as a Cake Addin
#addin nuget:?package=Lewee.Infrastructure.AspNet.WebApi&version=0.8.0

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

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.23.0 116 6/14/2024
0.22.0 111 6/3/2024
0.21.0 182 9/24/2023
0.20.0-alpha.1 63 9/24/2023
0.17.0-alpha.1 86 9/23/2023
0.16.0-alpha.1 81 9/23/2023
0.10.0 146 9/19/2023
0.9.0 147 9/17/2023
0.8.0 153 9/3/2023
0.7.0 147 9/3/2023
0.6.0 146 9/1/2023
0.5.3 163 8/25/2023
0.1.0 196 3/28/2023