A Month ago, the 3rd version of the RC  has been released to test out .NET 5 support. Alot of code refactoring has been done for v5 and there are breaking changes. I would really appreciate if you could test it out as well to better improve this project and to ensure we capture every scenario before rolling out an official v5 release.

AutoWrapper is a simple, yet customizable global HTTP exception handler and response wrapper for ASP.NET Core APIs. It uses an ASP.NET Core middleware to intercept incoming HTTP requests and automatically wraps the responses for you by providing a consistent response format for both successful and error results. The goal is to let you focus on your business code specific requirements and let the wrapper automatically handle the HTTP response. This can speedup the development time when building your APIs while enforcing own standards for your HTTP responses. For more information, see: AutoWrapper on Github.

Breaking changes

  • This release only supports .NET 5.
  • Middleware has been renamed from UseApiResponseAndExceptionWrapper to. UseAutoWrapper. Make sure to update your Startup.cs to use the new name.
  • ProblemDetails is now the default exception format.
  • UseApiProblemDetailsException has been renamed to DisableProblemDetailsException.
  • Removed Newtonsoft.Json dependency and replaced it with System.Text.Json.
  • Use the interface IApiResponse model instead of the concrete ApiResponse. model for returning responses using the default format. This allows you to add your own properties that will wrapped within the Result property.
  • AutoWrapIgnore and RequestDataLogIgnore attributes now leaves under AutoWrapper.Attributes namespace. The implementation was changed from using IActionFilter to use Attribute, eliminating all the request header logic.

The following options has been removed:

  • ApiVersion
  • ReferenceLoopHandling
  • UseCustomSchema
ReferenceLoopHandling and DefaultContractResolver aren't still supported.

Installation

  1. Download and Install the latest AutoWrapper.Core from NuGet or via CLI:
PM> Install-Package AutoWrapper.Core -Version 5.0.0-rc-03
  1. Declare the following namespace within Startup.cs
using AutoWrapper;
  1. Register the middleware below within the Configure() method of Startup.cs "before" the UseRouting() middleware:
app.UseAutoWrapper();

That's simple! Please provide feedback if there are any issues you encountered. Thank you!