Extensions Methods
Namespace: RA.Utilities.Api.Middlewares.Extensions
The extension methods in the RA.Utilities.Api.Middlewares.Extensions namespace serve as convenient
shortcuts for registering your custom middlewares with the ASP.NET Core application pipeline.
In ASP.NET Core, the standard way to add a middleware is by calling app.UseMiddleware<TMiddleware>().
While this works perfectly fine, it can be a bit verbose.
The extension methods, UseHttpLoggingMiddleware()
and UseDefaultHeadersMiddleware(), provide a cleaner, more readable,
and more discoverable way to do the same thing.
This is a common convention used by Microsoft and other popular library authors in the .NET ecosystem.
🧩 Available Extensions
📄️ ApplicationBuilderExtensions
The ApplicationBuilderExtensions class provides a set of convenient "shortcut" methods for registering your custom middlewares with the ASP.NET Core application pipeline.
📄️ ServiceCollectionExtensions
The ServiceCollectionExtensions class provides extension methods for IServiceCollection to simplify the registration of middleware services and their configurations in the ASP.NET Core dependency injection (DI) container.