20 lines
562 B
C#
20 lines
562 B
C#
using LiteCharms.Features.Abstractions;
|
|
|
|
namespace LiteCharms.Features.MidrandBooks.Extensions;
|
|
|
|
public static class Shop
|
|
{
|
|
public static IServiceCollection AddShopServices(this IServiceCollection services, Assembly assembly)
|
|
{
|
|
var serviceType = typeof(IService);
|
|
|
|
var implementations = assembly.GetTypes()
|
|
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
|
|
|
|
foreach (var implementation in implementations)
|
|
services.AddScoped(implementation);
|
|
|
|
return services;
|
|
}
|
|
}
|