|
|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Volo.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
|
|
|
|
@ -27,5 +29,40 @@ namespace Microsoft.Extensions.DependencyInjection
|
|
|
|
|
|
|
|
|
|
return conventionalRegistrars;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddAssemblyOf<T>(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
return services.AddAssembly(typeof(T).GetTypeInfo().Assembly);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddAssembly(this IServiceCollection services, Assembly assembly)
|
|
|
|
|
{
|
|
|
|
|
foreach (var registrar in services.GetConventionalRegistrars())
|
|
|
|
|
{
|
|
|
|
|
registrar.AddAssembly(services, assembly);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddTypes(this IServiceCollection services, params Type[] types)
|
|
|
|
|
{
|
|
|
|
|
foreach (var registrar in services.GetConventionalRegistrars())
|
|
|
|
|
{
|
|
|
|
|
registrar.AddTypes(services, types);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddType(this IServiceCollection services, Type type)
|
|
|
|
|
{
|
|
|
|
|
foreach (var registrar in services.GetConventionalRegistrars())
|
|
|
|
|
{
|
|
|
|
|
registrar.AddType(services, type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|