20 lines
637 B
C#
20 lines
637 B
C#
using PostFundManagement.Application.Abstractions;
|
|
using PostFundManagement.Domain.Abstractions;
|
|
|
|
namespace PostFundManagement.Application.Extensions;
|
|
|
|
public static class General
|
|
{
|
|
public static IServiceCollection AddRegisterServices(this IServiceCollection services)
|
|
{
|
|
var serviceType = typeof(IService);
|
|
|
|
var sharedImplementations = typeof(IApplication).Assembly.GetTypes()
|
|
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
|
|
|
|
foreach (var sharedImplementation in sharedImplementations) services.AddScoped(sharedImplementation);
|
|
|
|
return services;
|
|
}
|
|
}
|