Files
components/LiteCharms.Features.MidrandBooks/Extensions/Shop.cs
T
Khwezi Mngoma 630e74814b
continuous-integration/drone/pr Build is passing
Catering for service registration of non-UI apps
2026-06-13 10:45:31 +02:00

29 lines
1.0 KiB
C#

using LiteCharms.Features.Abstractions;
using LiteCharms.Features.Browser;
using LiteCharms.Features.MidrandBooks.Abstractions;
namespace LiteCharms.Features.MidrandBooks.Extensions;
public static class Shop
{
public static IServiceCollection AddShopServices(this IServiceCollection services, bool includeLocalStorage = false)
{
var serviceType = typeof(IService);
var sharedImplementations = typeof(IFeatures).Assembly.GetTypes()
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
foreach (var sharedImplementation in sharedImplementations) services.AddScoped(sharedImplementation);
var coreImplementations = typeof(IMidrandBooks).Assembly.GetTypes()
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
foreach (var coreImplementation in coreImplementations) services.AddScoped(coreImplementation);
if (includeLocalStorage)
services.AddScoped<LocalStorageService>();
return services;
}
}