fix: Change SQLExecutor service registration to scoped

Updated the `AddSQLExecutor<T>` method in the `DIExtensions` class to register `ISQLExecutor<T>` as a scoped service instead of a singleton. This ensures that a new instance of `SQLExecutor<T>` is created for each request within the same scope, improving resource management and request isolation.
This commit is contained in:
Developer 02 2025-05-05 00:36:00 +02:00
parent 841da3c261
commit 7cffc3f7bc

View File

@ -71,7 +71,7 @@ public static class DIExtensions
public static IServiceCollection AddSQLExecutor<T>(this IServiceCollection services) where T : class
{
services.AddSingleton<ISQLExecutor<T>, SQLExecutor<T>>();
services.AddScoped<ISQLExecutor<T>, SQLExecutor<T>>();
var interfaceType = typeof(ISQL<>);
var targetGenericType = interfaceType.MakeGenericType(typeof(T));