Remove Slim dependency and adhere to Microsoft.Extensions standards

This commit is contained in:
2026-01-11 01:02:42 +01:00
parent 5e5cdb3b47
commit 124ae942b5
11 changed files with 46 additions and 307 deletions
@@ -0,0 +1,34 @@
using Microsoft.Extensions.DependencyInjection;
using System.Net.Http;
using System.Net.WebSockets;
namespace System.Extensions;
public static class ServiceCollectionExtensions
{
/// <summary>
/// Register a scoped <see cref="IHttpClient{TScope}"/> to be used by the DI engine.
/// </summary>
/// <typeparam name="T">Type of the scoped <see cref="IHttpClient{TScope}"/>.</typeparam>
/// <param name="services"><see cref="IServiceCollection"/>.</param>
/// <returns><see cref="HttpClientBuilder{T}"/> to build the http client.</returns>
public static HttpClientBuilder<T> RegisterHttpClient<T>(this IServiceCollection services)
{
services.ThrowIfNull(nameof(services));
return new HttpClientBuilder<T>(services);
}
/// <summary>
/// Register a scoped <see cref="IClientWebSocket{TScope}"/> to be used by the DI engine.
/// </summary>
/// <typeparam name="T">Type of the scoped <see cref="IClientWebSocket{TScope}"/>.</typeparam>
/// <param name="services"><see cref="IServiceCollection"/>.</param>
/// <returns><see cref="ClientWebSocketBuilder{T}"/> to build the websocket client.</returns>
public static ClientWebSocketBuilder<T> RegisterClientWebSocket<T>(this IServiceCollection services)
{
services.ThrowIfNull(nameof(services));
return new ClientWebSocketBuilder<T>(services);
}
}