Refactored database registration to allow postgres to use internal representations for afster performance

This commit is contained in:
Khwezi Mngoma
2026-05-28 09:05:49 +02:00
parent 902942eee6
commit 2a0b34c730
20 changed files with 441 additions and 116 deletions
@@ -4,19 +4,15 @@ namespace LiteCharms.Features.MidrandBooks.Extensions;
public static class Shop
{
public static IServiceCollection AddShopServices(this IServiceCollection services, Assembly assembly, ServiceLifetime serviceLifetime)
public static IServiceCollection AddShopServices(this IServiceCollection services)
{
var serviceType = typeof(IService);
var implementations = assembly.GetTypes()
var implementations = Assembly.GetExecutingAssembly().GetTypes()
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
foreach (var implementation in implementations)
{
var descriptor = new ServiceDescriptor(serviceType, implementation, serviceLifetime);
services.Add(descriptor);
}
foreach (var implementation in implementations)
services.AddScoped(implementation);
return services;
}