902942eee6
continuous-integration/drone/pr Build is passing
Sealed qualifying public classes Migrated database changes
24 lines
728 B
C#
24 lines
728 B
C#
using LiteCharms.Features.MidrandBooks.Abstractions;
|
|
|
|
namespace LiteCharms.Features.MidrandBooks.Extensions;
|
|
|
|
public static class Shop
|
|
{
|
|
public static IServiceCollection AddShopServices(this IServiceCollection services, Assembly assembly, ServiceLifetime serviceLifetime)
|
|
{
|
|
var serviceType = typeof(IService);
|
|
|
|
var implementations = assembly.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);
|
|
}
|
|
|
|
return services;
|
|
}
|
|
}
|